@o3r/amaterasu-otter 8.0.0-alpha.0 → 8.0.0-alpha.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/amaterasu-otter",
3
- "version": "8.0.0-alpha.0",
3
+ "version": "8.0.0-alpha.6",
4
4
  "main": "./src/index.js",
5
5
  "typings": "./src/index.d.ts",
6
6
  "description": "Command Line Interface to administrate a DES project",
@@ -26,51 +26,51 @@
26
26
  }
27
27
  },
28
28
  "devDependencies": {
29
- "@ama-terasu/core": "^8.0.0-alpha.0",
30
- "@o3r/build-helpers": "^8.0.0-alpha.0",
31
- "@o3r/dev-tools": "^8.0.0-alpha.0",
29
+ "@ama-terasu/core": "^8.0.0-alpha.6",
30
+ "@angular-eslint/eslint-plugin": "~15.1.0",
31
+ "@nrwl/jest": "^15.3.3",
32
+ "@o3r/build-helpers": "^8.0.0-alpha.6",
33
+ "@o3r/dev-tools": "^8.0.0-alpha.6",
34
+ "@o3r/eslint-plugin": "^8.0.0-alpha.6",
35
+ "@types/jest": "~28.1.2",
32
36
  "@types/js-yaml": "^4.0.5",
33
37
  "@types/node": "^17.0.23",
38
+ "@typescript-eslint/eslint-plugin": "^5.19.0",
39
+ "@typescript-eslint/parser": "^5.19.0",
40
+ "eslint": "^8.22.0",
41
+ "eslint-import-resolver-node": "^0.3.4",
42
+ "eslint-plugin-jest": "^26.1.4",
43
+ "eslint-plugin-jsdoc": "^39.3.6",
44
+ "eslint-plugin-prefer-arrow": "^1.2.3",
45
+ "jest": "~28.1.1",
34
46
  "nx": "^15.3.3",
47
+ "ts-jest": "^28.0.5",
35
48
  "typescript": "~4.8.4"
36
49
  },
37
50
  "peerDependencies": {
38
- "@ama-terasu/core": "^8.0.0-alpha.0",
51
+ "@ama-terasu/core": "^8.0.0-alpha.6",
39
52
  "@angular/cli": "~15.0.0",
40
53
  "@types/request-promise-native": "1.0.18",
41
54
  "azure-devops-node-api": "11.2.0",
42
- "chalk": "4.1.2",
43
- "commander": "9.4.1",
44
55
  "comment-json": "4.2.3",
45
- "form-data": "4.0.0",
46
- "fs-extra": "7.0.1",
47
56
  "jasmine-spec-reporter": "5.0.2",
48
- "minimatch": "5.1.2",
49
57
  "request": "2.88.2",
50
58
  "request-promise-native": "1.0.9",
51
- "winston": "3.8.2",
52
- "@o3r/eslint-plugin": "8.0.0-alpha.0",
53
59
  "@typescript-eslint/experimental-utils": "5.45.1",
54
60
  "@angular-eslint/utils": "15.1.0",
55
61
  "jest-junit": "14.0.1",
56
62
  "@types/fs-extra": "9.0.13",
57
- "@types/glob": "7.2.0",
58
63
  "@types/gulp": "4.0.10",
59
64
  "@types/gulp-cached": "0.0.32",
60
- "@types/jasmine": "3.10.7",
61
65
  "@types/request": "2.48.8",
62
66
  "@types/rimraf": "3.0.2",
63
67
  "@types/semver": "7.3.13",
64
68
  "gulp": "4.0.2",
65
69
  "gulp-cached": "1.1.1",
66
70
  "gulp-typescript": "6.0.0-alpha.1",
67
- "node-fetch": "2.6.7",
68
- "type-fest": "2.19.0",
69
- "util": "0.10.3",
70
71
  "@types/minimist": "1.2.2",
71
72
  "@types/yargs": "17.0.16",
72
- "loglevel": "1.8.1",
73
- "yargs": "17.6.2"
73
+ "loglevel": "1.8.1"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=14.0.0",
@@ -1,36 +1,36 @@
1
- import { Context } from '@ama-terasu/core';
2
- /** Option to create an application */
3
- export interface CreateApplicationOptions {
4
- /** Application Name */
5
- name: string;
6
- /** Path of the folder to create the application */
7
- path: string;
8
- /**
9
- * Set default options instead of requiring input
10
- *
11
- * @default false
12
- */
13
- yes?: boolean;
14
- /** Otter generator version to use */
15
- 'otter-version': string;
16
- /**
17
- * use yarn instead of npm
18
- *
19
- * @default false
20
- */
21
- yarn?: boolean;
22
- /**
23
- * install material with Otter
24
- *
25
- * @default false
26
- */
27
- material?: boolean;
28
- }
29
- /**
30
- * Create an Otter Application
31
- *
32
- * @param context Context of the command
33
- * @param options Options
34
- */
35
- export declare const createApplication: (context: Context, options: CreateApplicationOptions) => Promise<void>;
1
+ import { Context } from '@ama-terasu/core';
2
+ /** Option to create an application */
3
+ export interface CreateApplicationOptions {
4
+ /** Application Name */
5
+ name: string;
6
+ /** Path of the folder to create the application */
7
+ path: string;
8
+ /**
9
+ * Set default options instead of requiring input
10
+ *
11
+ * @default false
12
+ */
13
+ yes?: boolean;
14
+ /** Otter generator version to use */
15
+ 'otter-version': string;
16
+ /**
17
+ * use yarn instead of npm
18
+ *
19
+ * @default false
20
+ */
21
+ yarn?: boolean;
22
+ /**
23
+ * install material with Otter
24
+ *
25
+ * @default false
26
+ */
27
+ material?: boolean;
28
+ }
29
+ /**
30
+ * Create an Otter Application
31
+ *
32
+ * @param context Context of the command
33
+ * @param options Options
34
+ */
35
+ export declare const createApplication: (context: Context, options: CreateApplicationOptions) => Promise<void>;
36
36
  //# sourceMappingURL=create-application.command.d.ts.map
@@ -1,52 +1,52 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createApplication = void 0;
4
- const core_1 = require("@ama-terasu/core");
5
- const node_fs_1 = require("node:fs");
6
- const path = require("node:path");
7
- const { peerDependencies } = require(path.resolve(__dirname, '..', 'package.json'));
8
- /**
9
- * Create an Otter Application
10
- *
11
- * @param context Context of the command
12
- * @param options Options
13
- */
14
- const createApplication = async (context, options) => {
15
- const { logger } = context;
16
- let cwd = path.resolve(process.cwd(), options.path);
17
- const directory = options.name.replace(/ /g, '-');
18
- const npmClient = options.yarn ? 'yarn' : 'npm';
19
- const npmRunner = options.yarn ? 'yarn' : 'npx';
20
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
21
- const interactive = `${!options.yes}`;
22
- const ngVersion = peerDependencies?.['@angular/cli'] || 'latest';
23
- if (!(0, node_fs_1.existsSync)(cwd)) {
24
- await node_fs_1.promises.mkdir(cwd, { recursive: true });
25
- }
26
- await context.getSpinner('Creating a new Angular application...').fromPromise(
27
- // eslint-disable-next-line max-len
28
- (0, core_1.promiseSpawn)(`npx -p @angular/cli@${ngVersion} ng new "${options.name}" --style=scss --interactive=${interactive} --directory=${directory} --package-manager=${options.yarn ? 'yarn' : 'npm'} --routing`, { cwd, logger, stderrLogger: logger.debug }), `Application created (in ${path.resolve(cwd, directory)})`);
29
- cwd = path.resolve(cwd, directory);
30
- await context.getSpinner('Installing NPM dependencies...').fromPromise((0, core_1.promiseSpawn)(`${npmClient} install`, { cwd, logger, stderrLogger: logger.debug }), `NPM dependencies installed (with ${npmClient})`);
31
- await context.getSpinner('Adding Otter dependencies...').fromPromise((0, core_1.promiseSpawn)(`${npmRunner} ng add @o3r/core@${options['otter-version']} --interactive=${interactive} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Otter dependencies registered');
32
- if (options.material) {
33
- await context.getSpinner('Adding Material Dependency...').fromPromise((0, core_1.promiseSpawn)(`${npmRunner} ng add @angular/material --interactive=${interactive} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Material Design library registered');
34
- const updateStyleTask = context.getSpinner('Updating styles...');
35
- updateStyleTask.start();
36
- const stylingFile = path.resolve(cwd, 'src/styles.scss');
37
- if ((0, node_fs_1.existsSync)(stylingFile)) {
38
- const style = (await node_fs_1.promises.readFile(stylingFile, { encoding: 'utf-8' }))
39
- .replace('// @include mat-core', '@include mat-core')
40
- .replace('// @include angular-material-typography', '@include angular-material-typography')
41
- .replace('// @include angular-material-theme', '@include angular-material-theme');
42
- await node_fs_1.promises.writeFile(stylingFile, style);
43
- }
44
- else {
45
- context.logger.error(`File ${stylingFile} not found`);
46
- }
47
- updateStyleTask.succeed('Style updated');
48
- }
49
- logger.info(`Application created in ${cwd}`);
50
- };
51
- exports.createApplication = createApplication;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createApplication = void 0;
4
+ const core_1 = require("@ama-terasu/core");
5
+ const node_fs_1 = require("node:fs");
6
+ const path = require("node:path");
7
+ const { peerDependencies } = require(path.resolve(__dirname, '..', 'package.json'));
8
+ /**
9
+ * Create an Otter Application
10
+ *
11
+ * @param context Context of the command
12
+ * @param options Options
13
+ */
14
+ const createApplication = async (context, options) => {
15
+ const { logger } = context;
16
+ let cwd = path.resolve(process.cwd(), options.path);
17
+ const directory = options.name.replace(/ /g, '-');
18
+ const npmClient = options.yarn ? 'yarn' : 'npm';
19
+ const npmRunner = options.yarn ? 'yarn' : 'npx';
20
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
21
+ const interactive = `${!options.yes}`;
22
+ const ngVersion = peerDependencies?.['@angular/cli'] || 'latest';
23
+ if (!(0, node_fs_1.existsSync)(cwd)) {
24
+ await node_fs_1.promises.mkdir(cwd, { recursive: true });
25
+ }
26
+ await context.getSpinner('Creating a new Angular application...').fromPromise(
27
+ // eslint-disable-next-line max-len
28
+ (0, core_1.promiseSpawn)(`npx -p @angular/cli@${ngVersion} ng new "${options.name}" --style=scss --interactive=${interactive} --directory=${directory} --package-manager=${options.yarn ? 'yarn' : 'npm'} --routing`, { cwd, logger, stderrLogger: logger.debug }), `Application created (in ${path.resolve(cwd, directory)})`);
29
+ cwd = path.resolve(cwd, directory);
30
+ await context.getSpinner('Installing NPM dependencies...').fromPromise((0, core_1.promiseSpawn)(`${npmClient} install`, { cwd, logger, stderrLogger: logger.debug }), `NPM dependencies installed (with ${npmClient})`);
31
+ await context.getSpinner('Adding Otter dependencies...').fromPromise((0, core_1.promiseSpawn)(`${npmRunner} ng add @o3r/core@${options['otter-version']} --interactive=${interactive} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Otter dependencies registered');
32
+ if (options.material) {
33
+ await context.getSpinner('Adding Material Dependency...').fromPromise((0, core_1.promiseSpawn)(`${npmRunner} ng add @angular/material --interactive=${interactive} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Material Design library registered');
34
+ const updateStyleTask = context.getSpinner('Updating styles...');
35
+ updateStyleTask.start();
36
+ const stylingFile = path.resolve(cwd, 'src/styles.scss');
37
+ if ((0, node_fs_1.existsSync)(stylingFile)) {
38
+ const style = (await node_fs_1.promises.readFile(stylingFile, { encoding: 'utf-8' }))
39
+ .replace('// @include mat-core', '@include mat-core')
40
+ .replace('// @include angular-material-typography', '@include angular-material-typography')
41
+ .replace('// @include angular-material-theme', '@include angular-material-theme');
42
+ await node_fs_1.promises.writeFile(stylingFile, style);
43
+ }
44
+ else {
45
+ context.logger.error(`File ${stylingFile} not found`);
46
+ }
47
+ updateStyleTask.succeed('Style updated');
48
+ }
49
+ logger.info(`Application created in ${cwd}`);
50
+ };
51
+ exports.createApplication = createApplication;
52
52
  //# sourceMappingURL=create-application.command.js.map
@@ -1,28 +1,28 @@
1
- import { Context } from '@ama-terasu/core';
2
- /** Option to create a Custom Application */
3
- export interface CreateCustomAppOptions {
4
- /** Airline code */
5
- airline: string;
6
- /** Path of the folder to create the application */
7
- path: string;
8
- /**
9
- * Set default options instead of requiring input
10
- *
11
- * @default false
12
- */
13
- yes?: boolean;
14
- /** Otter generator version to use */
15
- 'otter-version': string;
16
- /** RefX Flavour */
17
- flavour: string;
18
- /** RefX Tag version */
19
- tag: string;
20
- }
21
- /**
22
- * Create a custom application
23
- *
24
- * @param context Context of the command
25
- * @param options Options
26
- */
27
- export declare const createCustomApplication: (context: Context, options: CreateCustomAppOptions) => Promise<void>;
1
+ import { Context } from '@ama-terasu/core';
2
+ /** Option to create a Custom Application */
3
+ export interface CreateCustomAppOptions {
4
+ /** Airline code */
5
+ airline: string;
6
+ /** Path of the folder to create the application */
7
+ path: string;
8
+ /**
9
+ * Set default options instead of requiring input
10
+ *
11
+ * @default false
12
+ */
13
+ yes?: boolean;
14
+ /** Otter generator version to use */
15
+ 'otter-version': string;
16
+ /** RefX Flavour */
17
+ flavour: string;
18
+ /** RefX Tag version */
19
+ tag: string;
20
+ }
21
+ /**
22
+ * Create a custom application
23
+ *
24
+ * @param context Context of the command
25
+ * @param options Options
26
+ */
27
+ export declare const createCustomApplication: (context: Context, options: CreateCustomAppOptions) => Promise<void>;
28
28
  //# sourceMappingURL=create-custom-application.command.d.ts.map
@@ -1,21 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCustomApplication = void 0;
4
- const core_1 = require("@ama-terasu/core");
5
- const node_path_1 = require("node:path");
6
- /**
7
- * Create a custom application
8
- *
9
- * @param context Context of the command
10
- * @param options Options
11
- */
12
- const createCustomApplication = async (context, options) => {
13
- const { logger } = context;
14
- const cwd = (0, node_path_1.resolve)(process.cwd(), options.path);
15
- await context.getSpinner('Generating a new custom application...').fromPromise(
16
- // eslint-disable-next-line max-len
17
- (0, core_1.promiseSpawn)(`npx -p @o3r/customization@${options['otter-version']} -p @angular-devkit/schematics-cli schematics @o3r/customization:generate --airlineCode ${options.airline} --checkoutTag ${options.tag} --refxFlavour ${options.flavour}`, { cwd, stderrLogger: logger.debug, logger }), `Application generated (in ${cwd})`);
18
- logger.info(`Application created in ${(0, node_path_1.resolve)(cwd, `${options.airline}-${options.flavour}`)}`);
19
- };
20
- exports.createCustomApplication = createCustomApplication;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCustomApplication = void 0;
4
+ const core_1 = require("@ama-terasu/core");
5
+ const node_path_1 = require("node:path");
6
+ /**
7
+ * Create a custom application
8
+ *
9
+ * @param context Context of the command
10
+ * @param options Options
11
+ */
12
+ const createCustomApplication = async (context, options) => {
13
+ const { logger } = context;
14
+ const cwd = (0, node_path_1.resolve)(process.cwd(), options.path);
15
+ await context.getSpinner('Generating a new custom application...').fromPromise(
16
+ // eslint-disable-next-line max-len
17
+ (0, core_1.promiseSpawn)(`npx -p @o3r/customization@${options['otter-version']} -p @angular-devkit/schematics-cli schematics @o3r/customization:generate --airlineCode ${options.airline} --checkoutTag ${options.tag} --refxFlavour ${options.flavour}`, { cwd, stderrLogger: logger.debug, logger }), `Application generated (in ${cwd})`);
18
+ logger.info(`Application created in ${(0, node_path_1.resolve)(cwd, `${options.airline}-${options.flavour}`)}`);
19
+ };
20
+ exports.createCustomApplication = createCustomApplication;
21
21
  //# sourceMappingURL=create-custom-application.command.js.map
package/src/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=index.d.ts.map
package/src/index.js CHANGED
@@ -1,64 +1,64 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /* eslint-disable no-shadow */
4
- const core_1 = require("@ama-terasu/core");
5
- const create_application_command_1 = require("./create-application.command");
6
- const create_custom_application_command_1 = require("./create-custom-application.command");
7
- const name = 'otter';
8
- module.exports = {
9
- name,
10
- description: 'Commands relative to Otter framework',
11
- init: (yargs, baseContext) => {
12
- return yargs
13
- .option(core_1.EXTRA_COMMON_OPTIONS.yarn, {
14
- ...core_1.MODULE_OPTIONS.yarn,
15
- type: 'boolean'
16
- })
17
- .demandCommand()
18
- .command('create', 'Generate a new Otter based project', (yargsInstance) => yargsInstance
19
- .usage(baseContext.generateUsageMessage(name, 'create <command>'))
20
- .demandCommand()
21
- .option(core_1.EXTRA_COMMON_OPTIONS.path, {
22
- ...core_1.MODULE_OPTIONS.path,
23
- type: 'string',
24
- default: '.',
25
- description: 'Path to the generated application'
26
- })
27
- .option('otter-version', {
28
- alias: ['O'],
29
- type: 'string',
30
- default: 'latest',
31
- description: 'Version of the Otter generators to use',
32
- demandOption: 'Amadeus NPM registries token is mandatory'
33
- })
34
- .command('application <name>', 'Generate a new Otter based application', (yargsInstanceApp) => yargsInstanceApp
35
- .positional('name', {
36
- type: 'string',
37
- description: 'Application name',
38
- demandOption: 'Application name is mandatory'
39
- })
40
- .option('material', {
41
- type: 'boolean',
42
- default: true,
43
- description: 'Add material dependency'
44
- }), (options) => (0, create_application_command_1.createApplication)(baseContext.getContext(options), options))
45
- .command('custom-application <airline>', 'Generate Otter custom application', (yargsInstanceCustomApp) => yargsInstanceCustomApp
46
- .positional('airline', {
47
- type: 'string',
48
- description: 'Airline code for the application',
49
- demandOption: 'Airline code is mandatory'
50
- })
51
- .option('flavour', {
52
- type: 'string',
53
- choices: ['booking', 'ssci', 'servicing', 'ndc'],
54
- description: 'RefX flavour',
55
- demandOption: 'RefX flavour selection is mandatory'
56
- })
57
- .option('tag', {
58
- type: 'string',
59
- default: '5.4.0',
60
- description: 'The git tag of the white label that is to be customized.'
61
- }), (options) => (0, create_custom_application_command_1.createCustomApplication)(baseContext.getContext(options), options)));
62
- }
63
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable no-shadow */
4
+ const core_1 = require("@ama-terasu/core");
5
+ const create_application_command_1 = require("./create-application.command");
6
+ const create_custom_application_command_1 = require("./create-custom-application.command");
7
+ const name = 'otter';
8
+ module.exports = {
9
+ name,
10
+ description: 'Commands relative to Otter framework',
11
+ init: (yargs, baseContext) => {
12
+ return yargs
13
+ .option(core_1.EXTRA_COMMON_OPTIONS.yarn, {
14
+ ...core_1.MODULE_OPTIONS.yarn,
15
+ type: 'boolean'
16
+ })
17
+ .demandCommand()
18
+ .command('create', 'Generate a new Otter based project', (yargsInstance) => yargsInstance
19
+ .usage(baseContext.generateUsageMessage(name, 'create <command>'))
20
+ .demandCommand()
21
+ .option(core_1.EXTRA_COMMON_OPTIONS.path, {
22
+ ...core_1.MODULE_OPTIONS.path,
23
+ type: 'string',
24
+ default: '.',
25
+ description: 'Path to the generated application'
26
+ })
27
+ .option('otter-version', {
28
+ alias: ['O'],
29
+ type: 'string',
30
+ default: 'latest',
31
+ description: 'Version of the Otter generators to use',
32
+ demandOption: 'Amadeus NPM registries token is mandatory'
33
+ })
34
+ .command('application <name>', 'Generate a new Otter based application', (yargsInstanceApp) => yargsInstanceApp
35
+ .positional('name', {
36
+ type: 'string',
37
+ description: 'Application name',
38
+ demandOption: 'Application name is mandatory'
39
+ })
40
+ .option('material', {
41
+ type: 'boolean',
42
+ default: true,
43
+ description: 'Add material dependency'
44
+ }), (options) => (0, create_application_command_1.createApplication)(baseContext.getContext(options), options))
45
+ .command('custom-application <airline>', 'Generate Otter custom application', (yargsInstanceCustomApp) => yargsInstanceCustomApp
46
+ .positional('airline', {
47
+ type: 'string',
48
+ description: 'Airline code for the application',
49
+ demandOption: 'Airline code is mandatory'
50
+ })
51
+ .option('flavour', {
52
+ type: 'string',
53
+ choices: ['booking', 'ssci', 'servicing', 'ndc'],
54
+ description: 'RefX flavour',
55
+ demandOption: 'RefX flavour selection is mandatory'
56
+ })
57
+ .option('tag', {
58
+ type: 'string',
59
+ default: '5.4.0',
60
+ description: 'The git tag of the white label that is to be customized.'
61
+ }), (options) => (0, create_custom_application_command_1.createCustomApplication)(baseContext.getContext(options), options)));
62
+ }
63
+ };
64
64
  //# sourceMappingURL=index.js.map