@expressots/cli 1.8.0 → 1.8.1
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/bin/new/cli.js +14 -0
- package/bin/new/form.js +7 -4
- package/package.json +6 -5
package/bin/new/cli.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.createProject = void 0;
|
|
4
7
|
const form_1 = require("./form");
|
|
8
|
+
const semver_1 = __importDefault(require("semver"));
|
|
5
9
|
const packageManagers = [
|
|
6
10
|
"npm",
|
|
7
11
|
"yarn",
|
|
@@ -34,12 +38,22 @@ const commandOptions = (yargs) => {
|
|
|
34
38
|
.implies("package-manager", "template")
|
|
35
39
|
.implies("template", "package-manager");
|
|
36
40
|
};
|
|
41
|
+
const checkNodeVersion = () => {
|
|
42
|
+
const minVersion = "18.0.0";
|
|
43
|
+
const maxVersion = "20.7.0";
|
|
44
|
+
const currentVersion = process.version;
|
|
45
|
+
if (!semver_1.default.satisfies(currentVersion, `>=${minVersion} <=${maxVersion}`)) {
|
|
46
|
+
console.error(`Node.js version ${currentVersion} is not supported. Please use a version between ${minVersion} and ${maxVersion}.`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
37
50
|
const createProject = () => {
|
|
38
51
|
return {
|
|
39
52
|
command: "new <project-name> [package-manager] [template] [directory]",
|
|
40
53
|
describe: "Create a new project",
|
|
41
54
|
builder: commandOptions,
|
|
42
55
|
handler: async ({ projectName, packageManager, template, directory, }) => {
|
|
56
|
+
checkNodeVersion();
|
|
43
57
|
return await (0, form_1.projectForm)(projectName, [
|
|
44
58
|
packageManager,
|
|
45
59
|
template,
|
package/bin/new/form.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.projectForm = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
9
|
const cli_progress_1 = require("cli-progress");
|
|
10
10
|
const degit_1 = __importDefault(require("degit"));
|
|
11
11
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
@@ -19,10 +19,13 @@ async function packageManagerInstall({ packageManager, directory, progressBar, }
|
|
|
19
19
|
const command = isWindows
|
|
20
20
|
? `${packageManager}.cmd`
|
|
21
21
|
: packageManager;
|
|
22
|
-
const installProcess = (0,
|
|
22
|
+
const installProcess = (0, node_child_process_1.spawn)(command, ["install"], {
|
|
23
23
|
cwd: directory,
|
|
24
24
|
});
|
|
25
|
-
installProcess.
|
|
25
|
+
installProcess.on("error", (error) => {
|
|
26
|
+
reject(new Error(`Failed to start subprocess: ${error.message}`));
|
|
27
|
+
});
|
|
28
|
+
installProcess.stdout?.on("data", (data) => {
|
|
26
29
|
const output = data.toString().trim();
|
|
27
30
|
const npmProgressMatch = output.match(/\[(\d+)\/(\d+)\] (?:npm )?([\w\s]+)\.{3}/);
|
|
28
31
|
if (npmProgressMatch) {
|
|
@@ -46,7 +49,7 @@ async function packageManagerInstall({ packageManager, directory, progressBar, }
|
|
|
46
49
|
}
|
|
47
50
|
async function checkIfPackageManagerExists(packageManager) {
|
|
48
51
|
try {
|
|
49
|
-
(0,
|
|
52
|
+
(0, node_child_process_1.execSync)(`${packageManager} --version`);
|
|
50
53
|
return true;
|
|
51
54
|
}
|
|
52
55
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"expressots": "bin/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=18.
|
|
14
|
+
"node": ">=18.18.0"
|
|
15
15
|
},
|
|
16
16
|
"funding": {
|
|
17
17
|
"type": "github",
|
|
@@ -52,16 +52,17 @@
|
|
|
52
52
|
"@expressots/boost-ts": "1.1.1",
|
|
53
53
|
"chalk-animation": "2.0.3",
|
|
54
54
|
"cli-progress": "3.11.2",
|
|
55
|
-
"cli-table3": "
|
|
55
|
+
"cli-table3": "0.6.4",
|
|
56
56
|
"degit": "2.8.4",
|
|
57
|
-
"glob": "10.
|
|
57
|
+
"glob": "10.4.1",
|
|
58
58
|
"inquirer": "8.0.0",
|
|
59
59
|
"mustache": "4.2.0",
|
|
60
|
+
"semver": "7.6.2",
|
|
60
61
|
"ts-node": "10.9.1",
|
|
61
62
|
"yargs": "17.6.2"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@codecov/vite-plugin": "0.0.1-beta.
|
|
65
|
+
"@codecov/vite-plugin": "^0.0.1-beta.9",
|
|
65
66
|
"@commitlint/cli": "19.2.1",
|
|
66
67
|
"@commitlint/config-conventional": "19.1.0",
|
|
67
68
|
"@release-it/conventional-changelog": "7.0.2",
|