@o3r/create 10.0.0-next.9 → 10.0.0-prerelease.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +25 -7
  3. package/package.json +29 -25
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">Otter project initializer</h1>
2
2
  <p align="center">
3
- <img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/.attachments/otter.png" alt="Super cute Otter!" width="40%"/>
3
+ <img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
4
4
  </p>
5
5
 
6
6
  ## Create an Otter application
package/index.js CHANGED
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const node_path_1 = require("node:path");
6
+ const node_fs_1 = require("node:fs");
6
7
  const minimist = require("minimist");
7
- const { properties } = require(require.resolve('@schematics/angular/ng-new/schema').replace(/\.js$/, '.json'));
8
- const { version } = require((0, node_path_1.resolve)(__dirname, 'package.json'));
8
+ const { properties } = JSON.parse((0, node_fs_1.readFileSync)(require.resolve('@schematics/angular/ng-new/schema').replace(/\.js$/, '.json'), { encoding: 'utf-8' }));
9
+ const { version } = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.resolve)(__dirname, 'package.json'), { encoding: 'utf-8' }));
9
10
  const logo = `
10
11
 
11
12
  &BPPPB & &BPGB&
@@ -68,9 +69,14 @@ const logo = `
68
69
  `;
69
70
  const binPath = (0, node_path_1.join)(require.resolve('@angular/cli/package.json'), '../bin/ng.js');
70
71
  const args = process.argv.slice(2).filter((a) => a !== '--create-application');
72
+ // Default styling to Sass
71
73
  if (!args.some((a) => a.startsWith('--style'))) {
72
74
  args.push('--style', 'scss');
73
75
  }
76
+ // Default Preset to Basic
77
+ if (!args.some((a) => a.startsWith('--preset'))) {
78
+ args.push('--preset', 'basic');
79
+ }
74
80
  const hasPackageManagerArg = args.some((a) => a.startsWith('--package-manager'));
75
81
  if (!hasPackageManagerArg) {
76
82
  const packageManager = process.env.npm_config_user_agent?.split('/')[0];
@@ -95,12 +101,22 @@ const isNgNewOptions = (arg) => {
95
101
  return entries.some(([key]) => [`--${key}`, `--no-${key}`, `--${key.replaceAll(/([A-Z])/g, '-$1').toLowerCase()}`, `--no-${key.replaceAll(/([A-Z])/g, '-$1').toLowerCase()}`].includes(arg));
96
102
  }
97
103
  else if (arg.startsWith('-')) {
98
- return entries.some(([_, { alias }]) => alias && arg === `-${alias}`);
104
+ return entries.some(([, { alias }]) => alias && arg === `-${alias}`);
99
105
  }
100
106
  return true;
101
107
  };
108
+ const schematicsCliOptions = Object.entries(argv)
109
+ .filter(([key]) => key !== '_')
110
+ .map(([key, value]) => value === true && [key] || value === false && key.length > 1 && [`no-${key}`] || [key, value])
111
+ .map(([key, value]) => {
112
+ const optionKey = key.length > 1 ? `--${key}` : `-${key}`;
113
+ return typeof value === 'undefined' ? [optionKey] : [optionKey, value];
114
+ });
102
115
  const createNgProject = () => {
103
- const { error } = (0, node_child_process_1.spawnSync)(process.execPath, [binPath, 'new', ...args.filter(isNgNewOptions)], {
116
+ const options = schematicsCliOptions
117
+ .filter(([key]) => isNgNewOptions(key))
118
+ .flat();
119
+ const { error } = (0, node_child_process_1.spawnSync)(process.execPath, [binPath, 'new', ...argv._, ...options, '--skip-install'], {
104
120
  stdio: 'inherit'
105
121
  });
106
122
  if (error) {
@@ -109,9 +125,11 @@ const createNgProject = () => {
109
125
  process.exit(1);
110
126
  }
111
127
  };
112
- const addOtterCore = (relativeDirectory = '.') => {
128
+ const addOtterFramework = (relativeDirectory = '.') => {
113
129
  const cwd = (0, node_path_1.resolve)(process.cwd(), relativeDirectory);
114
- const { error } = (0, node_child_process_1.spawnSync)(process.execPath, [binPath, 'add', `@o3r/core@${version || 'latest'}`, ...args.filter((arg) => arg.startsWith('-'))], {
130
+ const options = schematicsCliOptions
131
+ .flat();
132
+ const { error } = (0, node_child_process_1.spawnSync)(process.execPath, [binPath, 'add', `@o3r/core@${version || 'latest'}`, ...options], {
115
133
  stdio: 'inherit',
116
134
  cwd
117
135
  });
@@ -124,4 +142,4 @@ const addOtterCore = (relativeDirectory = '.') => {
124
142
  const projectFolder = argv._[0]?.replaceAll(' ', '-').toLowerCase() || '.';
125
143
  console.info(logo);
126
144
  createNgProject();
127
- addOtterCore(projectFolder);
145
+ addOtterFramework(projectFolder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/create",
3
- "version": "10.0.0-next.9",
3
+ "version": "10.0.0-prerelease.2",
4
4
  "description": "Create a new Otter based application",
5
5
  "keywords": [
6
6
  "create",
@@ -15,43 +15,46 @@
15
15
  "prepare:publish": "prepare-publish ./dist"
16
16
  },
17
17
  "dependencies": {
18
- "@angular/cli": "~16.2.0",
19
- "@schematics/angular": "~16.2.0",
20
- "minimist": "^1.2.6"
18
+ "@angular/cli": "~17.0.3",
19
+ "@schematics/angular": "~17.0.3",
20
+ "minimist": "^1.2.6",
21
+ "tslib": "^2.5.3"
21
22
  },
22
23
  "devDependencies": {
23
- "@angular-eslint/eslint-plugin": "~16.1.0",
24
- "@angular-eslint/eslint-plugin-template": "~16.1.0",
25
- "@nx/jest": "~16.8.0",
26
- "@nx/js": "~16.8.0",
27
- "@nx/linter": "~16.8.0",
28
- "@o3r/build-helpers": "^10.0.0-next.9",
29
- "@o3r/dev-tools": "^10.0.0-next.9",
30
- "@o3r/eslint-config-otter": "^10.0.0-next.9",
31
- "@o3r/eslint-plugin": "^10.0.0-next.9",
24
+ "@angular-eslint/eslint-plugin": "~17.2.0",
25
+ "@angular-eslint/eslint-plugin-template": "~17.2.0",
26
+ "@nx/eslint": "~17.2.0",
27
+ "@nx/eslint-plugin": "~17.2.0",
28
+ "@nx/jest": "~17.2.0",
29
+ "@nx/js": "~17.2.0",
30
+ "@o3r/build-helpers": "^10.0.0-prerelease.2",
31
+ "@o3r/eslint-config-otter": "^10.0.0-prerelease.2",
32
+ "@o3r/eslint-plugin": "^10.0.0-prerelease.2",
33
+ "@o3r/test-helpers": "^10.0.0-prerelease.2",
32
34
  "@types/jest": "~29.5.2",
33
35
  "@types/minimist": "^1.2.2",
34
- "@types/node": "^18.0.0",
35
- "@typescript-eslint/eslint-plugin": "^5.59.9",
36
- "@typescript-eslint/parser": "^5.59.9",
37
- "cpy-cli": "^4.2.0",
36
+ "@types/node": "^20.0.0",
37
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
38
+ "@typescript-eslint/parser": "^6.11.0",
39
+ "cpy-cli": "^5.0.0",
38
40
  "eslint": "^8.42.0",
39
41
  "eslint-import-resolver-node": "^0.3.4",
40
- "eslint-plugin-jest": "~27.2.3",
41
- "eslint-plugin-jsdoc": "~46.8.0",
42
+ "eslint-plugin-jest": "~27.6.0",
43
+ "eslint-plugin-jsdoc": "~48.0.0",
42
44
  "eslint-plugin-prefer-arrow": "~1.2.3",
43
- "eslint-plugin-unicorn": "^47.0.0",
45
+ "eslint-plugin-unicorn": "^50.0.0",
44
46
  "jest": "~29.7.0",
45
47
  "jest-junit": "~16.0.0",
46
- "nx": "~16.8.0",
48
+ "jsonc-eslint-parser": "~2.4.0",
49
+ "nx": "~17.2.0",
47
50
  "rimraf": "^5.0.1",
48
51
  "rxjs": "^7.8.1",
49
52
  "ts-jest": "~29.1.1",
50
- "type-fest": "^3.12.0",
51
- "typescript": "~5.1.6"
53
+ "type-fest": "^4.3.1",
54
+ "typescript": "~5.2.2"
52
55
  },
53
56
  "engines": {
54
- "node": ">=14.0.0"
57
+ "node": ">=18.0.0"
55
58
  },
56
59
  "contributors": [
57
60
  {
@@ -116,5 +119,6 @@
116
119
  ],
117
120
  "bugs": "https://github.com/AmadeusITGroup/otter/issues",
118
121
  "repository": "https://github.com/AmadeusITGroup/otter",
119
- "license": "BSD-3-Clause"
122
+ "license": "BSD-3-Clause",
123
+ "homepage": "https://amadeusitgroup.github.io/otter/"
120
124
  }