@d-zero/create-frontend 5.0.0-beta.10 → 5.0.0-beta.12
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/CHANGELOG.md +12 -0
- package/command.js +48 -0
- package/package.json +4 -3
- package/plopfile.js +7 -19
- package/volta-install-node.js +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-beta.12](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.11...v5.0.0-beta.12) (2025-10-20)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **create-frontend:** add volta and node installation support ([29e4fff](https://github.com/d-zero-dev/frontend-env/commit/29e4fff6af41be56397ba25f699e946a1f16c10a))
|
|
11
|
+
|
|
12
|
+
# [5.0.0-beta.11](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.10...v5.0.0-beta.11) (2025-10-20)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **create-frontend:** improve command execution and add volta setup ([e54a526](https://github.com/d-zero-dev/frontend-env/commit/e54a526da7629a9b86fb6d5a53f0aaba72118d9b))
|
|
17
|
+
|
|
6
18
|
# [5.0.0-beta.10](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.9...v5.0.0-beta.10) (2025-10-20)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/command.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {string} commandName
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @param {import("node:child_process").SpawnOptionsWithoutStdio} options
|
|
8
|
+
* @returns {Promise<string>}
|
|
9
|
+
*/
|
|
10
|
+
export async function command(commandName, args, options) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const child = spawn(commandName, args, options);
|
|
13
|
+
|
|
14
|
+
child.on('error', (error) => {
|
|
15
|
+
reject(error);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
process.on('SIGINT', () => {
|
|
19
|
+
child.kill('SIGINT');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (child.stdout) {
|
|
23
|
+
let returnValue = '';
|
|
24
|
+
|
|
25
|
+
child.stdout.on('data', (data) => {
|
|
26
|
+
returnValue += data.toString();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
child.stdout.on('end', () => {
|
|
30
|
+
resolve(returnValue.trim());
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
child.on('exit', (code) => {
|
|
37
|
+
if (code !== 0) {
|
|
38
|
+
reject(
|
|
39
|
+
new Error(
|
|
40
|
+
`Command "${commandName} ${args.join(' ')}" exited with code ${code}`,
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
resolve('');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/create-frontend",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.12",
|
|
4
4
|
"description": "Create a new frontend project from a scaffolding template",
|
|
5
5
|
"repository": "https://github.com/d-zero-dev/frontend-env.git",
|
|
6
6
|
"author": "D-ZERO Co., Ltd.",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"create-dzero-frontend": "./index.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@d-zero/scaffold": "5.0.0-beta.
|
|
16
|
+
"@d-zero/scaffold": "5.0.0-beta.12",
|
|
17
17
|
"glob": "11.0.3",
|
|
18
18
|
"i18n-js": "4.5.1",
|
|
19
19
|
"ignore": "7.0.5",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/glob": "9.0.0",
|
|
25
|
+
"@types/node": "24.8.1",
|
|
25
26
|
"execa": "9.6.0"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "de95a02067c4c0154eef5217d612b3caf6e8581d"
|
|
28
29
|
}
|
package/plopfile.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
2
|
import path from 'node:path';
|
|
4
3
|
import { argv } from 'node:process';
|
|
@@ -7,9 +6,11 @@ import { globSync } from 'glob';
|
|
|
7
6
|
import ignore from 'ignore';
|
|
8
7
|
import meow from 'meow';
|
|
9
8
|
|
|
9
|
+
import { command } from './command.js';
|
|
10
10
|
import { copyLibraries } from './libraries.js';
|
|
11
11
|
import { t } from './locale.js';
|
|
12
12
|
import { readFileSafe } from './read-file-safe.js';
|
|
13
|
+
import { voltaInstallNode } from './volta-install-node.js';
|
|
13
14
|
|
|
14
15
|
const cli = meow(
|
|
15
16
|
`
|
|
@@ -247,27 +248,14 @@ function answerToConfig(answers) {
|
|
|
247
248
|
*
|
|
248
249
|
* @param dest
|
|
249
250
|
*/
|
|
250
|
-
function installDependencies(dest) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const child = spawn('yarn', ['install'], {
|
|
251
|
+
async function installDependencies(dest) {
|
|
252
|
+
await voltaInstallNode();
|
|
253
|
+
await command('yarn', ['install'], {
|
|
254
254
|
cwd: path.resolve(process.cwd(), dest),
|
|
255
255
|
stdio: 'inherit',
|
|
256
|
+
}).catch(() => {
|
|
257
|
+
throw new Error('Failed to install dependencies');
|
|
256
258
|
});
|
|
257
|
-
|
|
258
|
-
child.on('exit', (code) => {
|
|
259
|
-
if (code === 0) {
|
|
260
|
-
resolve(true);
|
|
261
|
-
} else {
|
|
262
|
-
reject(new Error('Failed to install dependencies'));
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
process.on('SIGINT', () => {
|
|
267
|
-
child.kill('SIGINT');
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
return promise;
|
|
271
259
|
}
|
|
272
260
|
|
|
273
261
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { command } from './command.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export async function voltaInstallNode() {
|
|
10
|
+
const node = await command('nod', ['-v']).catch(() => null);
|
|
11
|
+
if (node) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const pkg = await readFile(path.join(import.meta.dirname, 'package.json'), 'utf8');
|
|
15
|
+
const pkgJson = JSON.parse(pkg);
|
|
16
|
+
const nodeVersion = pkgJson.devDependencies['@types/node'].split('.')[0];
|
|
17
|
+
const volta = await command('volta', ['-v']).catch(() => null);
|
|
18
|
+
if (volta) {
|
|
19
|
+
await command('volta', ['setup'], { stdio: 'inherit' });
|
|
20
|
+
await command('volta', ['install', `node@${nodeVersion}`], { stdio: 'inherit' });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
throw new Error('command not found: "node" or "volta"');
|
|
24
|
+
}
|