create-packer 1.43.2 → 1.43.4
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
CHANGED
|
@@ -13,10 +13,10 @@ pnpx create-packer <. || dirname>
|
|
|
13
13
|
## TempInfo
|
|
14
14
|
|
|
15
15
|
- nest: Based on [nestjs](https://docs.nestjs.com/).
|
|
16
|
-
- web-app/vue: Based on [vite
|
|
17
|
-
- web-app/
|
|
18
|
-
- web-app/react-
|
|
19
|
-
- web-app/react-rsbuild: Based on [rsbuild
|
|
16
|
+
- web-app/vue: Based on [vite](https://cn.vitejs.dev/), [vue3](https://vuejs.org/).
|
|
17
|
+
- web-app/vue-rsbuild: Based on [rsbuild](https://rsbuild.dev/), [vite](https://cn.vitejs.dev/), [vue3](https://vuejs.org/).
|
|
18
|
+
- web-app/react-vite: Based on [vite](https://cn.vitejs.dev/), [react](https://reactjs.org/).
|
|
19
|
+
- web-app/react-rsbuild: Based on [rsbuild](https://rsbuild.dev/), [react](https://reactjs.org/).
|
|
20
20
|
- lib/workspace: Quickly Building a Private Library Infrastructure. Based on [pnpm-workspace](https://pnpm.io/pnpm-workspace_yaml).
|
|
21
21
|
- cli: template-cli
|
|
22
22
|
- web-extension: Web browser extension template. Support HMR.
|
package/bin/createTemp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import chalk from 'chalk'
|
|
2
|
-
import * as inquirer from '@inquirer/prompts'
|
|
3
|
-
import * as fsExtra from 'fs-extra'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
|
-
import ora from 'ora'
|
|
7
|
-
import { spawnSync } from 'child_process'
|
|
8
|
-
import { genTemplateInfoList, onGenCommand } from './utils/index.js'
|
|
9
|
-
import { existsSync } from 'fs'
|
|
10
|
-
|
|
11
|
-
const cwd = process.cwd()
|
|
12
|
-
const command = onGenCommand()
|
|
13
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
14
|
-
const excludes = ['node_modules', 'yarn-error.log', 'dist']
|
|
15
|
-
const tempRoot = path.join(dirname, '../template')
|
|
16
|
-
const tempInfoList = genTemplateInfoList(tempRoot)
|
|
17
|
-
|
|
18
|
-
function copyTempFile(tempPath, output) {
|
|
19
|
-
fsExtra.readdirSync(tempPath).map(name => {
|
|
20
|
-
if (!excludes.includes(name)) {
|
|
21
|
-
fsExtra.copySync(path.join(tempPath, name), path.join(output, name))
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
function createTempEnd(output: string) {
|
|
26
|
-
spawnSync(command, ['install'], {
|
|
27
|
-
cwd: output,
|
|
28
|
-
stdio: 'inherit'
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import * as inquirer from '@inquirer/prompts'
|
|
3
|
+
import * as fsExtra from 'fs-extra'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import ora from 'ora'
|
|
7
|
+
import { spawnSync } from 'child_process'
|
|
8
|
+
import { genTemplateInfoList, onGenCommand } from './utils/index.js'
|
|
9
|
+
import { existsSync } from 'fs'
|
|
10
|
+
|
|
11
|
+
const cwd = process.cwd()
|
|
12
|
+
const command = onGenCommand()
|
|
13
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
14
|
+
const excludes = ['node_modules', 'yarn-error.log', 'dist']
|
|
15
|
+
const tempRoot = path.join(dirname, '../template')
|
|
16
|
+
const tempInfoList = genTemplateInfoList(tempRoot)
|
|
17
|
+
|
|
18
|
+
function copyTempFile(tempPath, output) {
|
|
19
|
+
fsExtra.readdirSync(tempPath).map(name => {
|
|
20
|
+
if (!excludes.includes(name)) {
|
|
21
|
+
fsExtra.copySync(path.join(tempPath, name), path.join(output, name))
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
function createTempEnd(output: string) {
|
|
26
|
+
spawnSync(command, ['install'], {
|
|
27
|
+
cwd: output,
|
|
28
|
+
stdio: 'inherit',
|
|
29
|
+
shell: true
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function createTemp(dirname: string) {
|
|
34
|
+
const isCurrent = dirname === '.'
|
|
35
|
+
let answer = await inquirer.select<string>({
|
|
36
|
+
message: 'Select temp.',
|
|
37
|
+
choices: tempInfoList.map(o => o.name)
|
|
38
|
+
})
|
|
39
|
+
let tempInfo = tempInfoList.find(o => o.name === answer)
|
|
40
|
+
if (tempInfo?.children && tempInfo.children.length > 0) {
|
|
41
|
+
answer = await inquirer.select({
|
|
42
|
+
message: 'Select temp type.',
|
|
43
|
+
choices: tempInfo.children.map(o => o.name)
|
|
44
|
+
})
|
|
45
|
+
tempInfo = tempInfo.children.find(o => o.name === answer)
|
|
46
|
+
}
|
|
47
|
+
const creating = ora(chalk.yellow('Creating...\n')).start()
|
|
48
|
+
const output = path.join(cwd, isCurrent ? '' : dirname)
|
|
49
|
+
if (!isCurrent && existsSync(output)) {
|
|
50
|
+
return console.log(chalk.red(`${dirname} already exists!`))
|
|
51
|
+
}
|
|
52
|
+
if (!isCurrent) {
|
|
53
|
+
fsExtra.mkdirSync(output)
|
|
54
|
+
}
|
|
55
|
+
copyTempFile(tempInfo!.src, output)
|
|
56
|
+
createTempEnd(output)
|
|
57
|
+
creating.succeed()
|
|
58
|
+
}
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"axios": "1.7.9",
|
|
23
|
-
"cross-env": "7.0.3",
|
|
24
23
|
"define-zustand": "3.2.1",
|
|
25
24
|
"immer": "10.0.1",
|
|
26
25
|
"lodash-es": "4.17.21",
|
|
@@ -52,6 +51,7 @@
|
|
|
52
51
|
"@types/react-dom": "18.3.0",
|
|
53
52
|
"autoprefixer": "10.4.14",
|
|
54
53
|
"commitizen": "4.3.0",
|
|
54
|
+
"cross-env": "7.0.3",
|
|
55
55
|
"cssnano": "6.0.0",
|
|
56
56
|
"eslint": "9.17.0",
|
|
57
57
|
"eslint-import-resolver-typescript": "3.7.0",
|