@modern-js/main-doc 2.0.0-beta.1 → 2.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/build.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/dev.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/lint.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/new.md +1 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/start.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/test.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/overview.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/bootstrap.md +17 -3
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/auto-actions.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/connect.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/create-app.md +2 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/create-store.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/handle-effect.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/model_.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-local-model.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-model.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-static-model.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-store.md +1 -23
- package/en/docusaurus-plugin-content-docs/current/components/command-tip.md +56 -0
- package/en/docusaurus-plugin-content-docs/current/components/reduck-migration.md +1 -0
- package/en/docusaurus-plugin-content-docs/current/components/reduck-tip.md +5 -0
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/asset-prefix.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/hmr.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/https.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/port.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/progress-bar.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/dev/start-url.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/experiments/lazy-compilation.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/app-icon.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/crossorigin.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/disable-html-folder.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/favicon-by-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/favicon.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/inject-by-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/inject.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/meta-by-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/meta.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/mount-id.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-by-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-parameters-by-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-parameters.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/template.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/title-by-entries.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/html/title.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/asset-prefix.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/assets-retry.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/charset.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/clean-dist-path.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/convert-to-rem.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/copy.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/css-module-local-ident-name.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/data-uri-limit.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-css-extract.md +12 -0
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-css-module-extension.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-filename-hash.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-inline-runtime-chunk.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-minimize.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-source-map.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-ts-checker.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/dist-path.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-asset-fallback.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-asset-manifest.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-css-module-tsdeclaration.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-inline-scripts.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-inline-styles.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-latest-decorators.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/externals.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/filename.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/legal-comments.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/override-browserslist.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/polyfill.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/output/svg-default-export.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/build-cache.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/bundle-analyze.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/chunk-split.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/print-file-size.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/profile.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/remove-console.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/performance/remove-moment-locale.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/plugins.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/router.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/security/sri.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/alias.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/compile-js-data-uri.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/define.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/exclude.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/global-vars.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/include.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/module-scopes.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/pre-entry.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/resolve-extension-prefix.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/source/resolve-main-fields.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/autoprefixer.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/babel.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/css-extract.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/css-loader.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/dev-server.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/html-plugin.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/inspector.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/less.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/minify-css.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/postcss.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/pug.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/sass.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/style-loader.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/styled-components.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/swc.md +42 -0
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/terser.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/ts-checker.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/ts-loader.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/webpack-chain.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/configure/app/tools/webpack.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/guides/basic-features/builder.md +46 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/app.md +152 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/ejs.md +56 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/fs.md +54 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/git.md +49 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/handlebars.md +58 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/json.md +59 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/npm.md +49 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/develop.md +52 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/introduce.md +46 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/run-in-js.md +48 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/structure.md +87 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/common.md +106 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/module.md +39 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/monorepo.md +28 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/mwa.md +89 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/abstract.md +26 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/addFile.md +52 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/addHelper.md +26 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/addManyFile.md +58 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/addPartial.md +26 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/introduce.md +38 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/rmDir.md +24 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/rmFile.md +24 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/updateJSONFile.md +54 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/updateModernConfig.md +26 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.md +33 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/git/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.md +20 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/git/initGitRepo.md +16 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/git/isInGitRepo.md +16 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/hook/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/hook/afterForged.md +35 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/hook/onForged.md +36 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/info/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/info/isFileExit.md +22 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/info/locale.md +17 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/info/readDir.md +22 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/addInputAfter.md +57 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/addInputBefore.md +56 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/setInput.md +42 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/setInputValue.md +30 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/type.md +65 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/introduce.md +91 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/new/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/new/createElement.md +33 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/new/createSubProject.md +35 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/new/enableFunc.md +44 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/new/introduce.md +15 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/npm/_category_.json +4 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/npm/install.md +18 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/develop.md +125 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/use.md +61 -0
- package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/project.md +118 -0
- package/en/docusaurus-plugin-content-docs/current.json +57 -21
- package/package.json +3 -3
- package/scripts/config.ts +2 -2
- package/scripts/summary.en.json +1 -1
- package/scripts/summary.zh.json +1 -1
- package/zh/apis/app/commands/new.md +0 -3
- package/zh/apis/app/hooks/server/test.md +2 -2
- package/zh/apis/app/runtime/app/_category_.json +1 -1
- package/zh/apis/app/runtime/bff/_category_.json +1 -1
- package/zh/apis/app/runtime/core/_category_.json +1 -1
- package/zh/apis/app/runtime/core/bootstrap.md +17 -3
- package/zh/apis/app/runtime/model/_category_.json +1 -1
- package/zh/apis/app/runtime/model/create-app.md +1 -1
- package/zh/apis/app/runtime/model/use-store.md +1 -23
- package/zh/apis/app/runtime/router/_category_.json +1 -1
- package/zh/apis/app/runtime/ssr/_category_.json +1 -1
- package/zh/apis/app/runtime/testing/_category_.json +1 -1
- package/zh/apis/app/runtime/utility/_category_.json +1 -1
- package/zh/apis/app/runtime/web-server/_category_.json +1 -1
- package/zh/apis/app/runtime/web-server/hook.md +4 -4
- package/zh/apis/app/runtime/web-server/middleware.md +4 -4
- package/zh/components/reduck-migration.md +1 -0
- package/zh/configure/app/dev/asset-prefix.md +1 -1
- package/zh/configure/app/dev/hmr.md +1 -1
- package/zh/configure/app/dev/https.md +1 -1
- package/zh/configure/app/dev/port.md +1 -1
- package/zh/configure/app/dev/progress-bar.md +1 -1
- package/zh/configure/app/dev/start-url.md +1 -1
- package/zh/configure/app/experiments/_category_.json +4 -0
- package/zh/configure/app/experiments/lazy-compilation.md +1 -1
- package/zh/configure/app/html/_category_.json +4 -0
- package/zh/configure/app/html/app-icon.md +1 -1
- package/zh/configure/app/html/crossorigin.md +1 -1
- package/zh/configure/app/html/disable-html-folder.md +1 -1
- package/zh/configure/app/html/favicon-by-entries.md +1 -1
- package/zh/configure/app/html/favicon.md +1 -1
- package/zh/configure/app/html/inject-by-entries.md +1 -1
- package/zh/configure/app/html/inject.md +1 -1
- package/zh/configure/app/html/meta-by-entries.md +1 -1
- package/zh/configure/app/html/meta.md +1 -1
- package/zh/configure/app/html/mount-id.md +1 -1
- package/zh/configure/app/html/template-by-entries.md +1 -1
- package/zh/configure/app/html/template-parameters-by-entries.md +1 -1
- package/zh/configure/app/html/template-parameters.md +1 -1
- package/zh/configure/app/html/template.md +1 -1
- package/zh/configure/app/html/title-by-entries.md +1 -1
- package/zh/configure/app/html/title.md +1 -1
- package/zh/configure/app/output/asset-prefix.md +1 -1
- package/zh/configure/app/output/assets-retry.md +1 -1
- package/zh/configure/app/output/charset.md +1 -1
- package/zh/configure/app/output/clean-dist-path.md +1 -1
- package/zh/configure/app/output/convert-to-rem.md +1 -1
- package/zh/configure/app/output/copy.md +1 -1
- package/zh/configure/app/output/css-module-local-ident-name.md +1 -1
- package/zh/configure/app/output/data-uri-limit.md +1 -1
- package/zh/configure/app/output/disable-css-extract.md +12 -0
- package/zh/configure/app/output/disable-css-module-extension.md +1 -1
- package/zh/configure/app/output/disable-filename-hash.md +1 -1
- package/zh/configure/app/output/disable-inline-runtime-chunk.md +1 -1
- package/zh/configure/app/output/disable-minimize.md +1 -1
- package/zh/configure/app/output/disable-source-map.md +1 -1
- package/zh/configure/app/output/disable-ts-checker.md +1 -1
- package/zh/configure/app/output/dist-path.md +1 -1
- package/zh/configure/app/output/enable-asset-fallback.md +1 -1
- package/zh/configure/app/output/enable-asset-manifest.md +1 -1
- package/zh/configure/app/output/enable-css-module-tsdeclaration.md +1 -1
- package/zh/configure/app/output/enable-inline-scripts.md +1 -1
- package/zh/configure/app/output/enable-inline-styles.md +1 -1
- package/zh/configure/app/output/enable-latest-decorators.md +1 -1
- package/zh/configure/app/output/externals.md +1 -1
- package/zh/configure/app/output/filename.md +1 -1
- package/zh/configure/app/output/legal-comments.md +1 -1
- package/zh/configure/app/output/override-browserslist.md +1 -1
- package/zh/configure/app/output/polyfill.md +1 -1
- package/zh/configure/app/output/ssg.md +118 -114
- package/zh/configure/app/output/svg-default-export.md +1 -1
- package/zh/configure/app/performance/_category_.json +4 -0
- package/zh/configure/app/performance/build-cache.md +1 -1
- package/zh/configure/app/performance/bundle-analyze.md +1 -1
- package/zh/configure/app/performance/chunk-split.md +1 -1
- package/zh/configure/app/performance/print-file-size.md +1 -1
- package/zh/configure/app/performance/profile.md +1 -1
- package/zh/configure/app/performance/remove-console.md +1 -1
- package/zh/configure/app/performance/remove-moment-locale.md +1 -1
- package/zh/configure/app/plugins.md +1 -1
- package/zh/configure/app/runtime/state.md +13 -0
- package/zh/configure/app/security/_category_.json +4 -0
- package/zh/configure/app/security/sri.md +1 -1
- package/zh/configure/app/server/ssr.md +0 -2
- package/zh/configure/app/source/alias.md +1 -1
- package/zh/configure/app/source/compile-js-data-uri.md +1 -1
- package/zh/configure/app/source/define.md +1 -1
- package/zh/configure/app/source/exclude.md +1 -1
- package/zh/configure/app/source/global-vars.md +1 -1
- package/zh/configure/app/source/include.md +1 -1
- package/zh/configure/app/source/module-scopes.md +1 -1
- package/zh/configure/app/source/pre-entry.md +1 -1
- package/zh/configure/app/source/resolve-extension-prefix.md +1 -1
- package/zh/configure/app/source/resolve-main-fields.md +1 -1
- package/zh/configure/app/tools/autoprefixer.md +1 -1
- package/zh/configure/app/tools/babel.md +1 -1
- package/zh/configure/app/tools/css-extract.md +1 -1
- package/zh/configure/app/tools/css-loader.md +1 -1
- package/zh/configure/app/tools/dev-server.md +1 -1
- package/zh/configure/app/tools/html-plugin.md +1 -1
- package/zh/configure/app/tools/inspector.md +1 -1
- package/zh/configure/app/tools/less.md +1 -1
- package/zh/configure/app/tools/minify-css.md +1 -1
- package/zh/configure/app/tools/postcss.md +1 -1
- package/zh/configure/app/tools/pug.md +1 -1
- package/zh/configure/app/tools/sass.md +1 -1
- package/zh/configure/app/tools/style-loader.md +1 -1
- package/zh/configure/app/tools/styled-components.md +1 -1
- package/zh/configure/app/tools/swc.md +42 -0
- package/zh/configure/app/tools/terser.md +1 -1
- package/zh/configure/app/tools/ts-checker.md +1 -1
- package/zh/configure/app/tools/ts-loader.md +1 -1
- package/zh/configure/app/tools/webpack-chain.md +1 -1
- package/zh/configure/app/tools/webpack.md +1 -1
- package/zh/guides/advanced-features/bff/_category_.json +5 -1
- package/zh/guides/advanced-features/bff/bff-proxy.md +5 -3
- package/zh/guides/advanced-features/bff/frameworks.md +72 -51
- package/zh/guides/advanced-features/bff/function.md +16 -30
- package/zh/guides/advanced-features/bff/index.md +20 -0
- package/zh/guides/advanced-features/bff/type.md +43 -0
- package/zh/guides/advanced-features/custom-app.md +69 -1
- package/zh/guides/advanced-features/ssg.md +74 -63
- package/zh/guides/advanced-features/ssr.md +74 -11
- package/zh/guides/advanced-features/web-server.md +21 -110
- package/zh/guides/basic-features/builder.md +46 -0
- package/zh/guides/basic-features/css/_category_.json +1 -1
- package/zh/guides/basic-features/css/less-sass.md +1 -14
- package/zh/guides/basic-features/data-fetch.md +62 -1
- package/zh/guides/basic-features/env-vars.md +122 -41
- package/zh/guides/basic-features/routes.md +264 -0
- package/zh/guides/concept/entries.md +112 -0
- package/zh/guides/concept/lifecycle.md +10 -0
- package/zh/guides/get-started/quick-start.md +199 -1
- package/zh/guides/get-started/upgrade.md +75 -1
- package/zh/guides/topic-detail/framework-plugin/extend.md +3 -4
- package/zh/{apis/app/runtime/plugin/hook-api.md → guides/topic-detail/framework-plugin/hook-list.md} +42 -135
- package/zh/{apis/app/runtime/plugin → guides/topic-detail/framework-plugin}/hook.md +2 -3
- package/zh/guides/topic-detail/framework-plugin/implement.md +21 -10
- package/zh/guides/topic-detail/framework-plugin/introduction.md +49 -0
- package/{en/docusaurus-plugin-content-docs/current/apis/app/runtime/plugin → zh/guides/topic-detail/framework-plugin}/plugin-api.md +3 -4
- package/zh/guides/topic-detail/framework-plugin/relationship.md +2 -3
- package/zh/guides/topic-detail/generator/codesmith/api/_category_.json +4 -0
- package/zh/guides/topic-detail/generator/codesmith/api/app.md +152 -0
- package/zh/guides/topic-detail/generator/codesmith/api/ejs.md +56 -0
- package/zh/guides/topic-detail/generator/codesmith/api/fs.md +54 -0
- package/zh/guides/topic-detail/generator/codesmith/api/git.md +48 -0
- package/zh/guides/topic-detail/generator/codesmith/api/handlebars.md +56 -0
- package/zh/guides/topic-detail/generator/codesmith/api/json.md +58 -0
- package/zh/guides/topic-detail/generator/codesmith/api/npm.md +45 -0
- package/zh/guides/topic-detail/generator/codesmith/develop.md +52 -0
- package/zh/guides/topic-detail/generator/codesmith/introduce.md +42 -1
- package/zh/guides/topic-detail/generator/codesmith/run-in-js.md +48 -0
- package/zh/guides/topic-detail/generator/codesmith/structure.md +86 -0
- package/zh/guides/topic-detail/generator/config/mwa.md +4 -8
- package/zh/guides/topic-detail/generator/plugin/api/file/addFile.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/file/addHelper.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/file/addPartial.md +2 -2
- package/zh/guides/topic-detail/generator/plugin/api/file/introduce.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/file/rmDir.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/file/rmFile.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.md +3 -2
- package/zh/guides/topic-detail/generator/plugin/api/file/updateModernConfig.md +2 -2
- package/zh/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/hook/afterForged.md +3 -3
- package/zh/guides/topic-detail/generator/plugin/api/hook/onForged.md +3 -3
- package/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/input/type.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/new/createElement.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/new/createSubProject.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/api/npm/install.md +1 -1
- package/zh/guides/topic-detail/generator/plugin/develop.md +11 -7
- package/zh/guides/topic-detail/model/quick-start.md +4 -0
- package/zh/guides/topic-detail/monorepo/sub-project-interface.md +0 -2
- package/zh/tutorials/first-app/c01-getting-started/1.1-prerequisites.md +2 -2
- package/zh/tutorials/first-app/c01-getting-started/1.2-minimal-mwa.md +2 -2
- package/zh/tutorials/first-app/c01-getting-started/1.4-enable-ssr.md +5 -2
- package/zh/tutorials/first-app/c02-generator-and-studio/2.1-generator.md +0 -8
- package/zh/tutorials/first-app/c02-generator-and-studio/2.2-boilerplates.md +12 -6
- package/zh/tutorials/first-app/c02-generator-and-studio/2.3-configuration.md +2 -4
- package/zh/tutorials/first-app/c03-ide/3.1-setting-up.md +1 -1
- package/zh/tutorials/first-app/c03-ide/3.2-hints-in-ide.md +44 -50
- package/zh/tutorials/first-app/c03-ide/3.3-autofix-in-ide.md +1 -1
- package/zh/tutorials/first-app/c03-ide/3.4-autofix-in-cli.md +4 -4
- package/zh/tutorials/first-app/c04-es6-plus-and-ts/4.1-use-es6-plus.md +8 -21
- package/zh/tutorials/first-app/c04-es6-plus-and-ts/4.2-use-typescript.md +37 -13
- package/zh/tutorials/first-app/c05-component/5.1-use-ui-library.md +3 -13
- package/zh/tutorials/first-app/c05-component/5.2-use-standalone-component.md +1 -21
- package/zh/tutorials/first-app/c06-css-and-component/6.1-css-in-js.md +9 -9
- package/zh/tutorials/first-app/c06-css-and-component/6.2-utility-class.md +9 -14
- package/zh/tutorials/first-app/c06-css-and-component/6.3-postcss.md +7 -7
- package/zh/tutorials/first-app/c06-css-and-component/6.4-design-system.md +1 -1
- package/zh/tutorials/first-app/c06-css-and-component/6.5-storybook.md +2 -2
- package/zh/tutorials/first-app/c06-css-and-component/6.6-testing.md +8 -17
- package/zh/tutorials/first-app/c07-app-entry/7.1-intro.md +24 -19
- package/zh/tutorials/first-app/c07-app-entry/7.2-add-entry-in-cli.md +31 -35
- package/zh/tutorials/first-app/c07-app-entry/7.3-manage-entries-by-hand.md +4 -9
- package/zh/tutorials/first-app/c08-client-side-routing/8.1-code-based-routing.md +66 -63
- package/zh/tutorials/first-app/c09-bff/9.2-enable-bff.md +35 -33
- package/zh/tutorials/first-app/c09-bff/9.3-fetch-bff.md +28 -102
- package/zh/tutorials/first-app/c10-model/10.1-application-architecture.md +4 -6
- package/zh/tutorials/first-app/c10-model/10.2-add-model.md +3 -3
- package/zh/tutorials/first-app/c10-model/10.3-use-model.md +21 -20
- package/zh/tutorials/first-app/c10-model/10.4-testing.md +2 -2
- package/zh/tutorials/first-app/c11-container/11.1-use-model-with-app-state.md +34 -68
- package/zh/tutorials/first-app/c11-container/11.2-add-container.md +40 -37
- package/zh/tutorials/first-app/c11-container/11.3-use-loader.md +6 -4
- package/zh/tutorials/first-app/c11-container/11.4-testing.md +2 -2
- package/zh/tutorials/foundations/introduction.md +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/default-alias.md +0 -25
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/env.md +0 -72
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/plugin/_category_.json +0 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/plugin/abstract.md +0 -26
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/plugin/hook-api.md +0 -896
- package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/plugin/hook.md +0 -170
- package/zh/apis/app/runtime/default-alias.md +0 -23
- package/zh/apis/app/runtime/env.md +0 -70
- package/zh/apis/app/runtime/plugin/_category_.json +0 -4
- package/zh/apis/app/runtime/plugin/abstract.md +0 -26
- package/zh/apis/app/runtime/plugin/plugin-api.md +0 -117
- package/zh/components/deploy.md +0 -60
- package/zh/components/dev-ide.md +0 -1
- package/zh/components/entry-name.md +0 -15
- package/zh/components/env-prepare.md +0 -1
- package/zh/components/launch-bff-choices.md +0 -6
- package/zh/guides/advanced-features/bff/bff-server.md +0 -142
- package/zh/guides/advanced-features/typescript.md +0 -4
- package/zh/guides/basic-features/image.md +0 -43
- package/zh/guides/concept/integrated.md +0 -4
- package/zh/guides/concept/solutions.md +0 -4
- package/zh/guides/topic-detail/compile-speed.md +0 -182
- package/zh/guides/topic-detail/framework-plugin/abstract.md +0 -27
- package/zh/guides/troubleshooting/compile.md +0 -379
- package/zh/tutorials/first-app/c08-client-side-routing/8.2-file-based-routing.md +0 -318
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# Customize input related type definition
|
6
|
+
|
7
|
+
## Input
|
8
|
+
|
9
|
+
Modern.js Input input type uses the open source [Formily](https://formilyjs.org/) Schema, with support for some of its Schema fields.
|
10
|
+
|
11
|
+
### type
|
12
|
+
|
13
|
+
schema types. Currently, the input supported by the generator plugin is of type `string`, `number` and `object`. Where `object` is used for implementation schema nested, it needs to be used in conjunction with `properties`.
|
14
|
+
|
15
|
+
### name
|
16
|
+
|
17
|
+
schema keyword.
|
18
|
+
|
19
|
+
### title
|
20
|
+
|
21
|
+
schema display name.
|
22
|
+
|
23
|
+
### default
|
24
|
+
|
25
|
+
schema default value.
|
26
|
+
|
27
|
+
### enum
|
28
|
+
|
29
|
+
If the schema is selection type, this field is used to define the option content.
|
30
|
+
|
31
|
+
Each option supports two fields:
|
32
|
+
|
33
|
+
- value: option value.
|
34
|
+
|
35
|
+
- label: display name.
|
36
|
+
|
37
|
+
### x-validate
|
38
|
+
|
39
|
+
schema verification rules. Formily's verification method is supported here, for details, please refer to [Formily Validate](https://formilyjs.org/zh-CN/guide/advanced/validate).
|
40
|
+
|
41
|
+
### x-reactions
|
42
|
+
|
43
|
+
schema field linkage. Formily's linkage method is supported here, for details, please refer to [Formily Linkages](https://formilyjs.org/zh-CN/guide/advanced/linkages).
|
44
|
+
|
45
|
+
### properties
|
46
|
+
|
47
|
+
When schema type is `object`, define its subforms.
|
48
|
+
|
49
|
+
## Example
|
50
|
+
|
51
|
+
```typescript
|
52
|
+
const schema = {
|
53
|
+
type: 'object',
|
54
|
+
properties: {
|
55
|
+
language: {
|
56
|
+
type: 'string',
|
57
|
+
title: 'Develop Langauge',
|
58
|
+
enum: [
|
59
|
+
{ label: 'TS', value: 'ts' },
|
60
|
+
{ label: 'ES6+', value: 'js' },
|
61
|
+
],
|
62
|
+
},
|
63
|
+
},
|
64
|
+
};
|
65
|
+
```
|
@@ -0,0 +1,91 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# Introduction
|
6
|
+
|
7
|
+
Modern.js supports the customization of the provided engineering solutions by means of generator plugins or the customization of specific scenarios for engineering solutions.
|
8
|
+
|
9
|
+
## Generator plugin composition
|
10
|
+
|
11
|
+
The generator plugin is a module that can be developed directly using Modern.js module engineering solutions. Of course, Modern.js also provides the corresponding generator plugin (`@modern-js/generator-plugin-plugin`) to directly create a new generator plugin project.
|
12
|
+
|
13
|
+
|
14
|
+
A generator plugin project directory is as follows:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
.
|
18
|
+
├── README.md
|
19
|
+
├── package.json
|
20
|
+
├── src
|
21
|
+
│ ├── index.ts
|
22
|
+
│ └── modern-app-env.d.ts
|
23
|
+
├── templates
|
24
|
+
└── tsconfig.json
|
25
|
+
```
|
26
|
+
|
27
|
+
The `src/index.ts` is the source code directory, which is used to develop the generator plugin logic. The plugin exports a function by default, and the function parameter is `context`. Some methods are provided on the `context` to directly operate the current project. These methods will be introduced in detail later in this chapter.
|
28
|
+
|
29
|
+
The `templates` directory is the template directory used to store template files that need to be used in the generator plugin.
|
30
|
+
|
31
|
+
## Classification
|
32
|
+
|
33
|
+
There are two types of generator plugins:
|
34
|
+
|
35
|
+
1. Extended engineering: directly customize the three major engineering provided by default.
|
36
|
+
|
37
|
+
2. Create engineering scenes: Create corresponding engineering scenes based on the default three major engineering schemes.
|
38
|
+
|
39
|
+
### Type definition
|
40
|
+
|
41
|
+
The classification of the generator plugin is provided by the meta information in the `package.json`.
|
42
|
+
|
43
|
+
#### Extended engineering
|
44
|
+
|
45
|
+
```json
|
46
|
+
{
|
47
|
+
"meta": {
|
48
|
+
"extend": "mwa" // The three engineering is mwa, module, monorepo
|
49
|
+
}
|
50
|
+
}
|
51
|
+
```
|
52
|
+
|
53
|
+
#### Create engineering scenes
|
54
|
+
|
55
|
+
```json
|
56
|
+
{
|
57
|
+
"meta": {
|
58
|
+
"key": "new_solution",
|
59
|
+
"name": "New Solution",
|
60
|
+
"type": "mwa" // In addition to the three major engineering solutions, the type here also supports the customize (custom) type
|
61
|
+
}
|
62
|
+
}
|
63
|
+
```
|
64
|
+
|
65
|
+
`key` is the scene scheme name and the value is a character string.
|
66
|
+
`name` is the display name of the scene scheme, used for the display of the option when used, and the value is a character string.
|
67
|
+
`type` is the project solution type. In addition to supporting three project solutions like `extend`, it also supports the customize (custom) type.
|
68
|
+
|
69
|
+
### Custom type
|
70
|
+
|
71
|
+
The customize type provides the implementation capability of the full custom project solution. When using this type to create a new project solution scenario, only a small amount of code for best practices at the development level is provided, such as `.gitignore`, `.editorConfig` and other files, specifically for the following directory structure:
|
72
|
+
|
73
|
+
```
|
74
|
+
.
|
75
|
+
├── .editorconfig
|
76
|
+
├── .gitignore
|
77
|
+
├── .idea
|
78
|
+
│ ├── codeStyles
|
79
|
+
│ │ ├── Project.xml
|
80
|
+
│ │ └── codeStyleConfig.xml
|
81
|
+
│ ├── inspectionProfiles
|
82
|
+
│ │ └── Project_Default.xml
|
83
|
+
│ └── jsLinters
|
84
|
+
│ └── eslint.xml
|
85
|
+
├── .nvmrc
|
86
|
+
└── .vscode
|
87
|
+
├── extensions.json
|
88
|
+
└── settings.json
|
89
|
+
```
|
90
|
+
|
91
|
+
Customized types ensure flexible configuration according to their needs for engineering solutions.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# createElement
|
6
|
+
|
7
|
+
Create engineering elements that only support application engineering solutions.
|
8
|
+
|
9
|
+
This method is available on the `onForged` API parameter.
|
10
|
+
|
11
|
+
Its type is defined as:
|
12
|
+
|
13
|
+
```ts
|
14
|
+
export enum ActionElement {
|
15
|
+
Entry = 'entry',
|
16
|
+
Server = 'server',
|
17
|
+
}
|
18
|
+
export type ForgedAPI = {
|
19
|
+
createElement: (
|
20
|
+
element: ActionElement,
|
21
|
+
params: Record<string, unknown>,
|
22
|
+
) => Promise<void>;
|
23
|
+
...
|
24
|
+
};
|
25
|
+
```
|
26
|
+
|
27
|
+
## element
|
28
|
+
|
29
|
+
Project element type, supports entry and server.
|
30
|
+
|
31
|
+
## params
|
32
|
+
|
33
|
+
For other parameters of creating elements, please refer to[MWA New Command](/docs/guides/topic-detail/generator/config/mwa).
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 4
|
3
|
+
---
|
4
|
+
|
5
|
+
# createSubProject
|
6
|
+
|
7
|
+
Create subprojects and only support Monorepo engineering solutions.
|
8
|
+
|
9
|
+
This method is available on the `onForged` API parameter.
|
10
|
+
|
11
|
+
Its type is defined as:
|
12
|
+
|
13
|
+
```ts
|
14
|
+
export enum SubSolution {
|
15
|
+
MWA = 'mwa',
|
16
|
+
MWATest = 'mwa_test',
|
17
|
+
Module = 'module',
|
18
|
+
InnerModule = 'inner_module',
|
19
|
+
}
|
20
|
+
export type ForgedAPI = {
|
21
|
+
createSubProject: (
|
22
|
+
solution: SubSolution,
|
23
|
+
params: Record<string, unknown>,
|
24
|
+
) => Promise<void>;
|
25
|
+
...
|
26
|
+
};
|
27
|
+
```
|
28
|
+
|
29
|
+
## solution
|
30
|
+
|
31
|
+
Sub-project engineering solution name.
|
32
|
+
|
33
|
+
## params
|
34
|
+
|
35
|
+
For other parameters of creating subprojects, please refer to[Monorepo Create Sub Project](/docs/guides/topic-detail/generator/config/monorepo).
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 3
|
3
|
+
---
|
4
|
+
|
5
|
+
# enableFunc
|
6
|
+
|
7
|
+
Enable functionality to support application and module engineering scenarios.
|
8
|
+
|
9
|
+
This method is available on the `onForged` API parameter.
|
10
|
+
|
11
|
+
Its type is defined as:
|
12
|
+
|
13
|
+
```ts
|
14
|
+
export enum ActionFunction {
|
15
|
+
UnBundle = 'unbundle',
|
16
|
+
TailwindCSS = 'tailwindcss',
|
17
|
+
BFF = 'bff',
|
18
|
+
MicroFrontend = 'micro_frontend',
|
19
|
+
I18n = 'i18n',
|
20
|
+
Test = 'test',
|
21
|
+
E2ETest = 'e2e_test',
|
22
|
+
Doc = 'doc',
|
23
|
+
Storybook = 'storybook',
|
24
|
+
RuntimeApi = 'runtimeApi',
|
25
|
+
SSG = 'ssg',
|
26
|
+
Polyfill = 'polyfill',
|
27
|
+
Deploy = 'deploy',
|
28
|
+
}
|
29
|
+
export type ForgedAPI = {
|
30
|
+
enableFunc: (
|
31
|
+
func: ActionFunction,
|
32
|
+
params?: Record<string, unknown> | undefined,
|
33
|
+
) => Promise<void>;
|
34
|
+
...
|
35
|
+
};
|
36
|
+
```
|
37
|
+
|
38
|
+
## func
|
39
|
+
|
40
|
+
The function name is passed according to the functions supported by the different engineering solutions.
|
41
|
+
|
42
|
+
## params
|
43
|
+
|
44
|
+
For other parameters when the function is enabled, please refer to[MWA New Command](/docs/guides/topic-detail/generator/config/mwa)和[Module New Command](/docs/guides/topic-detail/generator/config/module).
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# Introduction
|
6
|
+
|
7
|
+
The three engineering solutions provided by the Modern.js support executing the new command in the project to create elements and enable functions. In the generator plugin, the relevant API can be directly called to create some elements and enable supported functions by default.
|
8
|
+
|
9
|
+
Different engineering solutions to support new operations:
|
10
|
+
|
11
|
+
- [MWA](/docs/guides/topic-detail/generator/config/mwa)
|
12
|
+
|
13
|
+
- [Module](/docs/guides/topic-detail/generator/config/module)
|
14
|
+
|
15
|
+
- [Monorepo](/docs/guides/topic-detail/generator/config/monorepo)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# install
|
6
|
+
|
7
|
+
Install dependency in the project root directory.
|
8
|
+
|
9
|
+
In the install function, the dependency will be installed using the corresponding package management tool based on the value of `packageManager`.
|
10
|
+
|
11
|
+
Its type is defined as:
|
12
|
+
|
13
|
+
```ts
|
14
|
+
export type AfterForgedAPI = {
|
15
|
+
install: () => Promise<void>;
|
16
|
+
...
|
17
|
+
};
|
18
|
+
```
|
package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/develop.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 3
|
3
|
+
---
|
4
|
+
|
5
|
+
# How to develop generator plugins
|
6
|
+
|
7
|
+
## Create project
|
8
|
+
|
9
|
+
Modern.js provides a generator plugin to create a generator plugin project, you can directly execute the following command to create:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
npx @modern-js/create plugin --plugin @modern-js/generator-plugin-plugin
|
13
|
+
```
|
14
|
+
|
15
|
+
Different plugin types will ask different questions. You can choose the plugin type according to your needs.
|
16
|
+
|
17
|
+
### Extension type
|
18
|
+
|
19
|
+
```
|
20
|
+
? Please select the solution you want to create Module Solution
|
21
|
+
? Please select the scene you want to create 生成器插件
|
22
|
+
? Plugin Package Name plugin
|
23
|
+
? Development Language TS
|
24
|
+
? Package Management Tool pnpm
|
25
|
+
? Plugin Type extend
|
26
|
+
? Plugin Base Type MWA Solution
|
27
|
+
```
|
28
|
+
|
29
|
+
### Customized type
|
30
|
+
|
31
|
+
```
|
32
|
+
? Plugin Package Name plugin
|
33
|
+
? Development Language TS
|
34
|
+
? Package Management Tool pnpm
|
35
|
+
? Plugin Type custom
|
36
|
+
? Plugin Key mobile-app
|
37
|
+
? Plugin Show Name Mobile App
|
38
|
+
? Plugin Base Type MWA Solution
|
39
|
+
```
|
40
|
+
|
41
|
+
After the execution of the create project command is completed, a project for developing the generator plugin will be generated accordingly, and the `meta` information will also be generated according to your selection in the `package.json`.
|
42
|
+
|
43
|
+
:::info
|
44
|
+
For generator plugin development, please refer to `@modern-js/generator-plugin-plugin`. [Source Code](https://github.com/modern-js-dev/modern.js/tree/main/packages/generator/plugins/generator-plugin)
|
45
|
+
:::
|
46
|
+
|
47
|
+
## Develop plugin logic
|
48
|
+
|
49
|
+
Complete plugin logic development in `src/index.ts`.
|
50
|
+
|
51
|
+
The plugin exports a function by default, the function parameter is `context`, and some methods are provided on `context` to directly operate on the current project.
|
52
|
+
|
53
|
+
|
54
|
+
A brief introduction to the provided methods, the complete API list viewable [Generator Plugin API](/docs/guides/topic-detail/generator/plugin/api/introduce).
|
55
|
+
|
56
|
+
### Customize input
|
57
|
+
|
58
|
+
- addInputBefore
|
59
|
+
|
60
|
+
Add input before the default input, such as adding questions before the `Select package management tool` question.
|
61
|
+
|
62
|
+
Specific Modern.js configuration viewable for each problem [Project Solution Configuration](/docs/guides/topic-detail/generator/config/common).
|
63
|
+
|
64
|
+
```ts
|
65
|
+
context.addInputBefore('input2', {
|
66
|
+
type: 'object',
|
67
|
+
properties: {
|
68
|
+
'input1.2': {
|
69
|
+
type: 'string',
|
70
|
+
title: 'input1.2',
|
71
|
+
},
|
72
|
+
},
|
73
|
+
});
|
74
|
+
```
|
75
|
+
|
76
|
+
- setInput
|
77
|
+
|
78
|
+
Set attributes of existing problems.
|
79
|
+
|
80
|
+
```ts
|
81
|
+
context.setInput('test', 'type', 'number')
|
82
|
+
context.setInput('test', 'enum', [{ value: 'option1', label: '选项一' }])
|
83
|
+
```
|
84
|
+
|
85
|
+
### onForged
|
86
|
+
|
87
|
+
After the implementation of the hook related operations of the project plan type file is completed, multiple extended inspection will execute its `onForged` function in sequence according to the `plugin` parameter order.
|
88
|
+
|
89
|
+
The `onForged` parameter is a callback function, and the function parameters are `api` and `input`.
|
90
|
+
|
91
|
+
Some file manipulation related methods are provided on the `api`, which can operate on the current template file in this hook.
|
92
|
+
|
93
|
+
`input` is the current user input, which can be used to obtain the current input information and configuration information of the user.
|
94
|
+
|
95
|
+
When you need a new template file, you can add it directly in the `templates` directory. In the `onForged` function, you can directly operate the `templates` directory file. For example, the `templateFile` parameter in the `addFile` below is the file in the `templates` directory. There is no need to display the declaration `templates` here, just write the relative path relative to `templates`.
|
96
|
+
|
97
|
+
API functions supported in `onForged` can also be found in [Generator Plugin API](/docs/guides/topic-detail/generator/plugin/api/hook/onForged).
|
98
|
+
|
99
|
+
```ts
|
100
|
+
context.onForged(async (api: ForgedAPI, input: Record<string, unknown>) => {
|
101
|
+
const { language } = input;
|
102
|
+
api.addFile({
|
103
|
+
type: FileType.Text,
|
104
|
+
file: `src/index.${language as string}`,
|
105
|
+
templateFile: `index.${language as string}.handlebars`,
|
106
|
+
force: true,
|
107
|
+
});
|
108
|
+
})
|
109
|
+
```
|
110
|
+
|
111
|
+
### afterForged
|
112
|
+
|
113
|
+
After the `onForged` function is executed, it can mainly install dependencies, Git operations, etc.
|
114
|
+
|
115
|
+
If your project plan is based on the three projects provided by the Modern.js, this hook function may not be required. The default project plan will automatically include the installation dependency and commit code logic.
|
116
|
+
|
117
|
+
The generator plugin also supports a customized `custom` type, which only provides a small amount of development-level best practice code, such as `.gitignore`, `editorConfig` and other files. In this case, you need to manually supplement the installation dependency and Git operation logic in the `afterForged` function.
|
118
|
+
|
119
|
+
The `afterForged` parameter is also a callback function, and the function parameters are `api` and `input`.
|
120
|
+
|
121
|
+
The `api` will provide some npm, Git and other methods, which can install dependency and Git operations in this hook.
|
122
|
+
|
123
|
+
`input` is the current user input, which can be used to obtain the current input information and configuration information of the user.
|
124
|
+
|
125
|
+
The API functions supported in `afterForged` can also be found in [Generator Plugin API] (/docs/guides/topic-detail/generator/plugin/api/hook/afterForged).
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# How to use the generator plugin
|
6
|
+
|
7
|
+
`@modern-js/create` provides the `--plugin` parameter to declare the generator plugin used.
|
8
|
+
|
9
|
+
You can use the generator plugin directly by executing the following command:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
npx @modern-js/create --plugin <pluginName>
|
13
|
+
```
|
14
|
+
|
15
|
+
The plugin parameter supports multiple declarations, which means that multiple generator plugins are used at the same time.
|
16
|
+
|
17
|
+
## Classification
|
18
|
+
|
19
|
+
There are two types of generator plugins:
|
20
|
+
|
21
|
+
1. Extended engineering: directly customize the three major engineering provided by default.
|
22
|
+
|
23
|
+
2. Create engineering scenes: Create corresponding engineering scenes based on the default three major engineering schemes.
|
24
|
+
|
25
|
+
### Type definition
|
26
|
+
|
27
|
+
The classification of the generator plugin is provided by the meta information in the `package.json`.
|
28
|
+
|
29
|
+
#### Extended engineering
|
30
|
+
|
31
|
+
```json
|
32
|
+
{
|
33
|
+
"meta": {
|
34
|
+
"extend": "mwa" // The three engineering is mwa, module, monorepo
|
35
|
+
}
|
36
|
+
}
|
37
|
+
```
|
38
|
+
|
39
|
+
#### Create engineering scenes
|
40
|
+
|
41
|
+
```json
|
42
|
+
{
|
43
|
+
"meta": {
|
44
|
+
"key": "new_solution",
|
45
|
+
"name": "New Solution",
|
46
|
+
"type": "mwa" // In addition to the three major engineering solutions, the type here also supports the customize (custom) type
|
47
|
+
}
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
### Execution timing
|
52
|
+
|
53
|
+
The execution timing of different types of custom engineering solutions is different.
|
54
|
+
|
55
|
+
#### Extended engineering
|
56
|
+
|
57
|
+
The generator plugin of the extended engineering type will execute in sequence according to the declaration order of the plugin parameter after selecting the corresponding extended project scheme.
|
58
|
+
|
59
|
+
#### Create engineering scenes
|
60
|
+
|
61
|
+
The generator plugin that create engineering scenes will have the option to select the scene after selecting the project solution type. The option list includes the current default project scenes and the project scenes defined by the plugin. If you select the corresponding scene, the corresponding generator will be executed plugin.
|
@@ -0,0 +1,118 @@
|
|
1
|
+
---
|
2
|
+
sidebar_position: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# Project Generator
|
6
|
+
|
7
|
+
Modern.js provides `@modern-js/create` as a project generator for Modern.js project creation.
|
8
|
+
|
9
|
+
## Use
|
10
|
+
|
11
|
+
There is no need to install `@modern-js/create` globally, just execute the tool directly with npx:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
npx @modern-js/create [projectDir]
|
15
|
+
```
|
16
|
+
|
17
|
+
:::info
|
18
|
+
Use npx to get the latest version of `@modern-js/create` every time.
|
19
|
+
:::
|
20
|
+
|
21
|
+
## Params
|
22
|
+
|
23
|
+
### [projectDir]
|
24
|
+
|
25
|
+
Project directory name.
|
26
|
+
|
27
|
+
When executing the above command, the 'projectDir` folder will be created in the current directory by default, and the initialization project will be in this folder. When this parameter is empty, the initialization project will be directly generated in the current directory.
|
28
|
+
|
29
|
+
### --version
|
30
|
+
|
31
|
+
Get the `@modern-js/create` tool version.
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$ npx @modern-js/create --version
|
35
|
+
|
36
|
+
[INFO] @modern-js/create v2.0.0
|
37
|
+
```
|
38
|
+
|
39
|
+
### --lang
|
40
|
+
|
41
|
+
Specifies the execution language, supports `zh` and `en`.
|
42
|
+
|
43
|
+
By default, `@modern-js/create` will automatically identify the user's system language, choose to use Chinese or English, if the recognition fails or you want to specify the language manually, you can use this parameter.
|
44
|
+
|
45
|
+
### -c, --config
|
46
|
+
|
47
|
+
Specifies the project default configuration.
|
48
|
+
|
49
|
+
By default, `@modern-js/create` will have interaction problems such as language selection and package management tools during execution. When you need to specify these configuration contents in advance, you can pass in this field.
|
50
|
+
|
51
|
+
This field is a JSON character string, for example when running a package management tool:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
npx @modern-js/create --config '{"packageManager": "pnpm"}'
|
55
|
+
```
|
56
|
+
|
57
|
+
Specific configuration information viewable [Project Configuration](/docs/guides/topic-detail/generator/config/common).
|
58
|
+
|
59
|
+
### --no-need-install
|
60
|
+
|
61
|
+
By default, `@modern-js/create` automatically installs dependency after the project is created, use this parameter to ignore the install dependency step.
|
62
|
+
|
63
|
+
### --dist-tag <distTag\>
|
64
|
+
|
65
|
+
Specifies the generator and Modern.js dependency versions.
|
66
|
+
|
67
|
+
A smaller micro-generator will be executed during the execution of `@modern-js/create`, and the version number of the micro-generator that can be executed with this parameter and the version number of the corresponding installation Modern.js related dependencies.
|
68
|
+
|
69
|
+
### --registry <registry/>
|
70
|
+
|
71
|
+
Execute the npm registry to get the generator and npm packages.
|
72
|
+
|
73
|
+
### --debug
|
74
|
+
|
75
|
+
Displays debug log information during generator execution.
|
76
|
+
|
77
|
+
### --mwa
|
78
|
+
|
79
|
+
One-click to create an application engineering solution project.
|
80
|
+
|
81
|
+
With this parameter, `@modern-js/create` will create the application project with the configuration default value.
|
82
|
+
|
83
|
+
### --module
|
84
|
+
|
85
|
+
One-click to create a module engineering solution project.
|
86
|
+
|
87
|
+
With this parameter, `@modern-js/create` will create the module project with the configuration default value.
|
88
|
+
|
89
|
+
### --monorepo
|
90
|
+
|
91
|
+
One-click to create a Monorepo engineering solution project.
|
92
|
+
|
93
|
+
With this parameter, `@modern-js/create` will create the Monorepo project with the configuration default value.
|
94
|
+
|
95
|
+
### --plugin <plugin\>
|
96
|
+
|
97
|
+
Specifies the generator plugin.
|
98
|
+
|
99
|
+
Modern.js support the use of the generator plug-in custom Modern.js the default project type or add the project type scenes, the parameter user specifies the customized generator plugin.
|
100
|
+
|
101
|
+
For custom generator plugins, please refer to [Development Generator Plugin](/docs/guides/topic-detail/generator/plugin/abstract).
|
102
|
+
|
103
|
+
### --generator <generator\>
|
104
|
+
|
105
|
+
Specifies the microgenerator.
|
106
|
+
|
107
|
+
By default, `@modern-js/create` will execute the microgenerator Modern.js framework build-in. If you need to execute a customized microgenerator, and you need to use the posture of'npx @modern-js/create ', you can use this parameter directly.
|
108
|
+
|
109
|
+
For custom microgenerators, please refer to [Develop Microgenerator](/docs/guides/topic-detail/generator/codesmith/introduce).
|
110
|
+
|
111
|
+
### --packages <packages\>
|
112
|
+
|
113
|
+
A project is created by specifying a specific package version dependency.
|
114
|
+
|
115
|
+
If you need to specify a specific package version when creating a project, you can use this parameter. This parameter will lock the package version number in the `package.json` of the project root directory by configuration `pnpm.overrides` (package management tool selects pnpm) or `resolutions`.
|
116
|
+
|
117
|
+
|
118
|
+
The parameter value is a JSON character string.
|