しかし、プラグインで行われたリンティングに従うと、GitHubアクションでリンティングテストが失敗すると確信しています。
アハ! pnpm i は私が見逃していた魔法のようです。Discourseコアを更新するスクリプトとリンティングを行うスクリプトに「pnpm i」を追加しました。 . .
それで、私のスクリプトが現在行っていることは次のとおりです。
if [[ \"$ARG\" == \"eslint\" ]]
then
# See https://github.com/discourse/.github/blob/main/.github/workflows/discourse-plugin.yml
if [ -f plugin.rb ]
then
echo \"Linting current directory.\"
else
echo \"Not on a plugin. Using $DEFAULT_PLUGIN\"
cd $DEFAULT_PLUGIN
fi
echo \"LINTING $(pwd)\"
#cd /home/pfaffman/src/literatecomputing/discourse-display-email
# pnpm install
echo \"Doing `pnpm i`\"
pnpm -i
echo -n ESLINT. . .
pnpm eslint --no-error-on-unmatched-pattern {test,assets,admin/assets}/javascripts
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"eslint was unhappy -- $exit_code -- trying to fix\"
pnpm eslint --fix --no-error-on-unmatched-pattern {test,assets,admin/assets}/javascripts
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"eslint was still unhappy -- $exit_code -- game over\"
exit
fi
fi
echo ESLINT done.
## styllint
echo -n STYLELINT . . .
pnpm stylelint --allow-empty-input \"assets/**/*.scss\"
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"stylelint is unhappy. Trying to fix . . . \"
fi
pnpm stylelint --fix --allow-empty-input \"assets/**/*.scss\"
pnpm stylelint --allow-empty-input \"assets/**/*.scss\"
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"stylelint is still unhappy. this is sad. Game over.\"
exit
fi
echo \"DONE!\"
## end stylelint
## PRETTIER
echo -n \"Prettier . . . \"
if [ -n \"$(find assets -type f \\( -name \"*.scss\" -or -name \"*.js\" -or -name \"*.gjs\" -or -name \"*.hbs\" \\) 2\u003e/dev/null)\" ]; then
#pnpm prettier --write 'assets/**/*.{scss,js,gjs,es6,hbs}'
# echo \"doing pnpm prettier --write --log-level warn assets/**/*.{scss,js,gjs,hbs}\"
pnpm prettier --write --log-level error \"assets/**/*.{scss,js,gjs,hbs}\"
if [[ $? -ne 0 ]]
then
echo \"prettier assets did something!!! -- $?\"
sleep 5
fi
fi
if [ -n \"$(find admin/assets -type f \\( -name \"*.scss\" -or -name \"*.js\" -or -name \"*.gjs\" -or -name \"*.hbs\" \\) 2\u003e/dev/null)\" ]; then
#pnpm prettier --write 'assets/**/*.{scss,js,gjs,es6,hbs}'
# echo \"doing pnpm prettier --write --log-level warn admin/assets/**/*.{scss,js,gjs,hbs}\"
pnpm prettier --write --log-level log \"assets/**/*.{scss,js,gjs,es6,hbs}\"
if [[ $? -ne 0 ]]
then
echo \"prettier admin/assets did something!!! -- $?\"
pnpm prettier --check --log-level log \"assets/**/*.{scss,js,gjs,es6,hbs}\"
fi
fi
if [ -n \"$(find test -type f \\( -name \"*.js\" -or -name \"*.gjs\" \\) 2\u003e/dev/null)\" ]; then
#pnpm prettier --write 'assets/**/*.{scss,js,gjs,es6,hbs}'
# echo \"doing pnpm prettier --write --log-level warn assets/**/*.{scss,js,gjs,es6,hbs}\"
pnpm prettier --write --log-level warn \"test/**/*.{js,gjs}\"
if [[ $? -ne 0 ]]
then
echo \"prettier test did something!!! -- $?\"
pnpm prettier --check --loglevel log \"test/**/*.{js,gjs}\"
fi
fi
echo \"Done with prettier\"
echo \"ember-template-lint\"
pnpm ember-template-lint --fix --no-error-on-unmatched-pattern assets/javascripts admin/assets/javascripts
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"done with ember-template-lint --fix --no-error-on-unmatched-pattern assets/javascripts -- with $exit_code\"
echo sleep 5
sleep 5
fi
#bundle exec stree write Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')
bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"stree is unhappy. Trying to fix in 2 seconds . .. \"
sleep 2
echo \"here we go!!!\"
bundle exec stree write Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')
fi
bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"stree is still unhappy. this is sad. Waiting to make you sadder\"
sleep 15
fi
echo done with stree
echo \"rubocop!\"
bundle exec rubocop -A $(find . -name \"*.rb\"|grep -v gems)
exit_code=\"$?\"
if [[ $exit_code -ne 0 ]]
then
echo \"done with rubocop -- $exit_code\"
sleep 15
fi
exit
fi
しかし、これも持っています。これはほとんど同じように機能すると思います。
if [[ \"$ARG\" == \"lint\" ]]
then
cd ~/src/discourse-repos/discourse
find plugins/discourse-pfaffmanager/assets -type f \\( -name \"*.scss\" -o -name \"*.js\" -o -name \"*.gjs\" -o -name \"*.hbs\" -o -name \"*.rb\" \\) -exec ./bin/lint --fix {} +
cd -
fi
今や唯一の違いは、コアのリンティングがこれについて不満を持っていることだけです(そして、コアがそれを検出し、プラグインが検出しない理由と、それらの非推奨を早めに修正しても害がない理由が理解できると思います)。
/home/pfaffman/src/discourse-repos/discourse/plugins/discourse-pfaffmanager/assets/javascripts/discourse/components/modal/really-delete.gjs
2:8 error Use Glimmer components(@glimmer/component) instead of classic components(@ember/component) ember/no-classic-components
✖ 1 problem (1 error, 0 warnings)
そして、bin/lint を使用すると、リンティングで何か変更があって、54行のスクリプトを更新する必要があることを心配する必要がなくなります。そうですよね?
待って。スケルトンリポジトリのどこに文書化されているのですか?
体系的に変更を展開する方法については、ガイダンスをいただけると嬉しいのですが、私の小さな一連のものは実際にはあなたの問題ではないことを理解しています。 . . これは実際にはここには属しませんが、mass-pr を理解しようと何度か試みましたが、まだ成功していません。私は通常、スケルトンの最新のプルからいくつかの .whatever ファイルをコピーして、うまくいけばと思っています。
そして、それらのスクリプトは16個あります。それらのいずれかが更新されるたびに、リポジトリを監視し、それを実行する必要がありますか?そして、必要なファイルをコピーできないため、スケルトンをクローンしていないように見えるテーマがいくつかありますか?
そして、いくつかのものは sed: can’t read s/default.yml/stree-compat.yml/: No such file or directory のようなもので失敗しますか?それはスケルトンリポジトリをクローンしていないからですか?(時間があるときに、適切な場所でトピックを開始します)。