Giter Site home page Giter Site logo

leafsphp / cli Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 796 KB

🎮 A simple command line tool for installing and interacting with your leaf apps

Home Page: https://cli.leafphp.dev/

License: MIT License

PHP 43.03% HTML 2.79% Dockerfile 0.85% Blade 2.09% JavaScript 3.51% CSS 0.38% Vue 0.47% TypeScript 46.88%
leafphp php cli

cli's People

Contributors

crosa7 avatar mychidarko avatar tedtop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

oaksoeya crosa7

cli's Issues

Install leafs/cli on nvm

I use nvm to manage the versions of Node, with this configuration I cannot install leafs/cli globally on the version of node I am using with Composer already installed.

Are there any solutions?

Thanks

Cannot create tests on Windows

Describe the bug
Running leaf test:setup on windows powershell/cmd from within a leaf project gives the message:

> leaf test:setup
'.' is not recognized as an internal or external command,
operable program or batch file.

To Reproduce
Steps to reproduce the behavior:

  1. Install leaf: composer global require leafs/cli
  2. Create a new project: leaf create test-project --api --v3
  3. Navigate to the new project: cd .\test-api\
  4. Attempt to generate tests: leaf test:setup

Expected behavior
I would expect tests to be generated, but instead the error above is displayed.

Additional context
The path to the leaf project does not contain spaces. Running Leaf CLI v2.8.0 on Windows 10

Support of PHP 8.x

At the moment you can't install the leaf cli with php8.0. There are some constraint which are conflicting:

> php -v
PHP 8.0.14 (cli) (built: Dec 20 2021 21:22:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.14, Copyright (c), by Zend Technologies

> composer global require leafs/cli:^2.0
Changed current directory to /home/shens/.config/composer
./composer.json has been updated
Running composer update leafs/cli
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - leafs/cli[v2.0, ..., v2.0.2] require php ^7.2 -> your php version (8.0.14) does not satisfy that requirement.
    - leafs/cli[v2.0.3, ..., v2.0.4] require symfony/console ^5.0 -> found symfony/console[v5.0.0, ..., v5.4.3] but the package is fixed to v4.4.30 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires leafs/cli ^2.0 -> satisfiable by leafs/cli[v2.0, ..., v2.0.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Active support ended 28 Nov 2021 | 2 months ago
And security updates will end on 28 Nov 2022 | in 9 month

Do you have any plans to upgrade to PHP8.0?

Deprecation warnings when starting out a project

Describe the bug
There are some deprecated warnings when you start out a project.

To Reproduce
Steps to reproduce the behavior:

  1. Create a folder you want your project to be in — say some /path/to/my-project
  2. Enter the directory with cd /path/to/my-project
  3. Create a Leaf project with leaf create . --v3
  4. See error

Expected behavior
I expected the project creation process will begin without the deprecation errors

Additional context
I'm on Leaf 2.8.3, PHP 8.2.8

leafcli --watch: leaf-watcher not found

OS: Ubuntu 22.10
PHP: 8.1.7
NPM: 8.18.0
LeafCLI: 2.7.0

LeafCLI installed from composer with
composer global require leafs/cli

When i star a project and serve with
leaf serve --port 8080 --watch
It returns

* Leaf Watcher is required to enable monitoring. Install package?

But if i reply Y, it return this

Installing leaf watcher...

changed 114 packages, and audited 115 packages in 1s

18 packages are looking for funding
run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
npm audit fix --force

Run `npm audit` for details.
sh: 1: leaf-watcher: not found

Installing via npm manually using npm install -g @leafphp/watcher the installation go to end, but when i serve the project it return missing watcher.

Leaf serve --watch does not work on OSX

Trying to run leaf serve with the --watch option, but getting this error:

❯ leaf serve --watch
sh: /Users/jensr/Library/Application: No such file or directory
node:events:505
    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (127)
    at Bus.emit (node:events:503:17)
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@leafphp/watcher/lib/monitor/run.js:190:11)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
  code: 'ERR_UNHANDLED_ERROR',
  context: 127
}

Node.js v20.10.0

Notice how it fails on /Users/jensr/Library/Application: No such file or directory? It seems the script is trying to run something under /Users/jensr/Library/Application Scripts or /Users/jensr/Library/Application Support, but it is not handling the path containing the space character correctly.

`php leaf` not working from any other directory

Describe the bug
The project leaf (php) file cannot be executed from any other directory.
I realized this when I wanted to set up some commands in cron.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project with leaf create newleaf (choose MVC)
  2. run php newleaf/leaf
  3. You will get the following error:
PHP Warning:  Undefined array key "database" in /home/golles/workspace/newleaf/vendor/leafs/mvc-core/src/Core.php on line 79
PHP Warning:  Undefined array key "auth" in /home/golles/workspace/newleaf/vendor/leafs/mvc-core/src/Core.php on line 79
PHP Warning:  Undefined array key "connections" in /home/golles/workspace/newleaf/vendor/leafs/mvc-core/src/Database.php on line 43
PHP Warning:  Trying to access array offset on value of type null in /home/golles/workspace/newleaf/vendor/leafs/mvc-core/src/Database.php on line 43
PHP Fatal error:  Uncaught TypeError: Illuminate\Database\Capsule\Manager::addConnection(): Argument leafsphp/leaf#1 ($config) must be of type array, null given, called in /home/golles/workspace/newleaf/vendor/leafs/mvc-core/src/Database.php on line 43 and defined in /home/golles/workspace/newleaf/vendor/illuminate/database/Capsule/Manager.php:119
Stack trace:
#0 /home/golles/workspace/newleaf/vendor/leafs/mvc-core/src/Database.php(43): Illuminate\Database\Capsule\Manager->addConnection()
leafsphp/leaf#1 /home/golles/workspace/newleaf/leaf(43): Leaf\Database::connect()
leafsphp/leaf#2 {main}
  thrown in /home/golles/workspace/newleaf/vendor/illuminate/database/Capsule/Manager.php on line 119

Expected behavior
I would expect, independent the folder you are in, that this file could be executed.

Additional context
For now, I created leaf.sh to allow to run leaf commands by corn triggers.

#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

cd $SCRIPT_DIR
php leaf $1

Cant run application after leaf cli install because of case sensitivity

Hi,
I tested the leaf cli v2.0.4 and used the create command: leaf create test --api --v3
First thing i found: Documentation is not correct. leaf app:serve doesnt work anymore, it should be leaf serve.

The actual error after starting occurs when I try to reach the application:

> leaf serve
Leaf development server started: http://localhost:5500
Happy coding!
[Thu Feb  3 09:19:43 2022] PHP 8.0.15 Development Server (http://localhost:5500) started
Leaf development server started: http://localhost:5500
Happy coding!
[Thu Feb  3 09:19:46 2022] 127.0.0.1:33078 Accepted
[Thu Feb  3 09:19:46 2022] PHP Warning:  require(/home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/../../../../Config/app.php): Failed to open stream: No such file or directory in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php on line 10
[Thu Feb  3 09:19:46 2022] PHP Fatal error:  Uncaught Error: Failed opening required '/home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/../../../../Config/app.php' (include_path='.:/usr/share/php') in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php:10
Stack trace:
#0 /home/shens/workspaces/lyssar/applications/test/public/index.php(61): AppConfig()
#1 /home/shens/workspaces/lyssar/applications/test/index.php(24): require_once('...')
#2 {main}
  thrown in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php on line 10
[Thu Feb  3 09:19:46 2022] 127.0.0.1:33078 [500]: GET / - Uncaught Error: Failed opening required '/home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/../../../../Config/app.php' (include_path='.:/usr/share/php') in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php:10
Stack trace:
#0 /home/shens/workspaces/lyssar/applications/test/public/index.php(61): AppConfig()
#1 /home/shens/workspaces/lyssar/applications/test/index.php(24): require_once('...')
#2 {main}
  thrown in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php on line 10
Leaf development server started: http://localhost:5500
Happy coding!

Folder structure

> ls -al
insgesamt 212
drwxrwxr-x  9 shens shens   4096 Feb  3 09:17 .
drwxrwxr-x  9 shens shens   4096 Feb  3 09:17 ..
drwxrwxr-x  9 shens shens   4096 Dez 16 10:00 app
-rw-rw-r--  1 shens shens   2123 Dez 16 10:00 composer.json
-rw-rw-r--  1 shens shens 142245 Feb  3 09:17 composer.lock
drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 config
-rw-rw-r--  1 shens shens    220 Dez 16 10:00 .editorconfig
-rw-rw-r--  1 shens shens    624 Feb  3 09:17 .env
-rw-rw-r--  1 shens shens    624 Dez 16 10:00 .env.example
drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 .github
-rw-rw-r--  1 shens shens     66 Dez 16 10:00 .gitignore
-rw-rw-r--  1 shens shens    593 Dez 16 10:00 .htaccess
-rw-rw-r--  1 shens shens    672 Dez 16 10:00 index.php
-rw-rw-r--  1 shens shens   2513 Dez 16 10:00 leaf
drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 lib
drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 public
-rw-rw-r--  1 shens shens    295 Dez 16 10:00 README.MD
drwxrwxr-x  5 shens shens   4096 Dez 16 10:00 storage
drwxrwxr-x 17 shens shens   4096 Feb  3 09:17 vendor

as you can see: All folders are created lowercase, the application tries to find CamelCase folder names instead.

leafcli not installing

Discussed in https://github.com/orgs/leafsphp/discussions/143

Originally posted by vimkaf September 8, 2022
Good day house, I am having some composer troubles when installing leafcli

Command
composer global require leafs/cli

Error
Problem 1
- Root composer.json requires leafs/cli ^2.4 -> satisfiable by leafs/cli[v2.4.0, v2.4.1, v2.4.2].
- leafs/cli[v2.4.0, ..., v2.4.2] require psy/psysh ^0.11.1 -> found psy/psysh[v0.11.1, ..., v0.11.8] but the package is fixed to v0.10.12 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. You can also try re-running composer require with an explicit version constraint, e.g. "composer require leafs/cli:*" to figure out if any version is installable, or "composer require leafs/cli:^2.1" if you know which you need.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.