@squiz/dxp-cli-next 2.11.1-test-ub9.1 → 2.11.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.
@@ -27,28 +27,4 @@ describe('cmp dev', () => {
27
27
  const opts = program.opts();
28
28
  expect(opts.port).toStrictEqual(3000);
29
29
  });
30
- it.each(['3000', '3001', '65535', '1024'])('correctly parses the port (%s)', (attemptedPort) => __awaiter(void 0, void 0, void 0, function* () {
31
- const program = (0, dev_mode_1.buildDevModeCommand)()
32
- .exitOverride()
33
- .action(() => { });
34
- program.parse(['node', 'dxp-cli', 'dev', '--port', attemptedPort]);
35
- const opts = program.opts();
36
- expect(typeof opts.port).toStrictEqual('number');
37
- }));
38
- it.each([
39
- 'hello_world',
40
- '3_000',
41
- '65_535',
42
- '1000',
43
- '100',
44
- '1_000_000',
45
- '1000000',
46
- 'abc_1000',
47
- '1000arst',
48
- ])('errors when port (%s) is not a number between 1000-65535', attemptedPort => {
49
- const program = (0, dev_mode_1.buildDevModeCommand)()
50
- .exitOverride()
51
- .action(() => { });
52
- expect(() => program.parse(['node', 'dxp-cli', 'dev', '--port', attemptedPort])).toThrowError('Port must be a number between 1024-65535');
53
- });
54
30
  });
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.buildDevModeCommand = void 0;
13
13
  const commander_1 = require("commander");
14
14
  const component_cli_lib_1 = require("@squiz/component-cli-lib");
15
- const MIN_PORT = 1024;
16
- const MAX_PORT = 65535;
17
15
  const buildDevModeCommand = () => new commander_1.Command()
18
16
  .name('dev')
19
17
  .description('A local component runner for developing new components')
@@ -25,15 +23,7 @@ The logs are currently \`bunyan\` formatted and should be piped into the bunyan
25
23
  .argument('<source>', 'folder containing the template files in development')
26
24
  .addOption(new commander_1.Option('-p, --port <number>', 'Define port the webserver runs on')
27
25
  .default(3000)
28
- .argParser(v => {
29
- const parsedPort = Number(v);
30
- if (isNaN(parsedPort) ||
31
- MIN_PORT > parsedPort ||
32
- parsedPort > MAX_PORT) {
33
- throw new commander_1.InvalidArgumentError(`Port must be a number between ${MIN_PORT}-${MAX_PORT}`);
34
- }
35
- return parsedPort;
36
- }))
26
+ .argParser(v => parseInt(v)))
37
27
  .action((source, options) => __awaiter(void 0, void 0, void 0, function* () {
38
28
  yield (0, component_cli_lib_1.startDevelopmentRender)(source, options);
39
29
  }));
package/lib/dxp.js CHANGED
@@ -3,16 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const validateNodeVersion = require('../scripts/validateNodeVersion');
7
- const cli_color_1 = __importDefault(require("cli-color"));
8
- if (validateNodeVersion() === true) {
9
- console.error(cli_color_1.default.red('You are running an older version of node(${process.version}). Please install node v16 or higher'));
10
- // eslint-disable-next-line no-process-exit
11
- process.exit(1);
12
- }
13
6
  const commander_1 = __importDefault(require("commander"));
14
7
  const update_notifier_1 = __importDefault(require("update-notifier"));
15
8
  const pkg = require('../package.json');
9
+ const cli_color_1 = __importDefault(require("cli-color"));
10
+ validateNodeVersion();
16
11
  (0, update_notifier_1.default)({ pkg, updateCheckInterval: 1 }).notify({
17
12
  isGlobal: true,
18
13
  });
@@ -33,3 +28,14 @@ program
33
28
  program.help();
34
29
  })
35
30
  .parse(process.argv);
31
+ function validateNodeVersion() {
32
+ const nodeVersionParts = process.versions.node
33
+ .split('.')
34
+ .map(part => Number(part));
35
+ const [nodeVersion] = nodeVersionParts;
36
+ if (nodeVersion < 16) {
37
+ console.error(cli_color_1.default.red(`You are running an older version of node(${process.version}). Please install node v16 or higher`));
38
+ // eslint-disable-next-line no-process-exit
39
+ process.exit(1);
40
+ }
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dxp-cli-next",
3
- "version": "2.11.1-test-ub9.1",
3
+ "version": "2.11.1",
4
4
  "repository": {
5
5
  "url": "https://gitlab.squiz.net/developer-experience/dxp-cli-next"
6
6
  },
@@ -22,12 +22,10 @@
22
22
  "semantic-release": "semantic-release",
23
23
  "test:watch": "jest --watch",
24
24
  "test": "jest --coverage",
25
- "typecheck": "tsc --noEmit",
26
- "preinstall": "node preinstall-script.js",
27
- "prestart": "node preinstall-script.js"
25
+ "typecheck": "tsc --noEmit"
28
26
  },
29
27
  "engines": {
30
- "node": ">=16.0"
28
+ "node": ">=14.0"
31
29
  },
32
30
  "keywords": [
33
31
  "cli",
@@ -80,7 +78,6 @@
80
78
  "path": "./node_modules/cz-conventional-changelog"
81
79
  }
82
80
  },
83
- "engineStrict": true,
84
81
  "lint-staged": {
85
82
  "*.ts": "eslint --cache --cache-location .eslintcache --fix"
86
83
  },
@@ -90,10 +87,6 @@
90
87
  {
91
88
  "name": "develop",
92
89
  "prerelease": true
93
- },
94
- {
95
- "name": "test-*",
96
- "prerelease": true
97
90
  }
98
91
  ],
99
92
  "plugins": [