flyntwp / flynt-cli Goto Github PK
View Code? Open in Web Editor NEWCLI tool for the WordPress Flynt framework
License: MIT License
CLI tool for the WordPress Flynt framework
License: MIT License
First of all. Great project and thanks for contributing it to the community :)
I have been trying to setup a gitlab CI pipeline that builds a flynt project and I after many hours of hitting my head against cryptic errors I realized that TTY needs to be allocated for flynt-cli to work properly.
In my local terminal everything runs alright but when I try to run a flynt install
the CI will fail as soon as it tries to print updates to the process to the terminal output
An example:
▶ Saving config...
✔ Saving config...
▶ Installing node dependencies...
[Installs yarn dependencies]
Done in 19.34s.
but when it needs to output "✔ Installing node dependencies... " the build fails. (the terminal without tty won't actually output those 3 first lines but I explain it like this to illustrate the flow)
I can reproduce this locally by running:
docker run --rm netzstrategen/wp-flynt sh -c "flynt install"
while running:
docker run -it --rm netzstrategen/wp-flynt sh -c "flynt install"
runs successfully. Notice the -it
I think it may be caused by some package like ora
https://www.npmjs.com/package/ora
Quoting the readme
isEnabled
Type: boolean
Force enable/disable the spinner. If not specified, the spinner will be enabled if the stream is being run inside a TTY context (not spawned or piped) and/or not in a CI environment.
Maybe flynt should detect if it is running inside a TTY and adjust properly.
Can you give more hints about what is happening?
When running flynt setup
for an existing project, if the database user already exists then the final flynt setup createDb
task fails because it can't create the user (because it already exists).
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'localhost'@'localhost'
Is it possible to add a check to the relevant query that checks IF NOT EXISTS
before attempting to create the database user (similar to the line above)?
I already tried manually changing the command to CREATE USER IF NOT EXISTS '${answers.dbUser}'@'${answers.dbHost}' IDENTIFIED BY '${answers.dbPassword}';
but that is invalid syntax.
I guess this feature is still missing on the current flynt-cli right? I build a prototype 2 days ago but wasn't really sure and happy about the results.
I think we should have commands like this (OR):
flynt component
and flynt feature
flynt scaffold component
and flynt scaffold feature
Which will trigger a select-prompt for the component type (pick from our category list, eg. list
, block
, document
, slider
etc.) similar to our git cz
prompt. As an alternative you should also be allowed to select without category
or something similar.
After selecting the component type there should be a simple prompt with following questions:
ComponentName
(Y/n)
(Y/n)
(Y/n)
(Y/n)
(Y/n)
After finishing the prompt, the flynt-cli will automatically go into the projects theme folder and create a folder for the component inside web/app/themes/theme-name/Components
and create new files for each selected file inside.
A similar flow could be used for the feature scaffolding.
Any thoughts or were there different plans about this?
No matter if there are values set for the additional search and replace strings, it asks every time anyways.
Staging DB Backup Folder name was backups in old tool, should it be backup now? Need to adjust .gitignore accordingly.
When setting up a project, the .env
and web/.htaccess
files (among others) are excluded from deployment by default, which leads to the need for manual setup on the server. That entails:
your-website.domain/wp/wp-admin
and opening the permalinks pageI'm not sure if there is a nicer way, but maybe we could (optionally) deploy once after the create task has finished? This step could then take care of creating the .env file and flushing the rewrite rules.
The annoying thing would be the increase in prompts you have to go through (but you need to go through these anyways with our workflow).
The node version is only checked half way through flynt create
(I believe, when it reaches the installYarn
task) meaning if you have the wrong version, you have to manually run the remaining steps manually.
So this weekend I had to work on a Flynt project and wanted to set up the project on a computer with no SSH key registered on Github.
If I can remember it was the flynt-core
package not being able to install without a valid SSH key registered on Github (I guess the required package is installed via SSH instead of HTTPS which triggers this issue).
That means having a Github Account with an SSH key is a requirement right now which shouldn't really be there.
Could've also be a bug on the local computer, but I think I encountered this twice already.
It just disappears in the sea of the epic log. Maybe just show all relevant things once at the end of it all.
tmp/flynt-cli
folder persists as an empty directory after all tasks are done
Currently the sed
command on Linux breaks when you want to do clones so even flynt setup
breaks on Linux without touching the code because there is an extra, empty argument in the sed command.
https://github.com/bleech/flynt-cli/blob/master/src/clone/db.js#L85
cmds.push(`sed -i '' 's/DEFINER=[^*]*\\*/\\*/g' ${tmpDir}/${backupTransferFile}`)
should be changed to
cmds.push(`sed -i 's/DEFINER=[^*]*\\*/\\*/g' ${tmpDir}/${backupTransferFile}`)
which fixes it on Linux. We need to check it on OSX at least.
It tells you to use the name of the folder, but if the theme name changes, this needs to be adjusted... Is it used for anything except getting the correct theme folder?
Setting a different base path than the one where the .flynt.json
is, breaks the clone db task as it tries to use the base path to get /tmp/
and /backup/
directories. Creating the directories manually or providing a --configPath
(not sure if that works, see #69) to get around the issue did not work.
We should probably remove anything not explicitly excluded. Otherwise this can lead to extra files that can get in the way. (Is just adding --remove
to the rsync task enough?)
will work when in verbose mode
Would be cool if I could just tab complete flynt commands. Maybe using either one of the following packages for this feature:
The default help dialog that is displayed with flynt --help
should also be displayed if you just run flynt
.
When for example you create a new flynt project via flynt create
and you answered all the prompts it could happen, that the flynt create
script runs into an issue. This will stop the script and print a list of commands that were not executed due to the issue.
After resolving the issue, I have to either run all these commands manually and hope everything works fine or I have to rerun the whole flynt create
script which also asks me for the prompt answers again which gets frustrating if you have more than 1 issue to fix/test
I thought about a command, for example flynt continue
which allows the user to continue a broken task (for example a new project creation) where the last script stopped working. This way you don't have to run all flynt create xyz
commands again and you don't need to reanswer all the prompts.
Since .dev
is now a real domain
I get this two time, once during composer require and once during yarn build task:
Option `replace` is deprecated. Use `from` instead.
Option `with` is deprecated. Use `to` instead.
when i try cloning with the configPath variable set the config is not used
flynt clone --from production --configPath ~/example_flynt.json
Success: Switched to 'Flynt Theme' theme.
Notice: Array to string conversion in /Users/doga/www/my-website/web/app/themes/my-website/dist/Features/Acf/Loader.php on line 102
Notice: Array to string conversion in /Users/doga/www/my-website/web/app/themes/my-website/dist/Features/Acf/Loader.php on line 102
Notice: Array to string conversion in /Users/doga/www/my-website/web/app/themes/my-website/dist/Features/Acf/Loader.php on line 102
Notice: Array to string conversion in /Users/doga/www/my-website/web/app/themes/my-website/dist/Features/Acf/Loader.php on line 102
Success: Rewrite rules flushed.
Success: Rewrite structure set.
Notice: Array to string conversion in /Users/doga/www/my-website/web/app/themes/my-website/dist/Features/Acf/Loader.php on line 102
Notice: Array to string conversion in /Users/doga/www/my-website/web/app/themes/my-website/dist/Features/Acf/Loader.php on line 102
Plugin 'advanced-custom-fields-pro' activated.
Success: Activated 1 of 1 plugins.
Weird. Why would that file even matter in this context?
Command: flynt clone db
The following error message only shows up when run in verbose mode (-v):
Error in cloneDb. Number of search and replace strings do not match.
When run in non-verbose mode, the cli shows a green checkmarks signalling success, which is not correct in this case.
Hey Flynt team!
I recently tried to create a new project via flynt create
but had a lot of trouble to get it working.
OS
Windows 10 1804
Node Version
6.4.0
Composer Version
1.6.4
WP CLI Version
1.5.1
When I try to create a project, I receive the following error after entering all answers to the prompts.
[Composer\Repository\InvalidRepositoryException]
A repository of type "package" contains an invalid package definition: Invalid package information:
version : invalid value (~5.6.10): Invalid version string "~5.6.10"
Invalid package definition:
{"name":"advanced-custom-fields\/advanced-custom-fields-pro","version":"~5.6.10","type":"wordpress-plugin","dist":{"type":"zip","url":"https:\/\/connect.advancedcustomfields.com\/index.php?p=pro&a=download"},"require":{"philippbaschke\/acf-pro-installer":"^1.0","composer\/installers":"^1.0"}}
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
✖ Installing PHP composer dependencies...
Execution failed. The following commands were not executed:
flynt create requireComposerPackages
flynt create setupTheme
flynt create replaceProjectSpecificStrings
flynt create db
flynt create installYarn
flynt create buildYarn
flynt create removeDotEnv
flynt create setupWordpress
flynt create activateWordpress
flynt create initGitRepo
Do not forget to add the flags used to run the current command.
My .env
file is just the barebone .env.example without any informations I provided to the CLI.
Output .env content:
DB_NAME=database_name
DB_USER=database_user
DB_PASSWORD=database_password
# Optional variables
# DB_HOST=localhost
# DB_PREFIX=wp_
WP_ENV=development
WP_HOME=http://example.com
WP_SITEURL=${WP_HOME}/wp
# Generate your keys here: https://roots.io/salts.html
AUTH_KEY='generateme'
SECURE_AUTH_KEY='generateme'
LOGGED_IN_KEY='generateme'
NONCE_KEY='generateme'
AUTH_SALT='generateme'
SECURE_AUTH_SALT='generateme'
LOGGED_IN_SALT='generateme'
NONCE_SALT='generateme'
looks like this is breaking the ACF Pro setup because the ACF_PRO_KEY is missing. It's strange, that the ~5.6.10
version is recognized as an syntax error. Is this normal composer behaviour?
I can fix it by manually adding the data to the .env and reinstall the composer packages.
Is this also occuring for anyone else?
Trying to run flynt clone --from local --to development
on 0.2.1 leads to the error:
Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.
Downgrading to 0.2.0 worked fine though.
Since Flynt already uses Composer to install Wordpress Plugins it would be cool, if we could also use composer to install Flynt features. I developed a small feature and published it to Github but the installation process is quite annoying with manual copying or git submodules.
Is this possible?
The Wordpress version is hardcoded into the cli.
Should there be a prompt like before? Or should it maybe always take the latest version?
Or do we really want to bump the patch version every time they release it?
We agreed that the .env file should be tracked in a repo, so it should not be ignored in the repo anymore (Bedrock default).
During deployment it will still be excluded.
Hi Flynt-cli team,
I having the little problem
Overview of the Issue:
OS restrictive dependencies are blocking flynt-cli during the first launch.
Motivation or Use Case:
It seams to block me to try out the tool.
Flynt Version(s)
I don`t think is about versions. I am trying the latest flynt-cli [v0.2.2]
Browsers and Operating System:
This seams to be a Operating System related issue [Linux]
Reproduce the Error:
Using Ubuntu 16 and follow the manual installation reported here https://docs.flyntwp.com/guide/getting-started/setting-up-flynt/
Everything went good and ready in my env PATH.. here details:
node v8.10.0
composer 1.6.3
yarn 1.12.3
phpcs 3.4.0
During the Flynt-cli installation I got the following:
me@mylap:~$ yarn global add @flyntwp/flynt-cli
yarn global v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
**info [email protected]: The platform "linux" is incompatible with this module.**
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "@flyntwp/[email protected]" with binaries:
- flynt
Done in 2.92s.
me@mylap:~$ flynt create
Unhandled rejection Please have 'wp' available in your PATH.
me@mylap:~$ yarn global add wp
yarn global v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: The platform "linux" is incompatible with this module.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
Suggest a Fix:
I don`t know yet what purpose of this "wp" package is but it seams to be an optional dependency and maybe it might be included in a conditional statement.. or excluded?
Any idea?
Thank you
t
There should be a very minor label for this... if I manually edit the .flynt.json file Atom adds a new line, but the CLI saves it without a new line.
Would be nice. Nothing major.
Unlike the create command, which runs wp rewrite flush --hard
as part of the activate wordpress step, the setup command does not flush the rewrite rules.
Due to that, you cannot access your-website.dev/admin
unless you go to your-website.dev/wp/wp-admin/
first and flush them manually on the permalinks page.
That is mildly annoying.
The error thrown in the requirements check for wpCliDotEnv
is custom and not outputting the actual error encountered.
I noticed this because in my case the error thrown was misleading - I had the package installed fine (I'd just messed up a few steps in flynt create
), so the error telling me to check my install of wp-cli-dotenv-command totally confused me.
Currently you don't have control over the mysql protocol which disallows you to use flynt-cli in combination with a tcp connection.
Example Setup
mysql --host=localhost --user=USERNAME --password=PASSWORD
because the WSL MySQL socket disallows connections to localhost
because this is done via the tcp
protocol.--protocol=tcp
to the command.The problem with this is, that it's related to the system, not the project you're working on so this setting shouldn't be in the projects .flynt.json
What about adding a .flynt.json
or a .flynt-global.json
in the users home folder where they can set additional settings like the mysql protocol for example as a global option for flynt?
Since this Bedrock update roots/bedrock#412 the flynt create
command is not working anymore because of a conflict during requireComposerPackages
.
This comes from the fact that the philippbaschke/acf-pro-installer package that is explicitly requiring a ^2.2 version of phpdotenv, while bedrock asks for a ^3
It has already been reported and a PR is already available PhilippBaschke/acf-pro-installer#38, yet it seems that it is unclear if the repo is still alive and if this will get merged soon.
In the discussion someone created a new repo as an alternative, which supports phpdotenv ^3 https://github.com/ffraenz/private-composer-installer
Error message below
▶ Installing WordPress...
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
✖ Installing WordPress...
Execution failed. The following commands were not executed:
flynt create setupWordpress
flynt create activateWordpress
flynt create initGitRepo
Do not forget to add the flags used to run the current command.
Leaving out either one of these keys leads to the create command breaking with an error.
I think it would be nice if instead of just outputting basically everything, we had a verbose option (using -v
) for that and only had something like a spinner and an end-result screen by default. Especially relevant for the create command.
Problem
I tried using the flynt-cli for cloning a pretty huge database (around 300mb) and it takes forever.
One clone took me around 15 minutes which is pretty heavy for syncing data to multiple environments.
Is there something that can be done to decrease initial IO load while syncing and using gzip to pack dumps before transfering them?
A developer had this feedback on reddit:
Got this prompt when running yarn build on the starter theme:
yarn start v0.24.6 $ check-node-version --package && gulp node: 8.1.0 npm: 5.0.3 yarn: 0.24.6 Error: Wanted node version 6.0.0 (>=6.0.0 <7.0.0) To install node, run nvm install ^6.0.0 or see https://nodejs.org/ error Command failed with exit code 1.
I downgraded to node 6.11.0 to try the theme out but am wondering if Flynt will support version 8+ in the future.
I think we should either add a note to the documentation or make Node 8 work with Flynt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.