@htyf-mp/cli 0.0.11 → 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 +30 -24
- 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 {
|
|
@@ -146,46 +146,52 @@ async function main() {
|
|
|
146
146
|
const game_path = path.join('./', `${appName}`, `${gameTempPath}`)
|
|
147
147
|
const cli_path = path.join('./', `${appName}`, `cli`)
|
|
148
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`)
|
|
149
151
|
try {
|
|
150
152
|
if (tempType === 'taro') {
|
|
151
153
|
appRootPath = taro_path
|
|
152
|
-
|
|
153
|
-
await execa('rm', ['-r', `${game_path}`])
|
|
154
|
+
fse.removeSync(game_path)
|
|
154
155
|
}
|
|
155
156
|
if (tempType === 'expo') {
|
|
156
157
|
appRootPath = expo_path
|
|
157
|
-
|
|
158
|
-
await execa('rm', ['-r', `${game_path}`])
|
|
158
|
+
fse.removeSync(game_path)
|
|
159
159
|
}
|
|
160
160
|
if (tempType === 'game-cocos') {
|
|
161
161
|
appRootPath = game_path
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
fse.removeSync(taro_path)
|
|
163
|
+
fse.removeSync(expo_path)
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
fse.removeSync(cli_path)
|
|
166
|
+
fse.removeSync(git_path)
|
|
167
|
+
fse.removeSync(docs_path)
|
|
168
|
+
fse.removeSync(README_path)
|
|
167
169
|
} catch (err) {}
|
|
168
170
|
const __TEMP_PATH__ = path.join(appRootPath, '__TEMP__');
|
|
169
171
|
const pkg_path = path.join(appRootPath, './package.json');
|
|
170
172
|
const dgzJosn = path.join(`${appRootPath}`, 'project.dgz.json')
|
|
173
|
+
console.log(' ')
|
|
174
|
+
console.log(tempType)
|
|
175
|
+
console.log(__TEMP_PATH__)
|
|
176
|
+
console.log(' ')
|
|
171
177
|
if (tempType === 'taro') {
|
|
172
|
-
fse.
|
|
178
|
+
fse.copySync(
|
|
173
179
|
path.join(__TEMP_PATH__, 'taro_src'),
|
|
174
180
|
path.join(appRootPath, './src')
|
|
175
181
|
)
|
|
176
|
-
fse.
|
|
182
|
+
fse.copySync(
|
|
177
183
|
path.join(__TEMP_PATH__, 'taro.App.tsx'),
|
|
178
184
|
path.join(appRootPath, './App.tsx')
|
|
179
185
|
)
|
|
180
|
-
fse.
|
|
186
|
+
fse.copySync(
|
|
181
187
|
path.join(__TEMP_PATH__, 'taro.index.js'),
|
|
182
188
|
path.join(appRootPath, './index.js')
|
|
183
189
|
)
|
|
184
|
-
fse.
|
|
185
|
-
path.join(__TEMP_PATH__, 'taro.
|
|
186
|
-
path.join(appRootPath, './
|
|
190
|
+
fse.copySync(
|
|
191
|
+
path.join(__TEMP_PATH__, 'taro.babel.config.js'),
|
|
192
|
+
path.join(appRootPath, './babel.config.js')
|
|
187
193
|
)
|
|
188
|
-
fse.
|
|
194
|
+
fse.copySync(
|
|
189
195
|
path.join(__TEMP_PATH__, 'taro.project.dgz.json'),
|
|
190
196
|
path.join(appRootPath, './project.dgz.json')
|
|
191
197
|
)
|
|
@@ -216,23 +222,23 @@ async function main() {
|
|
|
216
222
|
fse.writeJSONSync(pkg_path, JSON.stringify(pkg_info, undefined, 2))
|
|
217
223
|
}
|
|
218
224
|
if (tempType === 'expo') {
|
|
219
|
-
fse.
|
|
225
|
+
fse.copySync(
|
|
220
226
|
path.join(__TEMP_PATH__, 'expo_src'),
|
|
221
227
|
path.join(appRootPath, './src')
|
|
222
228
|
)
|
|
223
|
-
fse.
|
|
229
|
+
fse.copySync(
|
|
224
230
|
path.join(__TEMP_PATH__, 'expo.App.tsx'),
|
|
225
231
|
path.join(appRootPath, './App.tsx')
|
|
226
232
|
)
|
|
227
|
-
fse.
|
|
233
|
+
fse.copySync(
|
|
228
234
|
path.join(__TEMP_PATH__, 'expo.index.js'),
|
|
229
235
|
path.join(appRootPath, './index.js')
|
|
230
236
|
)
|
|
231
|
-
fse.
|
|
232
|
-
path.join(__TEMP_PATH__, 'expo.
|
|
233
|
-
path.join(appRootPath, './
|
|
237
|
+
fse.copySync(
|
|
238
|
+
path.join(__TEMP_PATH__, 'expo.babel.config.js'),
|
|
239
|
+
path.join(appRootPath, './babel.config.js')
|
|
234
240
|
)
|
|
235
|
-
fse.
|
|
241
|
+
fse.copySync(
|
|
236
242
|
path.join(__TEMP_PATH__, 'expo.project.dgz.json'),
|
|
237
243
|
path.join(appRootPath, './project.dgz.json')
|
|
238
244
|
)
|
|
@@ -244,7 +250,7 @@ async function main() {
|
|
|
244
250
|
fs.writeFileSync(dgzJosn, JSON.stringify(config, undefined, 2))
|
|
245
251
|
console.log(dgzJosn)
|
|
246
252
|
|
|
247
|
-
fse.removeSync(
|
|
253
|
+
fse.removeSync(__TEMP_PATH__)
|
|
248
254
|
|
|
249
255
|
spinner.text = ''
|
|
250
256
|
|