@htyf-mp/cli 0.0.10 → 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/cli.js +38 -25
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ const codingRepoUrl = 'https://e.coding.net/dagouzhi/hongtangyun_mobile/htyf-mp.
|
|
|
28
28
|
|
|
29
29
|
const taroTempPath = 'mini-apps-template';
|
|
30
30
|
const expoTempPath = 'mini-apps-template';
|
|
31
|
-
const gameTempPath = 'mini-game-template
|
|
31
|
+
const gameTempPath = 'mini-game-template';
|
|
32
32
|
|
|
33
33
|
const isYarnInstalled = () => {
|
|
34
34
|
try {
|
|
@@ -141,44 +141,57 @@ async function main() {
|
|
|
141
141
|
spinner.start()
|
|
142
142
|
await execa('git', ['clone', repoType, appName])
|
|
143
143
|
let appRootPath = '';
|
|
144
|
+
const taro_path = path.join('./', `${appName}`, `${taroTempPath}`)
|
|
145
|
+
const expo_path = path.join('./', `${appName}`, `${expoTempPath}`)
|
|
146
|
+
const game_path = path.join('./', `${appName}`, `${gameTempPath}`)
|
|
147
|
+
const cli_path = path.join('./', `${appName}`, `cli`)
|
|
148
|
+
const git_path = path.join('./', `${appName}`, `.git`)
|
|
149
|
+
const docs_path = path.join('./', `${appName}`, `docs`)
|
|
150
|
+
const README_path = path.join('./', `${appName}`, `README.md`)
|
|
144
151
|
try {
|
|
145
152
|
if (tempType === 'taro') {
|
|
146
|
-
appRootPath =
|
|
147
|
-
|
|
153
|
+
appRootPath = taro_path
|
|
154
|
+
fse.removeSync(game_path)
|
|
148
155
|
}
|
|
149
156
|
if (tempType === 'expo') {
|
|
150
|
-
appRootPath =
|
|
151
|
-
|
|
157
|
+
appRootPath = expo_path
|
|
158
|
+
fse.removeSync(game_path)
|
|
152
159
|
}
|
|
153
160
|
if (tempType === 'game-cocos') {
|
|
154
|
-
appRootPath =
|
|
155
|
-
|
|
156
|
-
|
|
161
|
+
appRootPath = game_path
|
|
162
|
+
fse.removeSync(taro_path)
|
|
163
|
+
fse.removeSync(expo_path)
|
|
157
164
|
}
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
fse.removeSync(cli_path)
|
|
166
|
+
fse.removeSync(git_path)
|
|
167
|
+
fse.removeSync(docs_path)
|
|
168
|
+
fse.removeSync(README_path)
|
|
160
169
|
} catch (err) {}
|
|
161
170
|
const __TEMP_PATH__ = path.join(appRootPath, '__TEMP__');
|
|
162
171
|
const pkg_path = path.join(appRootPath, './package.json');
|
|
163
172
|
const dgzJosn = path.join(`${appRootPath}`, 'project.dgz.json')
|
|
173
|
+
console.log(' ')
|
|
174
|
+
console.log(tempType)
|
|
175
|
+
console.log(__TEMP_PATH__)
|
|
176
|
+
console.log(' ')
|
|
164
177
|
if (tempType === 'taro') {
|
|
165
|
-
fse.
|
|
178
|
+
fse.copySync(
|
|
166
179
|
path.join(__TEMP_PATH__, 'taro_src'),
|
|
167
180
|
path.join(appRootPath, './src')
|
|
168
181
|
)
|
|
169
|
-
fse.
|
|
182
|
+
fse.copySync(
|
|
170
183
|
path.join(__TEMP_PATH__, 'taro.App.tsx'),
|
|
171
184
|
path.join(appRootPath, './App.tsx')
|
|
172
185
|
)
|
|
173
|
-
fse.
|
|
186
|
+
fse.copySync(
|
|
174
187
|
path.join(__TEMP_PATH__, 'taro.index.js'),
|
|
175
188
|
path.join(appRootPath, './index.js')
|
|
176
189
|
)
|
|
177
|
-
fse.
|
|
178
|
-
path.join(__TEMP_PATH__, 'taro.
|
|
179
|
-
path.join(appRootPath, './
|
|
190
|
+
fse.copySync(
|
|
191
|
+
path.join(__TEMP_PATH__, 'taro.babel.config.js'),
|
|
192
|
+
path.join(appRootPath, './babel.config.js')
|
|
180
193
|
)
|
|
181
|
-
fse.
|
|
194
|
+
fse.copySync(
|
|
182
195
|
path.join(__TEMP_PATH__, 'taro.project.dgz.json'),
|
|
183
196
|
path.join(appRootPath, './project.dgz.json')
|
|
184
197
|
)
|
|
@@ -209,23 +222,23 @@ async function main() {
|
|
|
209
222
|
fse.writeJSONSync(pkg_path, JSON.stringify(pkg_info, undefined, 2))
|
|
210
223
|
}
|
|
211
224
|
if (tempType === 'expo') {
|
|
212
|
-
fse.
|
|
225
|
+
fse.copySync(
|
|
213
226
|
path.join(__TEMP_PATH__, 'expo_src'),
|
|
214
227
|
path.join(appRootPath, './src')
|
|
215
228
|
)
|
|
216
|
-
fse.
|
|
229
|
+
fse.copySync(
|
|
217
230
|
path.join(__TEMP_PATH__, 'expo.App.tsx'),
|
|
218
231
|
path.join(appRootPath, './App.tsx')
|
|
219
232
|
)
|
|
220
|
-
fse.
|
|
233
|
+
fse.copySync(
|
|
221
234
|
path.join(__TEMP_PATH__, 'expo.index.js'),
|
|
222
235
|
path.join(appRootPath, './index.js')
|
|
223
236
|
)
|
|
224
|
-
fse.
|
|
225
|
-
path.join(__TEMP_PATH__, 'expo.
|
|
226
|
-
path.join(appRootPath, './
|
|
237
|
+
fse.copySync(
|
|
238
|
+
path.join(__TEMP_PATH__, 'expo.babel.config.js'),
|
|
239
|
+
path.join(appRootPath, './babel.config.js')
|
|
227
240
|
)
|
|
228
|
-
fse.
|
|
241
|
+
fse.copySync(
|
|
229
242
|
path.join(__TEMP_PATH__, 'expo.project.dgz.json'),
|
|
230
243
|
path.join(appRootPath, './project.dgz.json')
|
|
231
244
|
)
|
|
@@ -237,7 +250,7 @@ async function main() {
|
|
|
237
250
|
fs.writeFileSync(dgzJosn, JSON.stringify(config, undefined, 2))
|
|
238
251
|
console.log(dgzJosn)
|
|
239
252
|
|
|
240
|
-
fse.removeSync(
|
|
253
|
+
fse.removeSync(__TEMP_PATH__)
|
|
241
254
|
|
|
242
255
|
spinner.text = ''
|
|
243
256
|
|