@maple-design/cli-vue 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +305 -2
- package/README.zh-CN.md +305 -0
- package/bin/cli.mjs +5 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/lib/client/appType.d.ts +4 -0
- package/lib/client/appType.js +7 -0
- package/lib/client/index.d.ts +29 -0
- package/lib/client/index.js +170 -0
- package/lib/client/language.d.ts +11 -0
- package/lib/client/language.js +52 -0
- package/lib/client/theme-state.d.ts +3 -0
- package/lib/client/theme-state.js +6 -0
- package/lib/node/bin.d.ts +2 -0
- package/lib/node/bin.js +154 -0
- package/lib/node/commands/build.d.ts +1 -0
- package/lib/node/commands/build.js +15 -0
- package/lib/node/commands/checklist.d.ts +6 -0
- package/lib/node/commands/checklist.js +59 -0
- package/lib/node/commands/compile.d.ts +3 -0
- package/lib/node/commands/compile.js +41 -0
- package/lib/node/commands/create.d.ts +8 -0
- package/lib/node/commands/create.js +91 -0
- package/lib/node/commands/dev.d.ts +6 -0
- package/lib/node/commands/dev.js +58 -0
- package/lib/node/commands/extension.d.ts +3 -0
- package/lib/node/commands/extension.js +5 -0
- package/lib/node/commands/gen.d.ts +24 -0
- package/lib/node/commands/gen.js +91 -0
- package/lib/node/commands/icons.d.ts +4 -0
- package/lib/node/commands/icons.js +15 -0
- package/lib/node/commands/preview.d.ts +4 -0
- package/lib/node/commands/preview.js +18 -0
- package/lib/node/commands/styleVars.d.ts +1 -0
- package/lib/node/commands/styleVars.js +6 -0
- package/lib/node/commands/test.d.ts +7 -0
- package/lib/node/commands/test.js +16 -0
- package/lib/node/commands/vite.d.ts +2 -0
- package/lib/node/commands/vite.js +14 -0
- package/lib/node/compiler/compileModule.d.ts +4 -0
- package/lib/node/compiler/compileModule.js +78 -0
- package/lib/node/compiler/compileSFC.d.ts +6 -0
- package/lib/node/compiler/compileSFC.js +119 -0
- package/lib/node/compiler/compileScript.d.ts +27 -0
- package/lib/node/compiler/compileScript.js +221 -0
- package/lib/node/compiler/compileSiteEntry.d.ts +19 -0
- package/lib/node/compiler/compileSiteEntry.js +164 -0
- package/lib/node/compiler/compileStyle.d.ts +14 -0
- package/lib/node/compiler/compileStyle.js +55 -0
- package/lib/node/compiler/compileStyleVars.d.ts +3 -0
- package/lib/node/compiler/compileStyleVars.js +46 -0
- package/lib/node/compiler/compileTemplateHighlight.d.ts +18 -0
- package/lib/node/compiler/compileTemplateHighlight.js +133 -0
- package/lib/node/compiler/compileTypes.d.ts +2 -0
- package/lib/node/compiler/compileTypes.js +58 -0
- package/lib/node/compiler/generateLibraryEntry.d.ts +3 -0
- package/lib/node/compiler/generateLibraryEntry.js +152 -0
- package/lib/node/compiler/siteRoutes.d.ts +4 -0
- package/lib/node/compiler/siteRoutes.js +9 -0
- package/lib/node/config/maple.config.d.ts +215 -0
- package/lib/node/config/maple.config.js +32 -0
- package/lib/node/config/maple.default.config.d.ts +2 -0
- package/lib/node/config/maple.default.config.js +386 -0
- package/lib/node/config/site-resolver.d.ts +25 -0
- package/lib/node/config/site-resolver.js +138 -0
- package/lib/node/config/vite.config.d.ts +28 -0
- package/lib/node/config/vite.config.js +209 -0
- package/lib/node/config/vitest.config.d.ts +2 -0
- package/lib/node/config/vitest.config.js +54 -0
- package/lib/node/config/vitest.setup.d.ts +1 -0
- package/lib/node/config/vitest.setup.js +8 -0
- package/lib/node/index.d.ts +13 -0
- package/lib/node/index.js +13 -0
- package/lib/node/release/index.d.ts +20 -0
- package/lib/node/release/index.js +147 -0
- package/lib/node/shared/constant.d.ts +47 -0
- package/lib/node/shared/constant.js +53 -0
- package/lib/node/shared/fsUtils.d.ts +18 -0
- package/lib/node/shared/fsUtils.js +57 -0
- package/lib/node/shared/logger.d.ts +8 -0
- package/lib/node/shared/logger.js +18 -0
- package/lib/node/shared/serial-task.d.ts +2 -0
- package/lib/node/shared/serial-task.js +9 -0
- package/package.json +111 -3
- package/site/documentation-sections.spec.ts +45 -0
- package/site/documentation-sections.ts +48 -0
- package/site/index.html +89 -0
- package/site/mobile/App.vue +437 -0
- package/site/mobile/AppHome.vue +154 -0
- package/site/mobile/main.ts +99 -0
- package/site/mobile/route-sync.spec.ts +34 -0
- package/site/mobile/route-sync.ts +10 -0
- package/site/mobile.html +70 -0
- package/site/module.d.ts +5 -0
- package/site/pc/App.vue +44 -0
- package/site/pc/Layout.vue +641 -0
- package/site/pc/components/AppAd.vue +117 -0
- package/site/pc/components/AppHeader.vue +459 -0
- package/site/pc/components/AppMobile.spec.ts +204 -0
- package/site/pc/components/AppMobile.vue +201 -0
- package/site/pc/components/AppOutline.spec.ts +89 -0
- package/site/pc/components/AppOutline.vue +161 -0
- package/site/pc/components/AppSidebar.vue +144 -0
- package/site/pc/components/code-example/CodeExample.spec.ts +36 -0
- package/site/pc/components/code-example/CodeExample.vue +164 -0
- package/site/pc/components/code-example/codeExample.less +88 -0
- package/site/pc/components/code-example/index.ts +10 -0
- package/site/pc/components/demo-preview/DemoPreview.vue +92 -0
- package/site/pc/components/demo-preview/index.ts +8 -0
- package/site/pc/components/mobile-preview-url.ts +17 -0
- package/site/pc/components/preview-section.spec.ts +24 -0
- package/site/pc/components/preview-section.ts +23 -0
- package/site/pc/main.ts +108 -0
- package/site/pc/pages/index/index.vue +421 -0
- package/site/pc/pages/index/locale/en-US.ts +1 -0
- package/site/pc/pages/index/locale/zh-CN.ts +1 -0
- package/site/pc/responsive-layout.spec.ts +40 -0
- package/site/pc/route-state.spec.ts +34 -0
- package/site/pc/route-state.ts +25 -0
- package/site/pc/scroll-hash.spec.ts +49 -0
- package/site/pc/scroll-hash.ts +25 -0
- package/site/route-recovery.spec.ts +51 -0
- package/site/route-recovery.ts +38 -0
- package/site/tsconfig.json +16 -0
- package/site/types.ts +6 -0
- package/site/utils.ts +45 -0
- package/template/create/[ComponentName].tsx.ejs +16 -0
- package/template/create/[ComponentName].vue.ejs +21 -0
- package/template/create/[componentName].d.ts.ejs +13 -0
- package/template/create/__tests__/index.spec.js.ejs +10 -0
- package/template/create/docs/en-US.md +0 -0
- package/template/create/docs/zh-CN.md +0 -0
- package/template/create/example/index.vue.ejs +17 -0
- package/template/create/example/locale/_index.ts +17 -0
- package/template/create/example/locale/en-US.ts +3 -0
- package/template/create/example/locale/index.ts +24 -0
- package/template/create/example/locale/zh-CN.ts +3 -0
- package/template/create/index.ts.ejs +12 -0
- package/template/create/props.ts +1 -0
- package/template/create/style/[componentName].less.ejs +5 -0
- package/template/create/style/index.less.ejs +1 -0
- package/template/create/style/index.ts.ejs +1 -0
- package/template/generators/base/.browserslistrc +2 -0
- package/template/generators/base/.prettierignore +14 -0
- package/template/generators/base/README.md +90 -0
- package/template/generators/base/_gitignore +19 -0
- package/template/generators/base/eslint.config.js +15 -0
- package/template/generators/base/package.json +97 -0
- package/template/generators/base/prettier.config.js +3 -0
- package/template/generators/base/public/logo.svg +30 -0
- package/template/generators/base/shims/shims-md.d.ts +4 -0
- package/template/generators/base/shims/shims-vue.d.ts +6 -0
- package/template/generators/base/tsconfig.declaration.json +21 -0
- package/template/generators/base/tsconfig.json +28 -0
- package/template/generators/base/ui-build.config.mjs +16 -0
- package/template/generators/config/default/base/docs/home.zh-CN.md +3 -0
- package/template/generators/config/default/base/maple.config.mjs +49 -0
- package/template/generators/config/default/sfc/src/button/Button.vue +34 -0
- package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/default/sfc/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/default/sfc/src/button/example/BasicUse.vue +7 -0
- package/template/generators/config/default/sfc/src/button/example/ModifyColor.vue +7 -0
- package/template/generators/config/default/sfc/src/button/example/index.vue +12 -0
- package/template/generators/config/default/sfc/src/button/index.ts +8 -0
- package/template/generators/config/default/sfc/src/button/style/button.less +14 -0
- package/template/generators/config/default/sfc/src/button/style/index.less +1 -0
- package/template/generators/config/default/sfc/src/button/style/index.ts +1 -0
- package/template/generators/config/default/sfc/src/utils/components.ts +20 -0
- package/template/generators/config/default/tsx/src/button/Button.tsx +30 -0
- package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/default/tsx/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/default/tsx/src/button/example/BasicUse.vue +7 -0
- package/template/generators/config/default/tsx/src/button/example/ModifyColor.vue +7 -0
- package/template/generators/config/default/tsx/src/button/example/index.vue +12 -0
- package/template/generators/config/default/tsx/src/button/index.ts +8 -0
- package/template/generators/config/default/tsx/src/button/style/button.less +14 -0
- package/template/generators/config/default/tsx/src/button/style/index.less +1 -0
- package/template/generators/config/default/tsx/src/button/style/index.ts +1 -0
- package/template/generators/config/default/tsx/src/utils/components.ts +20 -0
- package/template/generators/config/i18n/base/docs/home.en-US.md +3 -0
- package/template/generators/config/i18n/base/docs/home.zh-CN.md +3 -0
- package/template/generators/config/i18n/base/maple.config.mjs +51 -0
- package/template/generators/config/i18n/sfc/src/button/Button.vue +38 -0
- package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/i18n/sfc/src/button/docs/en-US.md +39 -0
- package/template/generators/config/i18n/sfc/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +11 -0
- package/template/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +11 -0
- package/template/generators/config/i18n/sfc/src/button/example/index.vue +15 -0
- package/template/generators/config/i18n/sfc/src/button/example/locale/en-US.ts +5 -0
- package/template/generators/config/i18n/sfc/src/button/example/locale/index.ts +23 -0
- package/template/generators/config/i18n/sfc/src/button/example/locale/zh-CN.ts +5 -0
- package/template/generators/config/i18n/sfc/src/button/index.ts +8 -0
- package/template/generators/config/i18n/sfc/src/button/style/button.less +14 -0
- package/template/generators/config/i18n/sfc/src/button/style/index.less +1 -0
- package/template/generators/config/i18n/sfc/src/button/style/index.ts +1 -0
- package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +52 -0
- package/template/generators/config/i18n/sfc/src/locale/docs/en-US.md +26 -0
- package/template/generators/config/i18n/sfc/src/locale/docs/zh-CN.md +25 -0
- package/template/generators/config/i18n/sfc/src/locale/en-US.d.ts +5 -0
- package/template/generators/config/i18n/sfc/src/locale/en-US.ts +7 -0
- package/template/generators/config/i18n/sfc/src/locale/index.ts +82 -0
- package/template/generators/config/i18n/sfc/src/locale/zh-CN.d.ts +5 -0
- package/template/generators/config/i18n/sfc/src/locale/zh-CN.ts +7 -0
- package/template/generators/config/i18n/sfc/src/utils/components.ts +20 -0
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +35 -0
- package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/i18n/tsx/src/button/docs/en-US.md +39 -0
- package/template/generators/config/i18n/tsx/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/i18n/tsx/src/button/example/BasicUse.vue +11 -0
- package/template/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +11 -0
- package/template/generators/config/i18n/tsx/src/button/example/index.vue +15 -0
- package/template/generators/config/i18n/tsx/src/button/example/locale/en-US.ts +5 -0
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +23 -0
- package/template/generators/config/i18n/tsx/src/button/example/locale/zh-CN.ts +5 -0
- package/template/generators/config/i18n/tsx/src/button/index.ts +8 -0
- package/template/generators/config/i18n/tsx/src/button/style/button.less +14 -0
- package/template/generators/config/i18n/tsx/src/button/style/index.less +1 -0
- package/template/generators/config/i18n/tsx/src/button/style/index.ts +1 -0
- package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +52 -0
- package/template/generators/config/i18n/tsx/src/locale/docs/en-US.md +26 -0
- package/template/generators/config/i18n/tsx/src/locale/docs/zh-CN.md +25 -0
- package/template/generators/config/i18n/tsx/src/locale/en-US.d.ts +5 -0
- package/template/generators/config/i18n/tsx/src/locale/en-US.ts +7 -0
- package/template/generators/config/i18n/tsx/src/locale/index.ts +82 -0
- package/template/generators/config/i18n/tsx/src/locale/zh-CN.d.ts +5 -0
- package/template/generators/config/i18n/tsx/src/locale/zh-CN.ts +7 -0
- package/template/generators/config/i18n/tsx/src/utils/components.ts +20 -0
package/README.md
CHANGED
|
@@ -1,3 +1,306 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Components Library Tools
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### Intro
|
|
4
|
+
|
|
5
|
+
`watchLang(callback)` detects both desktop documentation routes and mobile iframe query parameters, including the initial language and subsequent changes. An explicit `pc` or `mobile` argument remains available when needed.
|
|
6
|
+
|
|
7
|
+
The out-of-the-box `Vue3 component library` rapid prototyping tool provides a series of commands and tools to solve the problem of component library development.
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- 📦 Out-of-the-box component library development environment
|
|
12
|
+
- 📦 An out-of-the-box component library compilation tool that supports exporting `esm`, `cjs`, `umd` module codes
|
|
13
|
+
- 🛠️ Configuration file-based component library documentation site, support Baidu statistics and theme customization
|
|
14
|
+
- 🛠️ Supports both `sfc` and `tsx` styles for writing component libraries
|
|
15
|
+
- 📦 Out-of-the-box code inspection tool
|
|
16
|
+
- 📦 Out-of-the-box unit testing tools
|
|
17
|
+
- 📦 Out-of-the-box code publishing tool, publishes to both `npm` and `github`, and automatically generates changelogs
|
|
18
|
+
- 💪 Support for `VSCode` extension development
|
|
19
|
+
- 💪 Support `build svg to web fonts`
|
|
20
|
+
- 💪 Support for `Typescript`
|
|
21
|
+
- 💪 Support `Various themes, including default / maple brands and light / dark modes`
|
|
22
|
+
- 🌍 Support `Internationalization`
|
|
23
|
+
- 🚀 Based on `pnpm`
|
|
24
|
+
|
|
25
|
+
### Quickstart
|
|
26
|
+
|
|
27
|
+
`@maple-design/cli-vue` has built-in `sfc` and `tsx` style component library project templates, which can be generated directly by the `gen` command.
|
|
28
|
+
It is convenient for you to directly enter the component library development.
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
# playground-ignore
|
|
32
|
+
pnpm add @maple-design/cli-vue -g
|
|
33
|
+
maple-cli gen
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Advanced customization
|
|
37
|
+
|
|
38
|
+
### Configuration file
|
|
39
|
+
|
|
40
|
+
The `maple.config.mjs` in the project root directory is used to manage the specific details of the entire component library project.
|
|
41
|
+
The default configuration can be viewed [maple.default.config.ts](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.default.config.ts?ref_type=heads).
|
|
42
|
+
Also refer to `@maple-design/ui-vue` [maple.config.mjs](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/ui/maple.config.mjs?ref_type=heads).
|
|
43
|
+
|
|
44
|
+
| Parameter | Description | Type | Default |
|
|
45
|
+
| --- | -------------- | -------- | ---------- |
|
|
46
|
+
| `name` | The full name of the component library, which will be used as the package name | _string_ | `Maple` |
|
|
47
|
+
| `namespace` | Component library namespace, will be used as component prefix | _string_ | `var` |
|
|
48
|
+
| `host` | Development server host | _number_ | `localhost` |
|
|
49
|
+
| `port` | Development server port | _number_ | `8080` |
|
|
50
|
+
| `proxy` | Development server proxy | _Record<string, string \| ProxyOptions>_ | `-` |
|
|
51
|
+
| `title` | The title of the component library in the document | _string_ | `Maple` |
|
|
52
|
+
| `logo` | The logo of the component library in the document | _string_ | `-` |
|
|
53
|
+
| `alias` | Path alias (root is src folder when use relative path) | _Record<string, string>_ | `-` |
|
|
54
|
+
| `defaultLanguage` | Document default language | _string_ | `zh-CN` |
|
|
55
|
+
| `defaultLightTheme` | Default light-mode selection | _string_ | `lightTheme` |
|
|
56
|
+
| `defaultDarkTheme` | Default dark-mode selection | _string_ | `darkTheme` |
|
|
57
|
+
| `useMobile` | Whether to display the mobile phone preview on the right | _boolean_ | `false` |
|
|
58
|
+
| `themeKey` | The key of the theme in local storage | _string_ | `MAPLE_THEME` |
|
|
59
|
+
| `lightTheme` | Default brand light document theme | _Record<string, any>_ | `-` |
|
|
60
|
+
| `darkTheme` | Default brand dark document theme | _Record<string, any>_ | `-` |
|
|
61
|
+
| `mapleLightTheme` | Maple brand light document theme | _Record<string, any>_ | `-` |
|
|
62
|
+
| `mapleDarkTheme` | Maple brand dark document theme | _Record<string, any>_ | `-` |
|
|
63
|
+
| `highlight` | Document code snippet style related | _{ style: string }_ | `-` |
|
|
64
|
+
| `analysis` | Document statistics related | _{ baidu: string }_ | `-` |
|
|
65
|
+
| `pc` | PC side document structure configuration | _[MapleConfigPc](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | `-` |
|
|
66
|
+
| `mobile` | Mobile document structure configuration | _[MapleConfigMobile](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | `-` |
|
|
67
|
+
| `bundle` | Bundle output options | _{ external: string[], globals: Record<string, string> }_ | `-` |
|
|
68
|
+
| `vitePlugins` | vite plugins | _[Plugin](https://vite.dev/guide/using-plugins.html)[]_ \| `(plugins: Plugin[]) => Plugin[])` | `-` |
|
|
69
|
+
| `directives` | Component library directive folder name | _string[]_ | `[]` |
|
|
70
|
+
| `copy` | Copy file configuration | _[CopyPath[]](https://github.com/loca-spirit/maple-design-mobile/blob/main/packages/vite-plugins/src/copy.ts)_ | `- ` |
|
|
71
|
+
| `icons` | Font icon packaging related configurations | _[MapleConfigIcons](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads) _ | `-` |
|
|
72
|
+
| `esbuild` | esbuild configuration | _[MapleConfigEsbuild](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | ` -` |
|
|
73
|
+
| `seo` | seo options | _[MapleConfigSeo](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | ` -` |
|
|
74
|
+
|
|
75
|
+
#### Menu
|
|
76
|
+
|
|
77
|
+
| Parameter | Description | Type | Default |
|
|
78
|
+
| --- | -------------- | -------- | ---------- |
|
|
79
|
+
| `doc` | The document page corresponds to the matching file name, required | _string_ | `-` |
|
|
80
|
+
| `type` | The type of menu, when the type is `1`, it means the category menu, when the type is `2`, the doc field matches the component file under src, when the type is `3`, the doc field matches the md file under docs, required | _MenuTypes_ | `-` |
|
|
81
|
+
| `text` | The text displayed in the menu, English display text can be configured when internationalization is set, required | _Record<string, string>_ | `-` |
|
|
82
|
+
| `useMobile` | Whether to display the mobile phone preview on the right side on the current document page, if not filled, the default value is useMobile in config | _boolean_ | `-` |
|
|
83
|
+
|
|
84
|
+
### Custom pages
|
|
85
|
+
|
|
86
|
+
If you want to insert other pages into the component library, you can create a `pages` folder in the project root directory to write a vue component to generate other pages.
|
|
87
|
+
The directory structure is as follows:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
// playground-ignore
|
|
91
|
+
|-- maple-ui
|
|
92
|
+
|-- src
|
|
93
|
+
|-- docs
|
|
94
|
+
|-- pages
|
|
95
|
+
|-- sponsor
|
|
96
|
+
|-- index.vue
|
|
97
|
+
|-- contributor
|
|
98
|
+
|-- locale
|
|
99
|
+
|-- en-US.ts
|
|
100
|
+
|-- index.vue
|
|
101
|
+
|-- changelog
|
|
102
|
+
|-- locale
|
|
103
|
+
|-- zh-CN.ts
|
|
104
|
+
|-- en-US.ts
|
|
105
|
+
|-- index.vue
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The resulting route is as follows:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
// playground-ignore
|
|
113
|
+
/zh-CN/sponsor
|
|
114
|
+
/en-US/contributor
|
|
115
|
+
/zh-CN/changelog
|
|
116
|
+
/en-US/changelog
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Command related
|
|
120
|
+
|
|
121
|
+
#### Start the development server
|
|
122
|
+
|
|
123
|
+
```shell
|
|
124
|
+
# playground-ignore
|
|
125
|
+
maple-cli dev
|
|
126
|
+
# force mode
|
|
127
|
+
maple-cli dev -f
|
|
128
|
+
# draft mode
|
|
129
|
+
maple-cli dev -d
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Build a documentation site
|
|
133
|
+
|
|
134
|
+
Documentation development resolves components and styles from `src`. It generates `.maple` site pages/configuration without clearing or rewriting npm artifacts in `es` / `lib`, including configuration or research-menu restarts. Demo development does not require a library build first.
|
|
135
|
+
|
|
136
|
+
Markdown supports standalone `<demo src="../example/demos/basic.vue"></demo>` tags (including self-closing tags) and `demo` fences. Each referenced Vue file renders in its own live card with a source toolbar. Tags inside code samples remain static. Editing a Vue demo updates both the rendered example and its source automatically. The mobile preview continues to render the collection in `example/index.vue`.
|
|
137
|
+
|
|
138
|
+
Site component resolution follows the public export map directly to source modules, preventing circular barrel imports during documentation chunking. Authored function imports such as `import { Message } from '@maple-design/ui-vue'` retain automatic style injection. This is site-only resolution, not a change to published package entry points or a shared Cedar/Maple runtime.
|
|
139
|
+
|
|
140
|
+
The standalone Playground still consumes a built component package: run `pnpm build:lib` at the repository root before `pnpm dev:play`. It reads the published entry/CSS and writes browser assets to its own `public` directory; it does not need documentation development stubs.
|
|
141
|
+
|
|
142
|
+
Restart an already-running dev process once after upgrading the CLI to load the new behavior. The repository gate `pnpm check:dev-boundary` verifies artifact preservation on cold start and configuration/research restarts.
|
|
143
|
+
|
|
144
|
+
```shell
|
|
145
|
+
# playground-ignore
|
|
146
|
+
maple-cli build
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Preview documentation site
|
|
150
|
+
|
|
151
|
+
```shell
|
|
152
|
+
# playground-ignore
|
|
153
|
+
maple-cli preview
|
|
154
|
+
# set port number
|
|
155
|
+
maple-cli preview -p <port>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Compile component library
|
|
159
|
+
|
|
160
|
+
```shell
|
|
161
|
+
# playground-ignore
|
|
162
|
+
maple-cli compile
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Compile style vars types declaration file
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
# playground-ignore
|
|
169
|
+
maple-cli compile:style-vars
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Run VSCode extension development environment
|
|
173
|
+
|
|
174
|
+
```shell
|
|
175
|
+
# playground-ignore
|
|
176
|
+
maple-cli dev:extension
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Build VSCode extension for production
|
|
180
|
+
|
|
181
|
+
```shell
|
|
182
|
+
# playground-ignore
|
|
183
|
+
maple-cli build:extension
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Build svg to web fonts
|
|
187
|
+
|
|
188
|
+
```shell
|
|
189
|
+
# playground-ignore
|
|
190
|
+
maple-cli build:icons -w
|
|
191
|
+
maple-cli build:icons
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Execute all unit tests
|
|
195
|
+
|
|
196
|
+
```shell
|
|
197
|
+
# playground-ignore
|
|
198
|
+
maple-cli test
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Execute a unit test
|
|
202
|
+
|
|
203
|
+
```shell
|
|
204
|
+
# playground-ignore
|
|
205
|
+
maple-cli test -c <componentName>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### Execute unit tests in watch mode
|
|
209
|
+
|
|
210
|
+
```shell
|
|
211
|
+
# playground-ignore
|
|
212
|
+
maple-cli test -w
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### Execute unit tests and report coverage
|
|
216
|
+
|
|
217
|
+
```shell
|
|
218
|
+
# playground-ignore
|
|
219
|
+
maple-cli test -cov
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### Lint git commit message
|
|
223
|
+
|
|
224
|
+
```shell
|
|
225
|
+
# playground-ignore
|
|
226
|
+
maple-cli commit-lint
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Show checklist
|
|
230
|
+
|
|
231
|
+
```shell
|
|
232
|
+
# playground-ignore
|
|
233
|
+
maple-cli checklist
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### Generate changelog
|
|
237
|
+
|
|
238
|
+
```shell
|
|
239
|
+
# playground-ignore
|
|
240
|
+
maple-cli changelog
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### Release component library
|
|
244
|
+
|
|
245
|
+
```shell
|
|
246
|
+
# playground-ignore
|
|
247
|
+
maple-cli release
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
#### Generate a project template
|
|
251
|
+
|
|
252
|
+
```shell
|
|
253
|
+
# playground-ignore
|
|
254
|
+
maple-cli gen
|
|
255
|
+
|
|
256
|
+
# Options
|
|
257
|
+
-n
|
|
258
|
+
--name
|
|
259
|
+
project name
|
|
260
|
+
-s
|
|
261
|
+
--sfc
|
|
262
|
+
Generate sfc-style project templates
|
|
263
|
+
-t
|
|
264
|
+
--tsx
|
|
265
|
+
Generate tsx-style project templates
|
|
266
|
+
-l
|
|
267
|
+
--locale
|
|
268
|
+
Need to support internationalization
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Create a component template file
|
|
272
|
+
|
|
273
|
+
```shell
|
|
274
|
+
# playground-ignore
|
|
275
|
+
maple-cli create
|
|
276
|
+
|
|
277
|
+
# Options
|
|
278
|
+
-n
|
|
279
|
+
--name
|
|
280
|
+
project name
|
|
281
|
+
-s
|
|
282
|
+
--sfc
|
|
283
|
+
Generate sfc-style component
|
|
284
|
+
-t
|
|
285
|
+
--tsx
|
|
286
|
+
Generate tsx-style component
|
|
287
|
+
-l
|
|
288
|
+
--locale
|
|
289
|
+
Need to support internationalization
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Note before publish
|
|
293
|
+
|
|
294
|
+
1. `npm` repository registry must set to `npm` official mirror
|
|
295
|
+
2. Execute `npm login` to log in
|
|
296
|
+
|
|
297
|
+
### Q & A
|
|
298
|
+
|
|
299
|
+
#### How to solve failure of installing sharp ?
|
|
300
|
+
|
|
301
|
+
- You can choose to change mirror site which contains binaries for both sharp and libvips.
|
|
302
|
+
|
|
303
|
+
``` shell
|
|
304
|
+
pnpm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
|
|
305
|
+
pnpm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
|
|
306
|
+
```
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# 组件库快速成型工具
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
开箱即用的 `Vue3组件库` 快速成型工具,提供了一系列命令和工具去解决组件库开发上的问题。
|
|
6
|
+
|
|
7
|
+
### 特性
|
|
8
|
+
|
|
9
|
+
- 📦 开箱即用的组件库开发环境
|
|
10
|
+
- 📦 开箱即用的组件库编译工具,支持导出 `esm`, `cjs`, `umd` 三种模块代码
|
|
11
|
+
- 🛠️ 基于配置文件的组件库文档站点,支持百度统计和主题定制
|
|
12
|
+
- 🛠️ 支持 `sfc` 和 `tsx` 两种风格的组件库编写风格
|
|
13
|
+
- 📦 开箱即用的代码检查工具
|
|
14
|
+
- 📦 开箱即用的单元测试工具
|
|
15
|
+
- 📦 开箱即用的代码发布工具,同时发布到 `npm` 和 `github`, 并自动生成更新日志
|
|
16
|
+
- 💪 支持 `VSCode` 插件开发
|
|
17
|
+
- 💪 支持 `字体图标打包`
|
|
18
|
+
- 💪 支持 `Typescript`
|
|
19
|
+
- 💪 支持 `多种主题, 包含 default / maple 品牌及明暗模式`
|
|
20
|
+
- 🌍 支持 `国际化`
|
|
21
|
+
- 🚀 基于 `pnpm`
|
|
22
|
+
|
|
23
|
+
### 快速开始
|
|
24
|
+
|
|
25
|
+
`@maple-design/cli-vue` 内置了 `sfc` 和 `tsx` 两种风格的组件库项目模板,可以通过 `gen` 命令直接生成。
|
|
26
|
+
方便您直接进入组件库开发。
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
# playground-ignore
|
|
30
|
+
pnpm add @maple-design/cli-vue -g
|
|
31
|
+
maple-cli gen
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 高级定制
|
|
35
|
+
|
|
36
|
+
### 配置文件
|
|
37
|
+
|
|
38
|
+
项目根目录下的 `maple.config.mjs` 用来管理整个组件库项目的具体细节。
|
|
39
|
+
默认配置可查阅 [maple.default.config.ts](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.default.config.ts?ref_type=heads)。
|
|
40
|
+
也可以参考 `@maple-design/ui-vue` 的 [maple.config.mjs](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/ui/maple.config.mjs?ref_type=heads)。
|
|
41
|
+
|
|
42
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
43
|
+
| -- | -------------- | -------- | ---------- |
|
|
44
|
+
| `name` | 组件库全名,会作为包名 | _string_ | `Maple` |
|
|
45
|
+
| `namespace` | 组件库命名空间, 会作为组件前缀 | _string_ | `var` |
|
|
46
|
+
| `host` | 开发服务器主机 | _number_ | `localhost` |
|
|
47
|
+
| `port` | 开发服务器端口 | _number_ | `8080` |
|
|
48
|
+
| `proxy` | 开发服务器代理 | _Record<string, string \| ProxyOptions>_ | `-` |
|
|
49
|
+
| `title` | 文档中组件库的标题 | _string_ | `Maple` |
|
|
50
|
+
| `logo` | 文档中组件库的 logo | _string_ | `-` |
|
|
51
|
+
| `alias` | 路径别名 (使用相对路径时,根路径为 src 文件夹) | _Record<string, string>_ | `-` |
|
|
52
|
+
| `defaultLanguage` | 文档默认语言 | _string_ | `zh-CN` |
|
|
53
|
+
| `defaultLightTheme` | 默认使用的亮色主题 | _string_ | `lightTheme` |
|
|
54
|
+
| `defaultDarkTheme` | 默认使用的暗色主题 | _string_ | `darkTheme` |
|
|
55
|
+
| `useMobile` | 是否显示右侧手机预览 | _boolean_ | `false` |
|
|
56
|
+
| `themeKey` | 主题在本地存储中的 key | _string_ | `MAPLE_THEME` |
|
|
57
|
+
| `lightTheme` | 默认品牌亮色文档主题 | _Record<string, any>_ | `-` |
|
|
58
|
+
| `darkTheme` | 默认品牌暗色文档主题 | _Record<string, any>_ | `-` |
|
|
59
|
+
| `mapleLightTheme` | 枫叶品牌亮色文档主题 | _Record<string, any>_ | `-` |
|
|
60
|
+
| `mapleDarkTheme` | 枫叶品牌暗色文档主题 | _Record<string, any>_ | `-` |
|
|
61
|
+
| `highlight` | 文档代码片段样式相关 | _{ style: string }_ | `-` |
|
|
62
|
+
| `analysis` | 文档统计相关 | _{ baidu: string }_ | `-` |
|
|
63
|
+
| `pc` | pc 端文档结构配置 | _[MapleConfigPc](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | `-` |
|
|
64
|
+
| `mobile` | mobile 端文档结构配置 | _[MapleConfigMobile](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | `-` |
|
|
65
|
+
| `bundle` | 组件库编译的捆绑产物配置 | _{ external: string[], globals: Record<string, string> }_ | `-` |
|
|
66
|
+
| `vitePlugins` | vite 插件 | _[Plugin](https://vite.dev/guide/using-plugins.html)[]_ \| `(plugins: Plugin[]) => Plugin[])` | `-` |
|
|
67
|
+
| `directives` | 组件库指令文件夹名称 | _string[]_ | `[]` |
|
|
68
|
+
| `copy` | 复制文件配置 | _[CopyPath[]](https://github.com/loca-spirit/maple-design-mobile/blob/main/packages/vite-plugins/src/copy.ts)_ | `-` |
|
|
69
|
+
| `icons` | 字体图标打包相关配置 | _[MapleConfigIcons](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | `-` |
|
|
70
|
+
| `esbuild` | esbuild 配置 | _[MapleConfigEsbuild](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | `-` |
|
|
71
|
+
| `seo` | seo 选项 | _[MapleConfigSeo](https://xxx/pe.frontend/materials/maplejs/maple-design-mobile/-/blob/master/packages/cli/src/node/config/maple.config.ts?ref_type=heads)_ | ` -` |
|
|
72
|
+
|
|
73
|
+
#### Menu
|
|
74
|
+
|
|
75
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
76
|
+
| -- | -------------- | -------- | ---------- |
|
|
77
|
+
| `doc` | 文档页面应匹配的文件名称, 必填 | _string_ | `-` |
|
|
78
|
+
| `type` | menu 类型, 当 type 为 `1` 时表示分类 menu, 类型为 `2` 时 doc 字段匹配 src 下的组件文件, 类型为`3`时 doc 字段匹配 docs 下的 md 文件 | _MenuTypes_ | `-` |
|
|
79
|
+
| `text` | menu 所展示的文字, 当设置国际化时可配置英文展示文字 | _Record<string, string>_ | `-` |
|
|
80
|
+
| `useMobile` | 是否在当前文档页显示右侧手机预览, 如不填写, 默认取 config 中的 useMobile | _boolean_ | `-` |
|
|
81
|
+
|
|
82
|
+
### 自定义页面
|
|
83
|
+
|
|
84
|
+
如果想在组件库中插入其他页面,可以在项目根目录下的创建 `pages` 文件夹编写 vue 组件, 用来生成其他的页面。
|
|
85
|
+
目录结构如下:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
// playground-ignore
|
|
89
|
+
|-- maple-ui
|
|
90
|
+
|-- src
|
|
91
|
+
|-- docs
|
|
92
|
+
|-- pages
|
|
93
|
+
|-- sponsor
|
|
94
|
+
|-- index.vue
|
|
95
|
+
|-- contributor
|
|
96
|
+
|-- locale
|
|
97
|
+
|-- en-US.ts
|
|
98
|
+
|-- index.vue
|
|
99
|
+
|-- changelog
|
|
100
|
+
|-- locale
|
|
101
|
+
|-- zh-CN.ts
|
|
102
|
+
|-- en-US.ts
|
|
103
|
+
|-- index.vue
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
生成的路由如下:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
// playground-ignore
|
|
110
|
+
/zh-CN/sponsor
|
|
111
|
+
/en-US/contributor
|
|
112
|
+
/zh-CN/changelog
|
|
113
|
+
/en-US/changelog
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 命令相关
|
|
117
|
+
|
|
118
|
+
#### 启动开发服务器
|
|
119
|
+
|
|
120
|
+
```shell
|
|
121
|
+
# playground-ignore
|
|
122
|
+
maple-cli dev
|
|
123
|
+
# force mode
|
|
124
|
+
maple-cli dev -f
|
|
125
|
+
# draft mode
|
|
126
|
+
maple-cli dev -d
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### 构建文档站点
|
|
130
|
+
|
|
131
|
+
文档开发直接解析 `src` 中的组件和样式,只生成 `.maple` 站点配置与页面,不清空或改写 npm 发布用的 `es` / `lib`。修改配置或调研菜单触发重启时同样遵守此边界;不用先构建 npm 包才能展示 Demo。
|
|
132
|
+
|
|
133
|
+
Markdown 支持独立一行的 `<demo src="../example/demos/basic.vue"></demo>`(也可自闭合)与 `demo` 代码围栏。两种写法都读取实际 Vue 文件,每个文件对应独立运行卡片和源码工具条;代码示例中的标签不会执行。修改 Vue 示例会自动更新运行内容与源码,无需手动同步静态副本。右侧手机预览继续读取 `example/index.vue` 的示例集合。
|
|
134
|
+
|
|
135
|
+
Demo 的 `watchLang(callback)` 默认从当前站点路由读取语言:中间卡片使用 `#/en-US/component`,手机集合使用 `#/component?language=en-US`。初次挂载及顶部语言切换均同步,无需局部 locale 激活;必要时仍可显式指定 `pc` 或 `mobile`。
|
|
136
|
+
|
|
137
|
+
文档站自动组件引用依据公开导出表直达源码模块,避免组件内部再经过全库根入口导致循环分包;显式函数导入仍可写 `import { Message } from '@maple-design/ui-vue'`,自动样式注入保留。该解析只作用于站点,不改变 npm 包入口或共享两库运行时。
|
|
138
|
+
|
|
139
|
+
独立 Playground 仍需要已构建的组件包:先在仓库根执行 `pnpm build:lib`,再执行 `pnpm dev:play`。它读取发布入口与 CSS 并将浏览器资源写入自己的 `public`,不是文档 dev 的占位入口。
|
|
140
|
+
|
|
141
|
+
升级 CLI 开发流程后,已经启动的旧 dev 进程需要手动重启一次才能使用新逻辑。仓库门禁 `pnpm check:dev-boundary` 验证冷启动和配置/调研重启不会破坏发布文件。
|
|
142
|
+
|
|
143
|
+
```shell
|
|
144
|
+
# playground-ignore
|
|
145
|
+
maple-cli build
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### 预览文档站点
|
|
149
|
+
|
|
150
|
+
```shell
|
|
151
|
+
# playground-ignore
|
|
152
|
+
maple-cli preview
|
|
153
|
+
# set port number
|
|
154
|
+
maple-cli preview -p <port>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### 构建组件库
|
|
158
|
+
|
|
159
|
+
```shell
|
|
160
|
+
# playground-ignore
|
|
161
|
+
maple-cli compile
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### 构建样式变量类型声明文件
|
|
165
|
+
|
|
166
|
+
```shell
|
|
167
|
+
# playground-ignore
|
|
168
|
+
maple-cli compile:style-vars
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### 启动 VSCode 插件开发环境
|
|
172
|
+
|
|
173
|
+
```shell
|
|
174
|
+
# playground-ignore
|
|
175
|
+
maple-cli dev:extension
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### 构建 VSCode 插件
|
|
179
|
+
|
|
180
|
+
```shell
|
|
181
|
+
# playground-ignore
|
|
182
|
+
maple-cli build:extension
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### 打包字体图标
|
|
186
|
+
|
|
187
|
+
```shell
|
|
188
|
+
# playground-ignore
|
|
189
|
+
maple-cli build:icons -w
|
|
190
|
+
maple-cli build:icons
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### 执行所有的单元测试
|
|
194
|
+
|
|
195
|
+
```shell
|
|
196
|
+
# playground-ignore
|
|
197
|
+
maple-cli test
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### 执行单个组件的单元测试
|
|
201
|
+
|
|
202
|
+
```shell
|
|
203
|
+
# playground-ignore
|
|
204
|
+
maple-cli test -c <componentName>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### 以 watch 模式执行单元测试
|
|
208
|
+
|
|
209
|
+
```shell
|
|
210
|
+
# playground-ignore
|
|
211
|
+
maple-cli test -w
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### 执行所有的单元测试并报告覆盖率
|
|
215
|
+
|
|
216
|
+
```shell
|
|
217
|
+
# playground-ignore
|
|
218
|
+
maple-cli test -cov
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### 校验提交信息
|
|
222
|
+
|
|
223
|
+
```shell
|
|
224
|
+
# playground-ignore
|
|
225
|
+
maple-cli commit-lint
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### 显示检查清单
|
|
229
|
+
|
|
230
|
+
```shell
|
|
231
|
+
# playground-ignore
|
|
232
|
+
maple-cli checklist
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### 生成更新日志
|
|
236
|
+
|
|
237
|
+
```shell
|
|
238
|
+
# playground-ignore
|
|
239
|
+
maple-cli changelog
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### 发布组件库
|
|
243
|
+
|
|
244
|
+
```shell
|
|
245
|
+
# playground-ignore
|
|
246
|
+
maple-cli release
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### 生成一个项目模板
|
|
250
|
+
|
|
251
|
+
```shell
|
|
252
|
+
# playground-ignore
|
|
253
|
+
maple-cli gen
|
|
254
|
+
|
|
255
|
+
# Options
|
|
256
|
+
-n
|
|
257
|
+
--name
|
|
258
|
+
项目名
|
|
259
|
+
-s
|
|
260
|
+
--sfc
|
|
261
|
+
生成 sfc 风格的项目模板
|
|
262
|
+
-t
|
|
263
|
+
--tsx
|
|
264
|
+
生成 tsx 格式项目
|
|
265
|
+
-l
|
|
266
|
+
--locale
|
|
267
|
+
需要支持国际化
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### 创建组件模板文件
|
|
271
|
+
|
|
272
|
+
```shell
|
|
273
|
+
# playground-ignore
|
|
274
|
+
maple-cli create
|
|
275
|
+
|
|
276
|
+
# Options
|
|
277
|
+
-n
|
|
278
|
+
--name
|
|
279
|
+
组件名
|
|
280
|
+
-s
|
|
281
|
+
--sfc
|
|
282
|
+
生成 sfc 风格的组件
|
|
283
|
+
-t
|
|
284
|
+
--tsx
|
|
285
|
+
生成 tsx 风格的文件
|
|
286
|
+
-l
|
|
287
|
+
--locale
|
|
288
|
+
需要支持国际化
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 发布前注意
|
|
292
|
+
|
|
293
|
+
1. `npm` 的仓库源必须指向 `npm` 官方镜像
|
|
294
|
+
2. 执行 `npm login` 进行登录
|
|
295
|
+
|
|
296
|
+
### 问答
|
|
297
|
+
|
|
298
|
+
#### 如何解决安装 sharp 失败的问题 ?
|
|
299
|
+
|
|
300
|
+
- 您可以选择更改包含 sharp 和 libvips 二进制文件的镜像站点
|
|
301
|
+
|
|
302
|
+
``` shell
|
|
303
|
+
pnpm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
|
|
304
|
+
pnpm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
|
|
305
|
+
```
|
package/bin/cli.mjs
ADDED
package/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/client/index'
|
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/client/index.js'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ThemeProvider } from '@maple-design/ui-vue';
|
|
2
|
+
import AppType from './appType';
|
|
3
|
+
interface PCLocationInfo {
|
|
4
|
+
language: string;
|
|
5
|
+
menuName: string;
|
|
6
|
+
hash: string;
|
|
7
|
+
}
|
|
8
|
+
export type Theme = 'lightTheme' | 'darkTheme' | 'mapleLightTheme' | 'mapleDarkTheme' | 'alpsLightTheme' | 'fireflyLightTheme' | 'alpsDarkTheme' | 'fireflyDarkTheme';
|
|
9
|
+
export type ThemeScope = 'site' | 'demo';
|
|
10
|
+
export type StyleVars = Record<string, string>;
|
|
11
|
+
export declare function getPCLocationInfo(): PCLocationInfo;
|
|
12
|
+
/** Site docs chrome theme (`themeKey`) vs mobile demo theme (`demoThemeKey`). */
|
|
13
|
+
export declare function getBrowserTheme(scope?: ThemeScope): Theme;
|
|
14
|
+
export declare function persistTheme(theme: Theme, scope?: ThemeScope): void;
|
|
15
|
+
export declare function watchLang(cb: (lang: string) => void, platform?: 'pc' | 'mobile'): void;
|
|
16
|
+
export declare function withSiteConfigNamespace(styleVars: Record<string, any>): StyleVars;
|
|
17
|
+
export declare function watchPlatform(cb: (platform: string) => void): void;
|
|
18
|
+
export declare function useRouteListener(cb: () => void): void;
|
|
19
|
+
export declare const currentThemePreset: import("vue").ShallowRef<StyleVars, StyleVars>;
|
|
20
|
+
export declare const currentStyleVars: import("vue").ShallowRef<Record<string, string>, Record<string, string>>;
|
|
21
|
+
export { currentTheme } from './theme-state';
|
|
22
|
+
export declare function setTheme(theme: Theme): void;
|
|
23
|
+
export declare function onThemeChange(cb?: (theme: Theme) => void, scope?: ThemeScope): void;
|
|
24
|
+
export declare function getSiteStyleVars(theme: Theme): StyleVars;
|
|
25
|
+
export declare function setColorScheme(theme: Theme): void;
|
|
26
|
+
export declare function watchTheme(cb: (theme: Theme, from: 'pc' | 'mobile' | 'default' | 'playground') => void, shouldUnmount?: boolean): void;
|
|
27
|
+
export declare function getMobileIndex(): "/mobile.html" | "./mobile" | "./mobile.html";
|
|
28
|
+
export { AppType, ThemeProvider };
|
|
29
|
+
export { normalizeLanguage, getSavedLanguage, saveLanguage, createDemoMessages } from './language';
|