@htyf-mp/cli 0.0.1 → 0.0.3

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/cli.js +17 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ npx @htyf-mp/cli
14
14
 
15
15
  ### 运行应用程序
16
16
 
17
- 进入`mini-apps-template-rn`或`mini-apps-template-taro`目录并运行:
17
+ 进入`mini-apps-template-rn`或`mini-apps-template-taro`或`mini-game-template-cocos`目录并运行:
18
18
  > 具体模板使用,可参考模板内的README.md
19
19
  ```sh
20
20
  npm start
package/cli.js CHANGED
@@ -26,6 +26,7 @@ const repoUrl = 'https://github.com/htyf-mp-community/htyf-mp.git'
26
26
 
27
27
  const taroTempPath = 'mini-apps-template-taro';
28
28
  const rnTempPath = 'mini-apps-template-rn';
29
+ const gameTempPath = 'mini-game-template-cocos';
29
30
 
30
31
  const isYarnInstalled = () => {
31
32
  try {
@@ -100,6 +101,10 @@ async function main() {
100
101
  {
101
102
  name: 'ReactNative',
102
103
  value: 'react-native',
104
+ },
105
+ {
106
+ name: 'Game',
107
+ value: 'game-cocos',
103
108
  }
104
109
  ]
105
110
  })
@@ -124,10 +129,17 @@ async function main() {
124
129
  if (tempType === 'taro') {
125
130
  appRootPath = `${appName}/${taroTempPath}`
126
131
  await execa('rm', ['-r', `${appName}/${rnTempPath}`])
132
+ await execa('rm', ['-r', `${appName}/${gameTempPath}`])
127
133
  }
128
134
  if (tempType === 'react-native') {
129
135
  appRootPath = `${appName}/${rnTempPath}`
130
136
  await execa('rm', ['-r', `${appName}/${taroTempPath}`])
137
+ await execa('rm', ['-r', `${appName}/${gameTempPath}`])
138
+ }
139
+ if (tempType === 'game-cocos') {
140
+ appRootPath = `${appName}/${gameTempPath}`
141
+ await execa('rm', ['-r', `${appName}/${rnTempPath}`])
142
+ await execa('rm', ['-r', `${appName}/${taroTempPath}`])
131
143
  }
132
144
  await execa('rm', ['-r', `${appName}/cli`])
133
145
  await execa('rm', ['-rf', `${appName}/.git`])
@@ -143,6 +155,11 @@ async function main() {
143
155
  fs.writeFileSync(dgzJosn, JSON.stringify(config, undefined, 2))
144
156
  console.log(dgzJosn)
145
157
  }
158
+ if (tempType === 'game-cocos') {
159
+ const dgzJosn = `${appRootPath}/project.dgz.json`
160
+ fs.writeFileSync(dgzJosn, JSON.stringify(config, undefined, 2))
161
+ console.log(dgzJosn)
162
+ }
146
163
 
147
164
 
148
165
  spinner.text = ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": "cli.js",