我们刚刚在 npm 上发布了 @discourse/update-skeleton 包。该包可用于轻松更新现有的主题和插件,使其使用最新的推荐配置(包括 GitHub Actions 和代码检查配置)。
要使用它,请打开你的主题/插件目录,然后运行:
pnpx @discourse/update-skeleton@latest
这将从 discourse-theme-skeleton 或 discourse-plugin-skeleton 中拉取最新的配置和依赖版本,并将其应用到你的仓库中。
输出结果大致如下:
Updated package.json
Updated eslint.config.mjs
Updated .prettierrc.cjs
Updated stylelint.config.mjs
Updated tsconfig.json
Updated .rubocop.yml
Updated .streerc
Updated Gemfile
Updated .github/workflows/discourse-theme.yml
Updated .github/workflows/d-compat-branch.yml
Updated .gitignore
...
Done. Review the diff, then run:
pnpm lint:fix
pnpm lint
bundle exec stree write Gemfile $(git ls-files '*.rb' '*.rake' '*.thor')
bundle exec rubocop -A
bundle exec rubocop
应用更新并修复所有代码检查违规项后,像往常一样在你的仓库中创建一个提交即可。
在首次更新之后,你可以使用 pnpm update-skeleton 作为快捷方式来运行此工具。