create-packer 1.43.3 → 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(4.x)](https://cn.vitejs.dev/), [vue3](https://vuejs.org/).
17
- - web-app/react-vite: Based on [vite(4.x)](https://cn.vitejs.dev/), [react18](https://reactjs.org/).
18
- - web-app/react-webpack: Based on [webpack(5.x)](https://webpack.js.org/), [react18](https://reactjs.org/).
19
- - web-app/react-rsbuild: Based on [rsbuild(1.x)](https://rsbuild.dev/), [react18](https://reactjs.org/).
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
@@ -23,7 +23,8 @@ function copyTempFile(tempPath, output) {
23
23
  function createTempEnd(output) {
24
24
  spawnSync(command, ['install'], {
25
25
  cwd: output,
26
- stdio: 'inherit'
26
+ stdio: 'inherit',
27
+ shell: true
27
28
  });
28
29
  }
29
30
  export async function createTemp(dirname) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.43.3",
3
+ "version": "1.43.4",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -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
- export async function createTemp(dirname: string) {
33
- const isCurrent = dirname === '.'
34
- let answer = await inquirer.select<string>({
35
- message: 'Select temp.',
36
- choices: tempInfoList.map(o => o.name)
37
- })
38
- let tempInfo = tempInfoList.find(o => o.name === answer)
39
- if (tempInfo?.children && tempInfo.children.length > 0) {
40
- answer = await inquirer.select({
41
- message: 'Select temp type.',
42
- choices: tempInfo.children.map(o => o.name)
43
- })
44
- tempInfo = tempInfo.children.find(o => o.name === answer)
45
- }
46
- const creating = ora(chalk.yellow('Creating...\n')).start()
47
- const output = path.join(cwd, isCurrent ? '' : dirname)
48
- if (!isCurrent && existsSync(output)) {
49
- return console.log(chalk.red(`${dirname} already exists!`))
50
- }
51
- if (!isCurrent) {
52
- fsExtra.mkdirSync(output)
53
- }
54
- copyTempFile(tempInfo!.src, output)
55
- createTempEnd(output)
56
- creating.succeed()
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
+ }