@spcsn/taro-cli 0.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/LICENSE +174 -0
- package/README.md +0 -0
- package/bin/taro +7 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +266 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/customCommand.d.ts +5 -0
- package/dist/commands/customCommand.js +23 -0
- package/dist/commands/customCommand.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +10 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/packagesManagement.d.ts +19 -0
- package/dist/config/packagesManagement.js +22 -0
- package/dist/config/packagesManagement.js.map +1 -0
- package/dist/create/constants.d.ts +1 -0
- package/dist/create/constants.js +5 -0
- package/dist/create/constants.js.map +1 -0
- package/dist/create/creator.d.ts +9 -0
- package/dist/create/creator.js +64 -0
- package/dist/create/creator.js.map +1 -0
- package/dist/create/fetchTemplate.d.ts +8 -0
- package/dist/create/fetchTemplate.js +169 -0
- package/dist/create/fetchTemplate.js.map +1 -0
- package/dist/create/page.d.ts +65 -0
- package/dist/create/page.js +266 -0
- package/dist/create/page.js.map +1 -0
- package/dist/create/plugin.d.ts +16 -0
- package/dist/create/plugin.js +77 -0
- package/dist/create/plugin.js.map +1 -0
- package/dist/create/project.d.ts +70 -0
- package/dist/create/project.js +481 -0
- package/dist/create/project.js.map +1 -0
- package/dist/doctor/index.d.ts +4 -0
- package/dist/doctor/index.js +23 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/presets/commands/build.d.ts +3 -0
- package/dist/presets/commands/build.js +236 -0
- package/dist/presets/commands/build.js.map +1 -0
- package/dist/presets/commands/config.d.ts +3 -0
- package/dist/presets/commands/config.js +121 -0
- package/dist/presets/commands/config.js.map +1 -0
- package/dist/presets/commands/create.d.ts +3 -0
- package/dist/presets/commands/create.js +112 -0
- package/dist/presets/commands/create.js.map +1 -0
- package/dist/presets/commands/global-config.d.ts +3 -0
- package/dist/presets/commands/global-config.js +175 -0
- package/dist/presets/commands/global-config.js.map +1 -0
- package/dist/presets/commands/help.d.ts +3 -0
- package/dist/presets/commands/help.js +16 -0
- package/dist/presets/commands/help.js.map +1 -0
- package/dist/presets/commands/info.d.ts +3 -0
- package/dist/presets/commands/info.js +96 -0
- package/dist/presets/commands/info.js.map +1 -0
- package/dist/presets/commands/init.d.ts +3 -0
- package/dist/presets/commands/init.js +46 -0
- package/dist/presets/commands/init.js.map +1 -0
- package/dist/presets/commands/inspect.d.ts +3 -0
- package/dist/presets/commands/inspect.js +155 -0
- package/dist/presets/commands/inspect.js.map +1 -0
- package/dist/presets/commands/update.d.ts +3 -0
- package/dist/presets/commands/update.js +187 -0
- package/dist/presets/commands/update.js.map +1 -0
- package/dist/presets/constant/hooks.d.ts +13 -0
- package/dist/presets/constant/hooks.js +17 -0
- package/dist/presets/constant/hooks.js.map +1 -0
- package/dist/presets/constant/index.d.ts +1 -0
- package/dist/presets/constant/index.js +18 -0
- package/dist/presets/constant/index.js.map +1 -0
- package/dist/presets/files/generateFrameworkInfo.d.ts +3 -0
- package/dist/presets/files/generateFrameworkInfo.js +30 -0
- package/dist/presets/files/generateFrameworkInfo.js.map +1 -0
- package/dist/presets/files/generateProjectConfig.d.ts +3 -0
- package/dist/presets/files/generateProjectConfig.js +72 -0
- package/dist/presets/files/generateProjectConfig.js.map +1 -0
- package/dist/presets/files/writeFileToDist.d.ts +3 -0
- package/dist/presets/files/writeFileToDist.js +50 -0
- package/dist/presets/files/writeFileToDist.js.map +1 -0
- package/dist/presets/hooks/build.d.ts +3 -0
- package/dist/presets/hooks/build.js +55 -0
- package/dist/presets/hooks/build.js.map +1 -0
- package/dist/presets/hooks/create.d.ts +3 -0
- package/dist/presets/hooks/create.js +42 -0
- package/dist/presets/hooks/create.js.map +1 -0
- package/dist/presets/index.d.ts +4 -0
- package/dist/presets/index.js +50 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/platforms/plugin.d.ts +3 -0
- package/dist/presets/platforms/plugin.js +106 -0
- package/dist/presets/platforms/plugin.js.map +1 -0
- package/dist/presets/platforms/rn.d.ts +3 -0
- package/dist/presets/platforms/rn.js +130 -0
- package/dist/presets/platforms/rn.js.map +1 -0
- package/dist/util/appConfig.d.ts +11 -0
- package/dist/util/appConfig.js +27 -0
- package/dist/util/appConfig.js.map +1 -0
- package/dist/util/createPage.d.ts +9 -0
- package/dist/util/createPage.js +114 -0
- package/dist/util/createPage.js.map +1 -0
- package/dist/util/defineConfig.d.ts +17 -0
- package/dist/util/defineConfig.js +11 -0
- package/dist/util/defineConfig.js.map +1 -0
- package/dist/util/index.d.ts +23 -0
- package/dist/util/index.js +149 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/types.d.ts +58 -0
- package/dist/util/types.js +3 -0
- package/dist/util/types.js.map +1 -0
- package/global.d.ts +4 -0
- package/index.js +3 -0
- package/package.json +74 -0
- package/postinstall.js +17 -0
- package/src/__tests__/__mocks__/presets.ts +15 -0
- package/src/__tests__/build-config.spec.ts +66 -0
- package/src/__tests__/cli.spec.ts +226 -0
- package/src/__tests__/config.spec.ts +224 -0
- package/src/__tests__/doctor-config.spec.ts +943 -0
- package/src/__tests__/doctor-recommand.spec.ts +136 -0
- package/src/__tests__/doctor.spec.ts +94 -0
- package/src/__tests__/dotenv-parse.spec.ts +105 -0
- package/src/__tests__/env/.env +2 -0
- package/src/__tests__/fixtures/default/.env +3 -0
- package/src/__tests__/fixtures/default/.env.development +1 -0
- package/src/__tests__/fixtures/default/.env.local +1 -0
- package/src/__tests__/fixtures/default/.env.pre +3 -0
- package/src/__tests__/fixtures/default/.env.production +1 -0
- package/src/__tests__/fixtures/default/.env.uat +5 -0
- package/src/__tests__/fixtures/default/.env.uat.local +1 -0
- package/src/__tests__/fixtures/default/babel.config.js +10 -0
- package/src/__tests__/fixtures/default/config/dev.js +9 -0
- package/src/__tests__/fixtures/default/config/index.js +84 -0
- package/src/__tests__/fixtures/default/config/prod.js +18 -0
- package/src/__tests__/fixtures/default/package.json +27 -0
- package/src/__tests__/fixtures/default/src/app.config.js +11 -0
- package/src/__tests__/fixtures/default/src/app.js +16 -0
- package/src/__tests__/fixtures/default/src/app.scss +0 -0
- package/src/__tests__/fixtures/default/src/index.html +19 -0
- package/src/__tests__/fixtures/default/src/pages/index/index.config.js +3 -0
- package/src/__tests__/fixtures/default/src/pages/index/index.jsx +22 -0
- package/src/__tests__/fixtures/default/src/pages/index/index.scss +0 -0
- package/src/__tests__/info.spec.ts +72 -0
- package/src/__tests__/inspect.spec.ts +160 -0
- package/src/__tests__/update.spec.ts +310 -0
- package/src/__tests__/utils/index.ts +54 -0
- package/src/cli.ts +240 -0
- package/src/commands/customCommand.ts +22 -0
- package/src/config/index.ts +7 -0
- package/src/config/manifest.default.json +33 -0
- package/src/config/packagesManagement.ts +20 -0
- package/src/config/rn-stylelint.json +4 -0
- package/src/config/tsconfig.json +22 -0
- package/src/create/constants.ts +1 -0
- package/src/create/creator.ts +37 -0
- package/src/create/fetchTemplate.ts +161 -0
- package/src/create/page.ts +325 -0
- package/src/create/plugin.ts +55 -0
- package/src/create/project.ts +539 -0
- package/src/doctor/index.ts +21 -0
- package/src/index.ts +24 -0
- package/src/presets/commands/build.ts +215 -0
- package/src/presets/commands/config.ts +86 -0
- package/src/presets/commands/create.ts +104 -0
- package/src/presets/commands/global-config.ts +140 -0
- package/src/presets/commands/help.ts +17 -0
- package/src/presets/commands/info.ts +81 -0
- package/src/presets/commands/init.ts +63 -0
- package/src/presets/commands/inspect.ts +137 -0
- package/src/presets/commands/update.ts +175 -0
- package/src/presets/constant/hooks.ts +14 -0
- package/src/presets/constant/index.ts +1 -0
- package/src/presets/files/generateFrameworkInfo.ts +30 -0
- package/src/presets/files/generateProjectConfig.ts +41 -0
- package/src/presets/files/writeFileToDist.ts +17 -0
- package/src/presets/hooks/build.ts +22 -0
- package/src/presets/hooks/create.ts +9 -0
- package/src/presets/index.ts +15 -0
- package/src/presets/platforms/plugin.ts +75 -0
- package/src/presets/platforms/rn.ts +125 -0
- package/src/util/appConfig.ts +32 -0
- package/src/util/createPage.ts +139 -0
- package/src/util/defineConfig.ts +28 -0
- package/src/util/index.ts +126 -0
- package/src/util/types.ts +81 -0
- package/templates/default/_editorconfig +12 -0
- package/templates/default/_env.development +2 -0
- package/templates/default/_env.production +1 -0
- package/templates/default/_env.test +1 -0
- package/templates/default/_gitignore +8 -0
- package/templates/default/babel.config.js +14 -0
- package/templates/default/config/dev.js +5 -0
- package/templates/default/config/index.js +61 -0
- package/templates/default/config/prod.js +5 -0
- package/templates/default/package.json.tmpl +52 -0
- package/templates/default/project.config.json +15 -0
- package/templates/default/src/app.config.js +11 -0
- package/templates/default/src/app.css +0 -0
- package/templates/default/src/app.js +15 -0
- package/templates/default/src/pages/index/index.config.js +3 -0
- package/templates/default/src/pages/index/index.css +0 -0
- package/templates/default/src/pages/index/index.jsx +15 -0
- package/templates/default/template_creator.js +61 -0
- package/templates/default/tsconfig.json +30 -0
- package/templates/default/types/global.d.ts +27 -0
- package/templates/global-config/index.json +4 -0
- package/templates/global-config/package.json +5 -0
- package/templates/plugin-compile/README.md +32 -0
- package/templates/plugin-compile/index.js +3 -0
- package/templates/plugin-compile/package.json.tmpl +43 -0
- package/templates/plugin-compile/src/index.ts +153 -0
- package/templates/plugin-compile/tsconfig.json +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 O2Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
========================================================================
|
|
24
|
+
|
|
25
|
+
MIT (react-devtools):
|
|
26
|
+
The following files embed [react-devtools](https://github.com/facebook/react) MIT:
|
|
27
|
+
`/packages/taro-plugin-react-devtools/src/backend/index.js`
|
|
28
|
+
See `/LICENSE` for details of the license.
|
|
29
|
+
|
|
30
|
+
==================
|
|
31
|
+
|
|
32
|
+
MIT (vue-devtools):
|
|
33
|
+
The following files embed [vue-devtools](https://github.com/vuejs/devtools) MIT:
|
|
34
|
+
`/packages/taro-plugin-vue-devtools/src/backend/*`
|
|
35
|
+
See `/LICENSE` for details of the license.
|
|
36
|
+
|
|
37
|
+
==================
|
|
38
|
+
|
|
39
|
+
MIT (vite):
|
|
40
|
+
The following files embed [vite](https://github.com/vitejs/vite) MIT:
|
|
41
|
+
`/packages/taro-webpack5-prebundle/src/prebundle/scanImport.ts`,
|
|
42
|
+
`/packages/taro-webpack5-prebundle/src/prebundle/bundle.ts`,
|
|
43
|
+
`/packages/taro-webpack5-prebundle/src/h5.ts`,
|
|
44
|
+
`/packages/taro-webpack5-prebundle/src/min.ts`
|
|
45
|
+
See `/LICENSE` for details of the license.
|
|
46
|
+
|
|
47
|
+
==================
|
|
48
|
+
|
|
49
|
+
MIT (webpack):
|
|
50
|
+
The following files embed [webpack](https://github.com/webpack/webpack) MIT:
|
|
51
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroContainerEntryModule.ts`,
|
|
52
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroContainerPlugin.ts`,
|
|
53
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroContainerReferencePlugin.ts`,
|
|
54
|
+
`/packages/taro-webpack5-prebundle/src/webpack/TaroModuleFederationPlugin.ts`
|
|
55
|
+
See `/LICENSE` for details of the license.
|
|
56
|
+
|
|
57
|
+
==================
|
|
58
|
+
|
|
59
|
+
MIT (sizzle):
|
|
60
|
+
The following files embed [sizzle](https://github.com/jquery/sizzle) MIT:
|
|
61
|
+
`/packages/taro-extends/src/jquery/sizzle.js`
|
|
62
|
+
See `/LICENSE.txt` for details of the license.
|
|
63
|
+
|
|
64
|
+
==================
|
|
65
|
+
|
|
66
|
+
MIT (zepto):
|
|
67
|
+
The following files embed [zepto](https://github.com/madrobby/zepto) MIT:
|
|
68
|
+
`/packages/taro-extends/src/jquery/zepto.js`,
|
|
69
|
+
`/packages/taro-extends/src/jquery/event.js`
|
|
70
|
+
See `/MIT-LICENSE` for details of the license.
|
|
71
|
+
|
|
72
|
+
==================
|
|
73
|
+
|
|
74
|
+
MIT (css-to-react-native):
|
|
75
|
+
The following files embed [css-to-react-native](https://github.com/styled-components/css-to-react-native) MIT:
|
|
76
|
+
`/packages/css-to-react-native/src/css-to-react-native/*`
|
|
77
|
+
See `/LICENSE.md` for details of the license.
|
|
78
|
+
|
|
79
|
+
==================
|
|
80
|
+
|
|
81
|
+
MIT (reactify-wc):
|
|
82
|
+
The following files embed [reactify-wc](https://github.com/BBKolton/reactify-wc) MIT:
|
|
83
|
+
`/packages/taro-components-library-react/src/component-lib/reactify-wc.ts`
|
|
84
|
+
See `/LICENSE` for details of the license.
|
|
85
|
+
|
|
86
|
+
==================
|
|
87
|
+
|
|
88
|
+
MIT (ant-design-mobile-rn):
|
|
89
|
+
The following files embed [ant-design-mobile-rn](https://github.com/ant-design/ant-design-mobile-rn) MIT:
|
|
90
|
+
`/packages/taro-components-rn/src/components/Swiper/carousel.tsx`
|
|
91
|
+
See `/LICENSE` for details of the license.
|
|
92
|
+
|
|
93
|
+
==================
|
|
94
|
+
|
|
95
|
+
MIT (react-wx-images-viewer):
|
|
96
|
+
The following files embed [react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer) MIT:
|
|
97
|
+
`/packages/taro-h5/src/api/media/image/previewImage.ts`
|
|
98
|
+
See `/LICENSE` for details of the license.
|
|
99
|
+
|
|
100
|
+
==================
|
|
101
|
+
|
|
102
|
+
MIT (webpack-contrib/css-loader):
|
|
103
|
+
The following files embed [webpack-contrib/css-loader](https://github.com/webpack-contrib/css-loader) MIT:
|
|
104
|
+
`/packages/taro-rn-style-transformer/src/utils/index.ts`
|
|
105
|
+
See `/LICENSE` for details of the license.
|
|
106
|
+
|
|
107
|
+
==================
|
|
108
|
+
|
|
109
|
+
MIT (react-native):
|
|
110
|
+
The following files embed [react-native](https://github.com/facebook/react-native) MIT:
|
|
111
|
+
`/packages/taro-rn-style-transformer/src/transforms/StyleSheet/*`
|
|
112
|
+
See `/LICENSE` for details of the license.
|
|
113
|
+
|
|
114
|
+
==================
|
|
115
|
+
|
|
116
|
+
MIT (myrne/performance-now):
|
|
117
|
+
The following files embed [myrne/performance-now](https://github.com/myrne/performance-now) MIT:
|
|
118
|
+
`/packages/taro-runtime/src/bom/raf.ts`
|
|
119
|
+
See `/LICENSE` for details of the license.
|
|
120
|
+
|
|
121
|
+
==================
|
|
122
|
+
|
|
123
|
+
Apache (chameleon-api):
|
|
124
|
+
The following files embed [chameleon-api](https://github.com/chameleon-team/chameleon-api) Apache:
|
|
125
|
+
`/packages/taro-h5/src/api/device/clipboard.ts`
|
|
126
|
+
|
|
127
|
+
==================
|
|
128
|
+
|
|
129
|
+
MIT (uni-app):
|
|
130
|
+
The following files embed [uni-app](https://github.com/dcloudio/uni-app) MIT:
|
|
131
|
+
`/packages/taro-components-rn/src/components/Video/index.tsx`
|
|
132
|
+
See `/LICENSE` for details of the license.
|
|
133
|
+
|
|
134
|
+
==================
|
|
135
|
+
|
|
136
|
+
MIT (miniprogram-render):
|
|
137
|
+
The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
|
|
138
|
+
`/packages/taro-plugin-http/src/runtime/Cookie.ts`
|
|
139
|
+
See `/LICENSE` for details of the license.
|
|
140
|
+
|
|
141
|
+
==================
|
|
142
|
+
|
|
143
|
+
MIT (stencil-ds-output-targets):
|
|
144
|
+
The following files embed [stencil-ds-output-targets](https://github.com/ionic-team/stencil-ds-output-targets/) MIT:
|
|
145
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts`
|
|
146
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/case.ts`
|
|
147
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/dev.ts`
|
|
148
|
+
`/packages/taro-components-library-react/src/react-component-lib/utils/index.tsx`
|
|
149
|
+
`/packages/taro-components-library-react/src/react-component-lib/createComponent.tsx`
|
|
150
|
+
`/packages/taro-components-library-react/src/react-component-lib/createOverlayComponent.tsx`
|
|
151
|
+
`/packages/taro-components-library-react/src/react-component-lib/interfaces.ts`
|
|
152
|
+
`/packages/taro-components-library-vue3/src/vue-component-lib/utils.ts`
|
|
153
|
+
See `/LICENSE` for details of the license.
|
|
154
|
+
|
|
155
|
+
==================
|
|
156
|
+
|
|
157
|
+
MIT (weui):
|
|
158
|
+
The following files embed [weui](https://github.com/Tencent/weui) MIT:
|
|
159
|
+
`/packages/taro-components/src/components/*.scss`
|
|
160
|
+
See `/LICENSE.txt` for details of the license.
|
|
161
|
+
|
|
162
|
+
==================
|
|
163
|
+
|
|
164
|
+
Apache-2.0 (intersection-observer):
|
|
165
|
+
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
166
|
+
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
167
|
+
See `/LICENSE.txt` for details of the license.
|
|
168
|
+
|
|
169
|
+
==================
|
|
170
|
+
|
|
171
|
+
MIT (babel-plugin-jsx-dom-expressions):
|
|
172
|
+
The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
|
|
173
|
+
`/packages/babel-plugin-transform-solid-jsx/src/*`
|
|
174
|
+
See `/LICENSE` for details of the license.
|
package/README.md
ADDED
|
File without changes
|
package/bin/taro
ADDED
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const taro_helper_1 = require("@spcsn/taro-helper");
|
|
41
|
+
const taro_service_1 = require("@spcsn/taro-service");
|
|
42
|
+
const minimist_1 = __importDefault(require("minimist"));
|
|
43
|
+
const customCommand_1 = __importDefault(require("./commands/customCommand"));
|
|
44
|
+
const util_1 = require("./util");
|
|
45
|
+
const DISABLE_GLOBAL_CONFIG_COMMANDS = ['global-config', 'doctor', 'update', 'config'];
|
|
46
|
+
const DEFAULT_FRAMEWORK = 'react';
|
|
47
|
+
class CLI {
|
|
48
|
+
constructor(appPath) {
|
|
49
|
+
this.appPath = appPath || process.cwd();
|
|
50
|
+
const majorVersion = parseInt(process.version.substring(1).split('.')[0], 10);
|
|
51
|
+
if (majorVersion < 20) {
|
|
52
|
+
console.warn('Taro 将不再支持 Node.js 小于 20 的版本。请升级 Node.js 至 20 或更高版本。');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
run() {
|
|
56
|
+
return this.parseArgs();
|
|
57
|
+
}
|
|
58
|
+
async parseArgs() {
|
|
59
|
+
var _a;
|
|
60
|
+
const args = (0, minimist_1.default)(process.argv.slice(2), {
|
|
61
|
+
alias: {
|
|
62
|
+
version: ['v'],
|
|
63
|
+
help: ['h'],
|
|
64
|
+
port: ['p'],
|
|
65
|
+
resetCache: ['reset-cache'], // specially for rn, Removes cached files.
|
|
66
|
+
publicPath: ['public-path'], // specially for rn, assets public path.
|
|
67
|
+
bundleOutput: ['bundle-output'], // specially for rn, File name where to store the resulting bundle.
|
|
68
|
+
sourcemapOutput: ['sourcemap-output'], // specially for rn, File name where to store the sourcemap file for resulting bundle.
|
|
69
|
+
sourceMapUrl: ['sourcemap-use-absolute-path'], // specially for rn, Report SourceMapURL using its full path.
|
|
70
|
+
sourcemapSourcesRoot: ['sourcemap-sources-root'], // specially for rn, Path to make sourcemaps sources entries relative to.
|
|
71
|
+
assetsDest: ['assets-dest'], // specially for rn, Directory name where to store assets referenced in the bundle.
|
|
72
|
+
envPrefix: ['env-prefix'],
|
|
73
|
+
},
|
|
74
|
+
boolean: ['version', 'help', 'disable-global-config'],
|
|
75
|
+
default: {
|
|
76
|
+
build: true,
|
|
77
|
+
check: true,
|
|
78
|
+
'inject-global-style': true,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const _ = args._;
|
|
82
|
+
const command = _[0];
|
|
83
|
+
if (command) {
|
|
84
|
+
const appPath = this.appPath;
|
|
85
|
+
const presetsPath = path.resolve(__dirname, 'presets');
|
|
86
|
+
const commandsPath = path.resolve(presetsPath, 'commands');
|
|
87
|
+
const platformsPath = path.resolve(presetsPath, 'platforms');
|
|
88
|
+
const commandPlugins = taro_helper_1.fs.readdirSync(commandsPath);
|
|
89
|
+
const targetPlugin = `${command}.js`;
|
|
90
|
+
// 设置环境变量
|
|
91
|
+
(_a = process.env).NODE_ENV || (_a.NODE_ENV = args.env);
|
|
92
|
+
if (process.env.NODE_ENV === 'undefined' && (command === 'build' || command === 'inspect')) {
|
|
93
|
+
process.env.NODE_ENV = args.watch ? 'development' : 'production';
|
|
94
|
+
}
|
|
95
|
+
args.type || (args.type = args.t);
|
|
96
|
+
// React-only / weapp-first fork:build/inspect 命令未显式指定 --type 时默认 weapp
|
|
97
|
+
if (!args.type && (command === 'build' || command === 'inspect') && typeof args.plugin !== 'string') {
|
|
98
|
+
args.type = 'weapp';
|
|
99
|
+
}
|
|
100
|
+
if (args.type) {
|
|
101
|
+
process.env.TARO_ENV = args.type;
|
|
102
|
+
}
|
|
103
|
+
if (typeof args.plugin === 'string') {
|
|
104
|
+
process.env.TARO_ENV = 'plugin';
|
|
105
|
+
}
|
|
106
|
+
const mode = args.mode || process.env.NODE_ENV;
|
|
107
|
+
// 这里解析 dotenv 以便于 config 解析时能获取 dotenv 配置信息
|
|
108
|
+
const expandEnv = (0, taro_helper_1.dotenvParse)(appPath, args.envPrefix, mode);
|
|
109
|
+
const disableGlobalConfig = !!(args['disable-global-config'] || DISABLE_GLOBAL_CONFIG_COMMANDS.includes(command));
|
|
110
|
+
const configEnv = {
|
|
111
|
+
mode,
|
|
112
|
+
command,
|
|
113
|
+
};
|
|
114
|
+
const config = new taro_service_1.Config({
|
|
115
|
+
appPath: this.appPath,
|
|
116
|
+
disableGlobalConfig: disableGlobalConfig,
|
|
117
|
+
});
|
|
118
|
+
await config.init(configEnv);
|
|
119
|
+
const kernel = new taro_service_1.Kernel({
|
|
120
|
+
appPath,
|
|
121
|
+
presets: [path.resolve(__dirname, '.', 'presets', 'index.js')],
|
|
122
|
+
config,
|
|
123
|
+
plugins: [],
|
|
124
|
+
});
|
|
125
|
+
kernel.optsPlugins || (kernel.optsPlugins = []);
|
|
126
|
+
// 将自定义的 变量 添加到 config.env 中,实现 definePlugin 字段定义
|
|
127
|
+
const initialConfig = kernel.config?.initialConfig;
|
|
128
|
+
if (initialConfig) {
|
|
129
|
+
initialConfig.env = (0, taro_helper_1.patchEnv)(initialConfig, expandEnv);
|
|
130
|
+
}
|
|
131
|
+
if (command === 'doctor') {
|
|
132
|
+
kernel.optsPlugins.push('@tarojs/plugin-doctor');
|
|
133
|
+
}
|
|
134
|
+
else if (commandPlugins.includes(targetPlugin)) {
|
|
135
|
+
// 针对不同的内置命令注册对应的命令插件
|
|
136
|
+
kernel.optsPlugins.push(path.resolve(commandsPath, targetPlugin));
|
|
137
|
+
}
|
|
138
|
+
// 把内置命令插件传递给 kernel,可以暴露给其他插件使用
|
|
139
|
+
kernel.cliCommandsPath = commandsPath;
|
|
140
|
+
kernel.cliCommands = commandPlugins
|
|
141
|
+
.filter((commandFileName) => /^[\w-]+(\.[\w-]+)*\.js$/.test(commandFileName))
|
|
142
|
+
.map((fileName) => fileName.replace(/\.js$/, ''));
|
|
143
|
+
switch (command) {
|
|
144
|
+
case 'inspect':
|
|
145
|
+
case 'build': {
|
|
146
|
+
let plugin;
|
|
147
|
+
let platform = args.type;
|
|
148
|
+
const { publicPath, bundleOutput, sourcemapOutput, sourceMapUrl, sourcemapSourcesRoot, assetsDest } = args;
|
|
149
|
+
// 针对不同的内置平台注册对应的端平台插件
|
|
150
|
+
switch (platform) {
|
|
151
|
+
case 'weapp':
|
|
152
|
+
kernel.optsPlugins.push(`@spcsn/taro-plugin-platform-${platform}`);
|
|
153
|
+
break;
|
|
154
|
+
default: {
|
|
155
|
+
if (platform) {
|
|
156
|
+
console.log('当前 Fork 仅支持微信小程序(weapp)构建。');
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// 根据 framework 启用插件
|
|
163
|
+
const framework = kernel.config?.initialConfig.framework || DEFAULT_FRAMEWORK;
|
|
164
|
+
if (framework !== 'react') {
|
|
165
|
+
console.log('当前 Fork 仅支持 React 框架。');
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
kernel.optsPlugins.push('@spcsn/taro-plugin-framework-react');
|
|
169
|
+
// 编译小程序插件
|
|
170
|
+
if (typeof args.plugin === 'string') {
|
|
171
|
+
plugin = args.plugin;
|
|
172
|
+
if (plugin !== 'weapp') {
|
|
173
|
+
console.log('当前 Fork 仅支持 weapp 小程序插件编译。');
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
platform = 'plugin';
|
|
177
|
+
kernel.optsPlugins.push(path.resolve(platformsPath, 'plugin.js'));
|
|
178
|
+
kernel.optsPlugins.push(`@spcsn/taro-plugin-platform-${plugin}`);
|
|
179
|
+
}
|
|
180
|
+
// 传递 inspect 参数即可
|
|
181
|
+
if (command === 'inspect') {
|
|
182
|
+
(0, customCommand_1.default)(command, kernel, args);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
(0, customCommand_1.default)(command, kernel, {
|
|
186
|
+
args,
|
|
187
|
+
_,
|
|
188
|
+
platform,
|
|
189
|
+
plugin,
|
|
190
|
+
isWatch: Boolean(args.watch),
|
|
191
|
+
// Note: 是否把 Taro 组件编译为原生自定义组件
|
|
192
|
+
isBuildNativeComp: _[1] === 'native-components',
|
|
193
|
+
// Note: 新的混合编译模式,支持把组件单独编译为原生组件
|
|
194
|
+
newBlended: Boolean(args['new-blended']),
|
|
195
|
+
// Note: 是否禁用编译
|
|
196
|
+
withoutBuild: !args.build,
|
|
197
|
+
noInjectGlobalStyle: !args['inject-global-style'],
|
|
198
|
+
noCheck: !args.check,
|
|
199
|
+
port: args.port,
|
|
200
|
+
env: args.env,
|
|
201
|
+
deviceType: args.platform,
|
|
202
|
+
resetCache: !!args.resetCache,
|
|
203
|
+
publicPath,
|
|
204
|
+
bundleOutput,
|
|
205
|
+
sourcemapOutput,
|
|
206
|
+
sourceMapUrl,
|
|
207
|
+
sourcemapSourcesRoot,
|
|
208
|
+
assetsDest,
|
|
209
|
+
qr: !!args.qr,
|
|
210
|
+
blended: Boolean(args.blended),
|
|
211
|
+
h: args.h,
|
|
212
|
+
});
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
case 'init': {
|
|
216
|
+
(0, customCommand_1.default)(command, kernel, {
|
|
217
|
+
_,
|
|
218
|
+
appPath,
|
|
219
|
+
projectName: _[1] || args.name,
|
|
220
|
+
description: args.description,
|
|
221
|
+
typescript: args.typescript,
|
|
222
|
+
buildEs5: args['build-es5'],
|
|
223
|
+
framework: args.framework,
|
|
224
|
+
compiler: args.compiler,
|
|
225
|
+
npm: args.npm,
|
|
226
|
+
templateSource: args['template-source'],
|
|
227
|
+
clone: !!args.clone,
|
|
228
|
+
template: args.template,
|
|
229
|
+
css: args.css,
|
|
230
|
+
autoInstall: args.autoInstall,
|
|
231
|
+
h: args.h,
|
|
232
|
+
});
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
default:
|
|
236
|
+
(0, customCommand_1.default)(command, kernel, args);
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
if (args.h) {
|
|
242
|
+
console.log('Usage: taro <command> [options]');
|
|
243
|
+
console.log();
|
|
244
|
+
console.log('Options:');
|
|
245
|
+
console.log(' -v, --version output the version number');
|
|
246
|
+
console.log(' -h, --help output usage information');
|
|
247
|
+
console.log();
|
|
248
|
+
console.log('Commands:');
|
|
249
|
+
console.log(' init [projectName] Init a project with default templete');
|
|
250
|
+
console.log(' config <cmd> Taro config');
|
|
251
|
+
console.log(' create Create page for project');
|
|
252
|
+
console.log(' build Build a project with options');
|
|
253
|
+
console.log(' update Update packages of taro');
|
|
254
|
+
console.log(' info Diagnostics Taro env info');
|
|
255
|
+
console.log(' doctor Diagnose taro project');
|
|
256
|
+
console.log(' inspect Inspect the webpack config');
|
|
257
|
+
console.log(' help [cmd] display help for [cmd]');
|
|
258
|
+
}
|
|
259
|
+
else if (args.v) {
|
|
260
|
+
console.log((0, util_1.getPkgVersion)());
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.default = CLI;
|
|
266
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;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gBAC3D,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;gBAChE,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;YAC9D,CAAC;iBAAM,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;gBAClB,OAAO,CAAC,GAAG,CAAC,IAAA,oBAAa,GAAE,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAnOD,sBAmOC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = customCommand;
|
|
4
|
+
function customCommand(command, kernel, args) {
|
|
5
|
+
if (typeof command === 'string') {
|
|
6
|
+
const options = {};
|
|
7
|
+
const excludeKeys = ['_', 'version', 'v', 'help', 'h', 'disable-global-config'];
|
|
8
|
+
Object.keys(args).forEach((key) => {
|
|
9
|
+
if (!excludeKeys.includes(key)) {
|
|
10
|
+
options[key] = args[key];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
kernel.run({
|
|
14
|
+
name: command,
|
|
15
|
+
opts: {
|
|
16
|
+
_: args._,
|
|
17
|
+
options,
|
|
18
|
+
isHelp: args.h,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=customCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customCommand.js","sourceRoot":"","sources":["../../src/commands/customCommand.ts"],"names":[],"mappings":";;AAEA,gCAmBC;AAnBD,SAAwB,aAAa,CAAC,OAAe,EAAE,MAAc,EAAE,IAAyC;IAC9G,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,OAAO,GAAQ,EAAE,CAAC;QACxB,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,CAAC,CAAC;QAChF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,GAAG,CAAC;YACT,IAAI,EAAE,OAAO;YACb,IAAI,EAAE;gBACJ,CAAC,EAAE,IAAI,CAAC,CAAC;gBACT,OAAO;gBACP,MAAM,EAAE,IAAI,CAAC,CAAC;aACf;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,OAAO;IACjB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;CACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const packagesManagement: {
|
|
2
|
+
yarn: {
|
|
3
|
+
command: string;
|
|
4
|
+
globalCommand: string;
|
|
5
|
+
};
|
|
6
|
+
pnpm: {
|
|
7
|
+
command: string;
|
|
8
|
+
globalCommand: string;
|
|
9
|
+
};
|
|
10
|
+
cnpm: {
|
|
11
|
+
command: string;
|
|
12
|
+
globalCommand: string;
|
|
13
|
+
};
|
|
14
|
+
npm: {
|
|
15
|
+
command: string;
|
|
16
|
+
globalCommand: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default packagesManagement;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const packagesManagement = {
|
|
4
|
+
yarn: {
|
|
5
|
+
command: 'yarn install',
|
|
6
|
+
globalCommand: 'yarn global add @spcsn/taro-cli',
|
|
7
|
+
},
|
|
8
|
+
pnpm: {
|
|
9
|
+
command: 'pnpm install',
|
|
10
|
+
globalCommand: 'pnpm add -g @spcsn/taro-cli',
|
|
11
|
+
},
|
|
12
|
+
cnpm: {
|
|
13
|
+
command: 'cnpm install',
|
|
14
|
+
globalCommand: 'cnpm i -g @spcsn/taro-cli',
|
|
15
|
+
},
|
|
16
|
+
npm: {
|
|
17
|
+
command: 'npm install',
|
|
18
|
+
globalCommand: 'npm i -g @spcsn/taro-cli',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
exports.default = packagesManagement;
|
|
22
|
+
//# sourceMappingURL=packagesManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packagesManagement.js","sourceRoot":"","sources":["../../src/config/packagesManagement.ts"],"names":[],"mappings":";;AAAA,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE;QACJ,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,iCAAiC;KACjD;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,6BAA6B;KAC7C;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,2BAA2B;KAC3C;IACD,GAAG,EAAE;QACH,OAAO,EAAE,aAAa;QACtB,aAAa,EAAE,0BAA0B;KAC1C;CACF,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TEMPLATE_CREATOR = "template_creator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/create/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,qBAAqB,CAAC"}
|