init-workspace-cervvaljs 0.2.5 → 0.3.2

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 CHANGED
@@ -1,8 +1,14 @@
1
+ ## 0.3.2 2025-12-15
2
+ - use npm to update pnpm
3
+ - overrides @types/node version to 20.14.6
4
+ ## 0.3.0 2025-10-07
5
+ - eslint 9
6
+ - pnpm 10.18.1
1
7
  ## 0.2.5 2024-06-20
2
8
  - pnpm 9.5.0
3
9
  ## 0.2.4 2024-06-20
4
10
  - node 20.14-0
5
- - pnpm 9.3.0
11
+ - pnpm 9.5.0
6
12
  - Update packages versions
7
13
  ## 0.2.3 2024-01-13
8
14
  - Add Eslint Promise plugin
package/bin/index.js CHANGED
@@ -64,14 +64,14 @@ function initWorkspace(options) {
64
64
  }
65
65
  const nodeMainVersion = Number(nodeVersionStr.substring(0, nodeVersionStr.indexOf(".")));
66
66
  console.info("* Node version", nodeMainVersion, "(" + process.version + ")");
67
- if (nodeMainVersion < 14) {
68
- console.error(FgRed + "Node version 14 or above is required, init aborted", FgReset);
67
+ if (nodeMainVersion < 18) {
68
+ console.error(FgRed + "Node version 18 or above is required, init aborted", FgReset);
69
69
  console.info("1. Install NVM");
70
70
  console.info(" Linux: https://github.com/nvm-sh/nvm");
71
71
  console.info(" Windows: https://github.com/coreybutler/nvm-windows");
72
72
  console.info("2. Install Node");
73
- console.info(" nvm install 18.17.0");
74
- console.info(" nvm use 18.17.0");
73
+ console.info(" nvm install 20.19.5");
74
+ console.info(" nvm use 20.19.5");
75
75
  process.exit(1 /* ErrorCodes.WRONG_NODE */);
76
76
  }
77
77
  // check config files are not already in current folder
@@ -101,9 +101,9 @@ function initWorkspace(options) {
101
101
  }
102
102
  }
103
103
  else {
104
- console.info("* update pnpm : pnpm add -g pnpm" + pnpmFixedVersion);
104
+ console.info("* update pnpm : npm add -g pnpm" + pnpmFixedVersion);
105
105
  if (!(options === null || options === void 0 ? void 0 : options.dry)) {
106
- execSyncWithIo("pnpm add -g pnpm" + pnpmFixedVersion);
106
+ execSyncWithIo("npm add -g pnpm" + pnpmFixedVersion);
107
107
  }
108
108
  }
109
109
  console.info("* display pnpm version : pnpm -v");
@@ -115,7 +115,8 @@ function initWorkspace(options) {
115
115
  }
116
116
  // create configuration files
117
117
  const from = path.resolve(__dirname, "../workspace") + "/_";
118
- for (const cf of configFiles) {
118
+ const workspaceFiles = [...configFiles, "eslint.config.js"];
119
+ for (const cf of workspaceFiles) {
119
120
  console.info("* copy", path.resolve(from + cf), " => ", path.resolve("./" + cf));
120
121
  if (!(options === null || options === void 0 ? void 0 : options.dry)) {
121
122
  fs.copyFileSync(from + cf, "./" + cf);
@@ -145,7 +146,7 @@ function initWorkspace(options) {
145
146
  * parses command arguments and inits workspace in current working directory
146
147
  */
147
148
  function cli() {
148
- const options = { dry: false, update: false, pnpmVersion: "9.5.0" };
149
+ const options = { dry: false, update: false, pnpmVersion: "10.18.1" };
149
150
  const args = process.argv.slice(2);
150
151
  if (args.includes("--dry")) {
151
152
  console.info("* dry mode on");
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "init-workspace-cervvaljs",
3
- "version": "0.2.5",
3
+ "version": "0.3.2",
4
4
  "description": "Cervval.js Init Workspace Command Line Interface",
5
5
  "author": "Cervval",
6
6
  "license": "CC-BY-NC-ND-4.0",
7
7
  "bin": {
8
8
  "init-workspace-cervvaljs": "./bin/index.js"
9
9
  }
10
- }
10
+ }
@@ -0,0 +1,4 @@
1
+ // eslint.config.js
2
+ import cjsEslintConfig from "@cervval.js/eslint-config-cervvaljs";
3
+ import { defineConfig } from "eslint/config";
4
+ export default defineConfig([...cjsEslintConfig]);
@@ -4,32 +4,38 @@
4
4
  "author": "Cervval",
5
5
  "license": "CC-BY-NC-ND-4.0",
6
6
  "engines": {
7
- "node": ">=14"
7
+ "node": ">=18"
8
8
  },
9
9
  "scripts": {
10
- "clean-node-modules": "rimraf **/node_modules",
11
- "clean-locks": "rimraf **/pnpm-lock.yaml",
10
+ "clean-node-modules": "rimraf --glob **/node_modules",
11
+ "clean-locks": "rimraf --glob **/pnpm-lock.yaml",
12
12
  "postinstall": "cwt rewrite-tsconfig-references",
13
13
  "lint": "eslint --ext -r .ts"
14
14
  },
15
+ "pnpm": {
16
+ "overrides": {
17
+ "@types/node": "=20.14.6"
18
+ }
19
+ },
15
20
  "devDependencies": {
16
21
  "@cervval.js/builder": "workspace:latest",
17
22
  "@cervval.js/eslint-config-cervvaljs": "workspace:latest",
18
- "@types/cjs-common": "workspace:latest",
23
+ "@eslint/js": "=9.35.0",
24
+ "@stylistic/eslint-plugin": "=5.3.1",
25
+ "@stylistic/eslint-plugin-ts": "=4.4.1",
19
26
  "@types/chai": "=4.3.7",
27
+ "@types/cjs-common": "workspace:latest",
28
+ "@types/eslint": "=9.6.1",
20
29
  "@types/mocha": "=8.2.2",
30
+ "@typescript-eslint/eslint-plugin": "=8.43.0",
31
+ "@typescript-eslint/parser": "=8.43.0",
32
+ "typescript-eslint": "=8.43.0",
21
33
  "chai": "=4.3.7",
22
- "@typescript-eslint/eslint-plugin": "=6.18.1",
23
- "@typescript-eslint/parser": "=6.18.1",
24
- "eslint": "=8.56.0",
25
- "@types/eslint": "=8.56.2",
26
- "eslint-plugin-cypress": "=2.15.1",
27
- "eslint-plugin-jsdoc": "=48.0.2",
28
- "eslint-plugin-mocha": "=10.2.0",
29
- "eslint-plugin-promise": "=6.1.1"
30
- },
31
- "eslintConfig": {
32
- "extends": "@cervval.js/eslint-config-cervvaljs"
34
+ "eslint": "=9.35.0",
35
+ "eslint-plugin-cypress": "=5.1.1",
36
+ "eslint-plugin-jsdoc": "=56.1.2",
37
+ "eslint-plugin-mocha": "=11.1.0",
38
+ "eslint-plugin-promise": "=7.2.1"
33
39
  },
34
- "version": "0.2.5"
40
+ "version": "0.3.2"
35
41
  }
@@ -3,3 +3,22 @@ packages:
3
3
  - '**'
4
4
  # exclude packages that are inside directories starting with _
5
5
  - '!**/_*/**'
6
+
7
+ # Only packages listed in this array will be able to run install scripts
8
+ onlyBuiltDependencies:
9
+ - core-js
10
+ - cypress
11
+ - dd-trace
12
+ - dtrace-provider
13
+ - oracledb
14
+ - protobufjs
15
+ - cwt
16
+ - ts-patch
17
+
18
+ overrides:
19
+ "@types/node": "20.14.6"
20
+
21
+ # To reduce the risk of installing compromised packages, you can delay the installation of newly published versions.
22
+ # Delay: duration in minutes
23
+ # CJS: 1 day
24
+ minimumReleaseAge: 1440
@@ -1,175 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.cli = void 0;
28
- const child_process_1 = require("child_process");
29
- const fs = __importStar(require("fs"));
30
- const path = __importStar(require("path"));
31
- // console colors
32
- const FgRed = "\x1b[31m";
33
- const FgGreen = "\x1b[32m";
34
- const FgBlue = "\x1b[34m";
35
- const FgReset = "\x1b[0m";
36
- /**
37
- * execSync with standard input outputs
38
- */
39
- function execSyncWithIo(cmd) {
40
- return (0, child_process_1.execSync)(cmd, { stdio: "inherit" });
41
- }
42
- /**
43
- * Init workspace
44
- * install pnpm globally
45
- * create pnpm workspace
46
- * create workspace package.json
47
- * @param options options
48
- * @param options.dry if true, init will be simulated but not executed
49
- * @param options.update if true, init will be done even if config files are already present
50
- * @param options.pnpmVersion if given, fix version of pnpm
51
- */
52
- function initWorkspace(options) {
53
- // check if user is on Windows & current path contains spaces
54
- const operatingSystem = process.platform;
55
- const currentPath = process.cwd();
56
- if (operatingSystem === "win32" && /\s/.test(currentPath)) {
57
- console.error(FgRed + "Your workspace path should not contain any whitespaces when using Windows", FgReset);
58
- process.exit(4 /* ErrorCodes.WRONG_PATH_FORMAT */);
59
- }
60
- // check Node Version
61
- let nodeVersionStr = process.version.toLowerCase();
62
- if (nodeVersionStr.startsWith("v")) {
63
- nodeVersionStr = nodeVersionStr.substring(1);
64
- }
65
- const nodeMainVersion = Number(nodeVersionStr.substring(0, nodeVersionStr.indexOf(".")));
66
- console.info("* Node version", nodeMainVersion, "(" + process.version + ")");
67
- if (nodeMainVersion < 14) {
68
- console.error(FgRed + "Node version 14 or above is required, init aborted", FgReset);
69
- console.info("1. Install NVM");
70
- console.info(" Linux: https://github.com/nvm-sh/nvm");
71
- console.info(" Windows: https://github.com/coreybutler/nvm-windows");
72
- console.info("2. Install Node");
73
- console.info(" nvm install 14.17.0");
74
- console.info(" nvm use 14.17.0");
75
- process.exit(1 /* ErrorCodes.WRONG_NODE */);
76
- }
77
- // check config files are not already in current folder
78
- const configFiles = ["package.json", "pnpm-workspace.yaml"];
79
- {
80
- for (const cf of configFiles) {
81
- if (fs.existsSync("./" + cf)) {
82
- if (!(options === null || options === void 0 ? void 0 : options.update)) {
83
- console.error(FgRed + cf + " found - init cancelled", FgReset);
84
- process.exit(2 /* ErrorCodes.INIT_BUT_FILE_EXISTS */);
85
- }
86
- }
87
- else if (options === null || options === void 0 ? void 0 : options.update) {
88
- console.error(FgRed + cf + " was not found");
89
- console.error(FgRed + "- Are you at the workspace root ?", FgReset);
90
- console.error(FgRed + "- Do you want to initialize a new workspace ? then you need to remove --update", FgReset);
91
- process.exit(3 /* ErrorCodes.UPDATE_BUT_FILE_DOES_NOT_EXIST */);
92
- }
93
- }
94
- }
95
- // Install pnpm
96
- const pnpmFixedVersion = options.pnpmVersion ? "@" + options.pnpmVersion : "";
97
- if (!(options === null || options === void 0 ? void 0 : options.update)) {
98
- console.info("* install pnpm : npm install -g pnpm" + pnpmFixedVersion);
99
- if (!(options === null || options === void 0 ? void 0 : options.dry)) {
100
- execSyncWithIo("npm install -g pnpm" + pnpmFixedVersion);
101
- }
102
- }
103
- else {
104
- console.info("* update pnpm : pnpm add -g pnpm" + pnpmFixedVersion);
105
- if (!(options === null || options === void 0 ? void 0 : options.dry)) {
106
- execSyncWithIo("pnpm add -g pnpm" + pnpmFixedVersion);
107
- }
108
- }
109
- console.info("* display pnpm version : pnpm -v");
110
- execSyncWithIo("pnpm -v");
111
- // install lpx globally
112
- console.info("* " + (!(options === null || options === void 0 ? void 0 : options.update) ? "install" : "update") + " lpx globally : pnpm add -g lpx");
113
- if (!(options === null || options === void 0 ? void 0 : options.dry)) {
114
- execSyncWithIo("pnpm add -g lpx");
115
- }
116
- // create configuration files
117
- const from = path.resolve(__dirname, "../workspace") + "/_";
118
- for (const cf of configFiles) {
119
- console.info("* copy", path.resolve(from + cf), " => ", path.resolve("./" + cf));
120
- if (!(options === null || options === void 0 ? void 0 : options.dry)) {
121
- fs.copyFileSync(from + cf, "./" + cf);
122
- }
123
- }
124
- // create nvmrc
125
- if (!fs.existsSync("./.nvmrc")) {
126
- console.info("*", process.version, "> .nvmrc");
127
- if (!(options === null || options === void 0 ? void 0 : options.dry)) {
128
- fs.writeFileSync("./.nvmrc", process.version);
129
- }
130
- }
131
- // create .npmrc file if needed
132
- if (!fs.existsSync("./.npmrc")) {
133
- console.info("*", "Add .npmrc file to workspace");
134
- if (!(options === null || options === void 0 ? void 0 : options.dry)) {
135
- fs.writeFileSync("./.npmrc", "shared-workspace-lockfile=false");
136
- }
137
- }
138
- if (!(options === null || options === void 0 ? void 0 : options.update)) {
139
- // install packages
140
- console.info("* init done, you can now checkout cervval.js and install packages");
141
- console.info("git clone https://git.cervval.com/CERVVAL/cervval.js.git");
142
- console.info("pnpm install");
143
- }
144
- else {
145
- console.info(FgBlue + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
146
- console.info(FgBlue + "*update done, you can now install packages");
147
- console.info(FgGreen + "pnpm install", FgReset);
148
- }
149
- return true;
150
- }
151
- /**
152
- * parses command arguments and inits workspace in current working directory
153
- */
154
- function cli() {
155
- const options = { dry: false, update: false, pnpmVersion: "8.6.1" };
156
- const args = process.argv.slice(2);
157
- if (args.includes("--dry")) {
158
- console.info("* dry mode on");
159
- options.dry = true;
160
- }
161
- if (args.includes("--update")) {
162
- console.info("* update mode on");
163
- options.update = true;
164
- }
165
- try {
166
- initWorkspace(options);
167
- }
168
- catch (err) {
169
- console.error(err);
170
- process.exit(99 /* ErrorCodes.UNEXPECTED */);
171
- }
172
- }
173
- exports.cli = cli;
174
- cli();
175
- //# sourceMappingURL=index.js.map