@o3r/amaterasu-otter 0.0.41 → 0.0.44
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/dist/commands.helpers.d.ts +2 -1
- package/dist/commands.helpers.d.ts.map +1 -1
- package/dist/commands.helpers.js +14 -4
- package/dist/commands.helpers.js.map +1 -1
- package/dist/create-application.command.d.ts +2 -0
- package/dist/create-application.command.d.ts.map +1 -1
- package/dist/create-application.command.js +7 -7
- package/dist/create-application.command.js.map +1 -1
- package/dist/create-custom-application.command.d.ts +4 -0
- package/dist/create-custom-application.command.d.ts.map +1 -1
- package/dist/create-custom-application.command.js +27 -12
- package/dist/create-custom-application.command.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/create-sdk.command.d.ts +0 -28
- package/dist/create-sdk.command.d.ts.map +0 -1
- package/dist/create-sdk.command.js +0 -39
- package/dist/create-sdk.command.js.map +0 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Generate an NpmRc minimal to use Otter package
|
|
3
3
|
*
|
|
4
4
|
* @param token Digital For Airlines registry token
|
|
5
|
+
* @param azureToken Azure DevOpts PAT
|
|
5
6
|
* @returns Content of the .npmrc file
|
|
6
7
|
*/
|
|
7
|
-
export declare const generateBasicNpmrc: (token: string) => string;
|
|
8
|
+
export declare const generateBasicNpmrc: (token: string, azureToken: string) => string;
|
|
8
9
|
//# sourceMappingURL=commands.helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.helpers.d.ts","sourceRoot":"","sources":["../src/commands.helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.helpers.d.ts","sourceRoot":"","sources":["../src/commands.helpers.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,cAAc,MAAM,WAiBnE,CAAC"}
|
package/dist/commands.helpers.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateBasicNpmrc = void 0;
|
|
4
|
+
const node_buffer_1 = require("node:buffer");
|
|
4
5
|
const os_1 = require("os");
|
|
5
6
|
/**
|
|
6
7
|
* Generate an NpmRc minimal to use Otter package
|
|
7
8
|
*
|
|
8
9
|
* @param token Digital For Airlines registry token
|
|
10
|
+
* @param azureToken Azure DevOpts PAT
|
|
9
11
|
* @returns Content of the .npmrc file
|
|
10
12
|
*/
|
|
11
|
-
const generateBasicNpmrc = (token) => {
|
|
13
|
+
const generateBasicNpmrc = (token, azureToken) => {
|
|
14
|
+
const azurePatBase64 = node_buffer_1.Buffer.from(azureToken).toString('base64');
|
|
12
15
|
return [
|
|
13
|
-
'@otter:registry=https://
|
|
14
|
-
'@dapi:registry=https://
|
|
15
|
-
'
|
|
16
|
+
'@otter:registry=https://pkgs.dev.azure.com/AmadeusDigitalAirline/Otter/_packaging/otter/npm/registry/',
|
|
17
|
+
'@dapi:registry=https://pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/npm/registry/',
|
|
18
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/Otter/_packaging/otter/npm/registry/:username=AmadeusDigitalAirline',
|
|
19
|
+
`//pkgs.dev.azure.com/AmadeusDigitalAirline/Otter/_packaging/otter/npm/registry/:_password=${azurePatBase64}`,
|
|
20
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/Otter/_packaging/otter/npm/registry/:email=noreply@amadeus.com',
|
|
21
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/Otter/_packaging/otter/npm/registry/:always-auth=true',
|
|
22
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/npm/registry/:username=AmadeusDigitalAirline',
|
|
23
|
+
`//pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/npm/registry/:_password=${azurePatBase64}`,
|
|
24
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/npm/registry/:email=noreply@amadeus.com',
|
|
25
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/npm/registry/:always-auth=true',
|
|
16
26
|
`//digitalforairlines.jfrog.io/digitalforairlines/api/npm/npm-otter/:_authToken=${token}`,
|
|
17
27
|
'//digitalforairlines.jfrog.io/digitalforairlines/api/npm/npm-otter/:email=noreply@amadeus.com',
|
|
18
28
|
'//digitalforairlines.jfrog.io/digitalforairlines/api/npm/npm-otter/:always-auth=true',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.helpers.js","sourceRoot":"","sources":["../src/commands.helpers.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAEzB
|
|
1
|
+
{"version":3,"file":"commands.helpers.js","sourceRoot":"","sources":["../src/commands.helpers.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AACrC,2BAAyB;AAEzB;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,UAAkB,EAAE,EAAE;IACtE,MAAM,cAAc,GAAG,oBAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClE,OAAO;QACL,uGAAuG;QACvG,4GAA4G;QAC5G,gHAAgH;QAChH,6FAA6F,cAAc,EAAE;QAC7G,2GAA2G;QAC3G,kGAAkG;QAClG,sHAAsH;QACtH,mGAAmG,cAAc,EAAE;QACnH,iHAAiH;QACjH,wGAAwG;QACxG,kFAAkF,KAAK,EAAE;QACzF,+FAA+F;QAC/F,sFAAsF;QACtF,kBAAkB;KAAC,CAAC,IAAI,CAAC,QAAG,CAAC,CAAC;AAClC,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-application.command.d.ts","sourceRoot":"","sources":["../src/create-application.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAKzD,sCAAsC;AACtC,MAAM,WAAW,wBAAwB;IACvC,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,qBAAqB;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,YAAmB,OAAO,WAAW,wBAAwB,kBAuD1F,CAAC"}
|
|
1
|
+
{"version":3,"file":"create-application.command.d.ts","sourceRoot":"","sources":["../src/create-application.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAKzD,sCAAsC;AACtC,MAAM,WAAW,wBAAwB;IACvC,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,qBAAqB;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,YAAmB,OAAO,WAAW,wBAAwB,kBAuD1F,CAAC"}
|
|
@@ -18,20 +18,20 @@ const createApplication = async (context, options) => {
|
|
|
18
18
|
const directory = options.name.replace(/ /g, '-');
|
|
19
19
|
const npmClient = options.yarn ? 'yarn' : 'npm';
|
|
20
20
|
const npmRunner = options.yarn ? 'yarn' : 'npx';
|
|
21
|
-
if (!fs_1.existsSync(cwd)) {
|
|
21
|
+
if (!(0, fs_1.existsSync)(cwd)) {
|
|
22
22
|
await fs_1.promises.mkdir(cwd, { recursive: true });
|
|
23
23
|
}
|
|
24
|
-
await context.getSpinner('Creating a new Angular application...').fromPromise(core_1.promiseSpawn(`npx -p @angular/cli@12 ng new "${options.name}" --style=scss --interactive=${!options.yes} --directory=${directory} --package-manager=${options.yarn ? 'yarn' : 'npm'} --routing`, { cwd, logger, stderrLogger: logger.debug }), `Application created (in ${path.resolve(cwd, directory)})`);
|
|
24
|
+
await context.getSpinner('Creating a new Angular application...').fromPromise((0, core_1.promiseSpawn)(`npx -p @angular/cli@12 ng new "${options.name}" --style=scss --interactive=${!options.yes} --directory=${directory} --package-manager=${options.yarn ? 'yarn' : 'npm'} --routing`, { cwd, logger, stderrLogger: logger.debug }), `Application created (in ${path.resolve(cwd, directory)})`);
|
|
25
25
|
cwd = path.resolve(cwd, directory);
|
|
26
|
-
await context.getSpinner('Adding Otter registry...').fromPromise(fs_1.promises.writeFile(path.resolve(cwd, '.npmrc'), commands_helpers_1.generateBasicNpmrc(options['registry-token'])), 'Registry file created');
|
|
27
|
-
await context.getSpinner('Installing NPM dependencies...').fromPromise(core_1.promiseSpawn(`${npmClient} install`, { cwd, logger, stderrLogger: logger.debug }), `NPM dependencies installed (with ${npmClient})`);
|
|
28
|
-
await context.getSpinner('Adding Otter dependencies...').fromPromise(core_1.promiseSpawn(`${npmRunner} ng add @otter/ng-tools@${options['otter-version']} --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Otter dependencies registered');
|
|
26
|
+
await context.getSpinner('Adding Otter registry...').fromPromise(fs_1.promises.writeFile(path.resolve(cwd, '.npmrc'), (0, commands_helpers_1.generateBasicNpmrc)(options['registry-token'], options['azure-token'])), 'Registry file created');
|
|
27
|
+
await context.getSpinner('Installing NPM dependencies...').fromPromise((0, core_1.promiseSpawn)(`${npmClient} install`, { cwd, logger, stderrLogger: logger.debug }), `NPM dependencies installed (with ${npmClient})`);
|
|
28
|
+
await context.getSpinner('Adding Otter dependencies...').fromPromise((0, core_1.promiseSpawn)(`${npmRunner} ng add @otter/ng-tools@${options['otter-version']} --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Otter dependencies registered');
|
|
29
29
|
if (options.material) {
|
|
30
|
-
await context.getSpinner('Adding Material Dependency...').fromPromise(core_1.promiseSpawn(`${npmRunner} ng add @angular/material --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Material Design library registered');
|
|
30
|
+
await context.getSpinner('Adding Material Dependency...').fromPromise((0, core_1.promiseSpawn)(`${npmRunner} ng add @angular/material --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }), 'Material Design library registered');
|
|
31
31
|
const updateStyleTask = context.getSpinner('Updating styles...');
|
|
32
32
|
updateStyleTask.start();
|
|
33
33
|
const stylingFile = path.resolve(cwd, 'src/styles.scss');
|
|
34
|
-
if (fs_1.existsSync(stylingFile)) {
|
|
34
|
+
if ((0, fs_1.existsSync)(stylingFile)) {
|
|
35
35
|
const style = (await fs_1.promises.readFile(stylingFile, { encoding: 'utf-8' }))
|
|
36
36
|
.replace('// @include mat-core', '@include mat-core')
|
|
37
37
|
.replace('// @include angular-material-typography', '@include angular-material-typography')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-application.command.js","sourceRoot":"","sources":["../src/create-application.command.ts"],"names":[],"mappings":";;;;AAAA,2CAAyD;AACzD,2BAAgD;AAChD,mDAA6B;AAC7B,yDAAwD;
|
|
1
|
+
{"version":3,"file":"create-application.command.js","sourceRoot":"","sources":["../src/create-application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B,CAAC,CAAC;QACzD,IAAI,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE;YAC3B,MAAM,KAAK,GAAG,CAAC,MAAM,aAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;iBAClE,OAAO,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;iBACpD,OAAO,CAAC,yCAAyC,EAAE,sCAAsC,CAAC;iBAC1F,OAAO,CAAC,oCAAoC,EAAE,iCAAiC,CAAC,CAAC;YACpF,MAAM,aAAE,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;SACxC;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,WAAW,YAAY,CAAC,CAAA;SACtD;QACD,eAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;KAC1C;IAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAvDW,QAAA,iBAAiB,qBAuD5B"}
|
|
@@ -11,8 +11,12 @@ export interface CreateCustomAppOptions {
|
|
|
11
11
|
* @default false
|
|
12
12
|
*/
|
|
13
13
|
yes?: boolean;
|
|
14
|
+
/** Azure PAT */
|
|
15
|
+
'azure-token': string;
|
|
14
16
|
/** Registry Token */
|
|
15
17
|
'registry-token': string;
|
|
18
|
+
/** Otter generator version to use */
|
|
19
|
+
'otter-version': string;
|
|
16
20
|
/** RefX Flavour */
|
|
17
21
|
flavour: string;
|
|
18
22
|
/** RefX Tag version */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-custom-application.command.d.ts","sourceRoot":"","sources":["../src/create-custom-application.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-custom-application.command.d.ts","sourceRoot":"","sources":["../src/create-custom-application.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAQzD,4CAA4C;AAC5C,MAAM,WAAW,sBAAsB;IACrC,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gBAAgB;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,YAAmB,OAAO,WAAW,sBAAsB,kBAgE9F,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.createCustomApplication = void 0;
|
|
|
4
4
|
const core_1 = require("@ama-terasu/core");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const js_yaml_1 = require("js-yaml");
|
|
7
|
+
const node_buffer_1 = require("node:buffer");
|
|
7
8
|
const path_1 = require("path");
|
|
8
9
|
const commands_helpers_1 = require("./commands.helpers");
|
|
9
10
|
/**
|
|
@@ -15,38 +16,52 @@ const commands_helpers_1 = require("./commands.helpers");
|
|
|
15
16
|
const createCustomApplication = async (context, options) => {
|
|
16
17
|
var _a;
|
|
17
18
|
const { logger } = context;
|
|
18
|
-
const cwd = path_1.resolve(process.cwd(), options.path);
|
|
19
|
+
const cwd = (0, path_1.resolve)(process.cwd(), options.path);
|
|
19
20
|
const inPackageCwd = cwd;
|
|
20
21
|
const npmrcFile = 'tmp.npmrc';
|
|
21
22
|
const authTokenRegExp = /^(\/\/digitalforairlines.jfrog.io\/digitalforairlines\/api\/npm\/npm-otter\/:_authToken).*$/gm;
|
|
22
23
|
const registryUrl = '//digitalforairlines.jfrog.io/digitalforairlines/api/npm/npm-otter/';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const azureRegistryUrls = [
|
|
25
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/npm/registry/',
|
|
26
|
+
'//pkgs.dev.azure.com/AmadeusDigitalAirline/Otter/_packaging/otter/npm/registry/'
|
|
27
|
+
];
|
|
28
|
+
await context.getSpinner('Adding Otter registry...').fromPromise(fs_1.promises.writeFile((0, path_1.resolve)(cwd, npmrcFile), (0, commands_helpers_1.generateBasicNpmrc)(options['registry-token'], options['azure-token'])), 'Registry file created');
|
|
29
|
+
await context.getSpinner('Generating a new custom application...').fromPromise((0, core_1.promiseSpawn)(`npx --userconfig ${npmrcFile} -p @otter/customization@${options['otter-version']} -p @angular-devkit/schematics-cli schematics @otter/customization:generate --airlineCode ${options.airline} --checkoutTag ${options.tag} --refxFlavour ${options.flavour}`, { cwd, stderrLogger: logger.debug, logger }), `Application generated (in ${cwd})`);
|
|
30
|
+
const npmrcFilePath = (0, path_1.resolve)(inPackageCwd, '.npmrc');
|
|
31
|
+
if ((0, fs_1.existsSync)(npmrcFilePath)) {
|
|
27
32
|
const updateNpmrcTask = context.getSpinner('Updating generated .npmrc file...');
|
|
28
33
|
updateNpmrcTask.start();
|
|
29
34
|
const generatedNpmrc = await fs_1.promises.readFile(npmrcFilePath, { encoding: 'utf-8' });
|
|
30
|
-
const
|
|
35
|
+
const azurePatBase64 = node_buffer_1.Buffer.from(options['azure-token']).toString('base64');
|
|
36
|
+
const newNpmrcContent = generatedNpmrc
|
|
37
|
+
.replace(authTokenRegExp, `$1=${options['registry-token']}`)
|
|
38
|
+
.replace(/_password=.*/gm, `$1=${azurePatBase64}`);
|
|
31
39
|
await fs_1.promises.writeFile(npmrcFilePath, newNpmrcContent);
|
|
32
40
|
updateNpmrcTask.succeed('.npmrc file updated');
|
|
33
41
|
}
|
|
34
|
-
const yarnrcFilePath = path_1.resolve(inPackageCwd, '.yarnrc.yml');
|
|
35
|
-
if (fs_1.existsSync(yarnrcFilePath)) {
|
|
42
|
+
const yarnrcFilePath = (0, path_1.resolve)(inPackageCwd, '.yarnrc.yml');
|
|
43
|
+
if ((0, fs_1.existsSync)(yarnrcFilePath)) {
|
|
36
44
|
const updateYarnrcTask = context.getSpinner('Updating generated .yarn.yml file...');
|
|
37
45
|
updateYarnrcTask.start();
|
|
38
|
-
const yarnrc = js_yaml_1.load(await fs_1.promises.readFile(yarnrcFilePath, { encoding: 'utf8' }));
|
|
46
|
+
const yarnrc = (0, js_yaml_1.load)(await fs_1.promises.readFile(yarnrcFilePath, { encoding: 'utf8' }));
|
|
39
47
|
if (yarnrc) {
|
|
48
|
+
const azurePatIdentBase64 = node_buffer_1.Buffer.from(`AmadeusDigitalAirline:${options['azure-token']}`).toString('base64');
|
|
40
49
|
yarnrc.npmRegistries || (yarnrc.npmRegistries = {});
|
|
41
50
|
(_a = yarnrc.npmRegistries)[registryUrl] || (_a[registryUrl] = {});
|
|
42
51
|
yarnrc.npmRegistries[registryUrl].npmAuthToken = options['registry-token'];
|
|
43
52
|
yarnrc.npmRegistries[registryUrl].npmAlwaysAuth = true;
|
|
44
|
-
|
|
53
|
+
azureRegistryUrls.forEach((url) => {
|
|
54
|
+
var _a;
|
|
55
|
+
(_a = yarnrc.npmRegistries)[url] || (_a[url] = {});
|
|
56
|
+
yarnrc.npmRegistries[url].npmAuthIdent = azurePatIdentBase64;
|
|
57
|
+
yarnrc.npmRegistries[url].npmAlwaysAuth = true;
|
|
58
|
+
});
|
|
59
|
+
await fs_1.promises.writeFile(yarnrcFilePath, (0, js_yaml_1.dump)(yarnrc));
|
|
45
60
|
}
|
|
46
61
|
updateYarnrcTask.succeed('.yarnrc.yml file updated');
|
|
47
62
|
}
|
|
48
|
-
await context.getSpinner('Clean up setup materials').fromPromise(fs_1.promises.unlink(path_1.resolve(cwd, npmrcFile)));
|
|
49
|
-
logger.info(`Application created in ${path_1.resolve(cwd, `${options.airline}-${options.flavour}`)}`);
|
|
63
|
+
await context.getSpinner('Clean up setup materials').fromPromise(fs_1.promises.unlink((0, path_1.resolve)(cwd, npmrcFile)));
|
|
64
|
+
logger.info(`Application created in ${(0, path_1.resolve)(cwd, `${options.airline}-${options.flavour}`)}`);
|
|
50
65
|
};
|
|
51
66
|
exports.createCustomApplication = createCustomApplication;
|
|
52
67
|
//# sourceMappingURL=create-custom-application.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-custom-application.command.js","sourceRoot":"","sources":["../src/create-custom-application.command.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AACzD,2BAAgD;AAChD,qCAAqC;AACrC,+BAA+B;AAC/B,yDAAwD;
|
|
1
|
+
{"version":3,"file":"create-custom-application.command.js","sourceRoot":"","sources":["../src/create-custom-application.command.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AACzD,2BAAgD;AAChD,qCAAqC;AACrC,6CAAqC;AACrC,+BAA+B;AAC/B,yDAAwD;AA2BxD;;;;;GAKG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAAE,OAAgB,EAAE,OAA+B,EAAE,EAAE;;IACjG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE3B,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,GAAG,CAAC;IAEzB,MAAM,SAAS,GAAG,WAAW,CAAC;IAC9B,MAAM,eAAe,GAAG,+FAA+F,CAAC;IACxH,MAAM,WAAW,GAAG,qEAAqE,CAAC;IAC1F,MAAM,iBAAiB,GAAG;QACxB,uFAAuF;QACvF,iFAAiF;KAClF,CAAC;IAEF,MAAM,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,WAAW,CAC9D,aAAE,CAAC,SAAS,CAAC,IAAA,cAAO,EAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IA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C,0BAA0B,CAAC,CAAC;KACtD;IAED,MAAM,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,WAAW,CAC9D,aAAE,CAAC,MAAM,CAAC,IAAA,cAAO,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CACnC,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAA,cAAO,EAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC,CAAC;AAhEW,QAAA,uBAAuB,2BAgElC"}
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,12 @@ module.exports = {
|
|
|
29
29
|
type: 'string',
|
|
30
30
|
description: 'Token used for Amadeus NPM registries',
|
|
31
31
|
demandOption: 'Amadeus NPM registries token is mandatory'
|
|
32
|
+
})
|
|
33
|
+
.option(core_1.EXTRA_COMMON_OPTIONS.azureToken, {
|
|
34
|
+
...core_1.MODULE_OPTIONS.azureToken,
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Azure registry Personal Access Token',
|
|
37
|
+
demandOption: 'Azure registry PAT is mandatory'
|
|
32
38
|
})
|
|
33
39
|
.option('otter-version', {
|
|
34
40
|
alias: ['O'],
|
|
@@ -47,7 +53,7 @@ module.exports = {
|
|
|
47
53
|
type: 'boolean',
|
|
48
54
|
default: true,
|
|
49
55
|
description: 'Add material dependency'
|
|
50
|
-
}), (options) => create_application_command_1.createApplication(baseContext.getContext(options), options))
|
|
56
|
+
}), (options) => (0, create_application_command_1.createApplication)(baseContext.getContext(options), options))
|
|
51
57
|
.command('custom-application <airline>', 'Generate Otter custom application', (yargs) => yargs
|
|
52
58
|
.positional('airline', {
|
|
53
59
|
type: 'string',
|
|
@@ -64,7 +70,7 @@ module.exports = {
|
|
|
64
70
|
type: 'string',
|
|
65
71
|
default: '5.4.0',
|
|
66
72
|
description: 'The git tag of the white label that is to be customized.'
|
|
67
|
-
}), (options) => create_custom_application_command_1.createCustomApplication(baseContext.getContext(options), options)));
|
|
73
|
+
}), (options) => (0, create_custom_application_command_1.createCustomApplication)(baseContext.getContext(options), options)));
|
|
68
74
|
}
|
|
69
75
|
};
|
|
70
76
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA8B;AAC9B,2CAAsF;AACtF,6EAAiE;AACjE,2FAA8E;AAE9E,MAAM,IAAI,GAAG,OAAO,CAAC;AAErB,MAAM,CAAC,OAAO,GAAG;IACf,IAAI;IACJ,WAAW,EAAE,sCAAsC;IACnD,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;QAC3B,OAAO,KAAK;aACT,MAAM,CAAC,2BAAoB,CAAC,IAAI,EAAE;YACjC,GAAG,qBAAc,CAAC,IAAI;YACtB,IAAI,EAAE,SAAS;SAChB,CAAC;aACD,aAAa,EAAE;aACf,OAAO,CAAC,QAAQ,EAAE,oCAAoC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;aACtE,KAAK,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;aACjE,aAAa,EAAE;aACf,MAAM,CAAC,2BAAoB,CAAC,IAAI,EAAE;YACjC,GAAG,qBAAc,CAAC,IAAI;YACtB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,mCAAmC;SACjD,CAAC;aACD,MAAM,CAAC,2BAAoB,CAAC,aAAa,EAAE;YAC1C,GAAG,qBAAc,CAAC,aAAa;YAC/B,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uCAAuC;YACpD,YAAY,EAAE,2CAA2C;SAC1D,CAAC;aACD,MAAM,CAAC,eAAe,EAAE;YACvB,KAAK,EAAE,CAAC,GAAG,CAAC;YACZ,IAAI,EAAE,Q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E,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC;YAChD,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,qCAAqC;SACpD,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,0DAA0D;SACxE,CAAC,EACF,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,2DAAuB,EAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAC/E,CACF,CAAC;IACN,CAAC;CACc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/amaterasu-otter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "Command Line Interface to administrate a DES project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"tslib": "^2.3.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ama-terasu/core": "^0.0.
|
|
20
|
-
"@types/js-yaml": "^4.0.
|
|
21
|
-
"@types/node": "^
|
|
22
|
-
"typescript": "^4.3
|
|
19
|
+
"@ama-terasu/core": "^0.0.44",
|
|
20
|
+
"@types/js-yaml": "^4.0.5",
|
|
21
|
+
"@types/node": "^17.0.23",
|
|
22
|
+
"typescript": "^4.6.3"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@ama-terasu/core": "^0.0.
|
|
25
|
+
"@ama-terasu/core": "^0.0.44"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=14.0.0",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Context } from '@ama-terasu/core';
|
|
2
|
-
/** Option to create an SDK */
|
|
3
|
-
export interface CreateSdkOptions {
|
|
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
|
-
/** Registry Token */
|
|
15
|
-
'registry-token': string;
|
|
16
|
-
/**
|
|
17
|
-
* Specification file path
|
|
18
|
-
*/
|
|
19
|
-
'spec-path': string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Create an Otter SDK
|
|
23
|
-
*
|
|
24
|
-
* @param context Context of the command
|
|
25
|
-
* @param options Options
|
|
26
|
-
*/
|
|
27
|
-
export declare const createSdk: (context: Context, options: CreateSdkOptions) => Promise<void>;
|
|
28
|
-
//# sourceMappingURL=create-sdk.command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-sdk.command.d.ts","sourceRoot":"","sources":["../src/create-sdk.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAKzD,8BAA8B;AAC9B,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,qBAAqB;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAmB,OAAO,WAAW,gBAAgB,kBAmC1E,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSdk = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const core_1 = require("@ama-terasu/core");
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path = tslib_1.__importStar(require("path"));
|
|
8
|
-
const commands_helpers_1 = require("./commands.helpers");
|
|
9
|
-
/**
|
|
10
|
-
* Create an Otter SDK
|
|
11
|
-
*
|
|
12
|
-
* @param context Context of the command
|
|
13
|
-
* @param options Options
|
|
14
|
-
*/
|
|
15
|
-
const createSdk = async (context, options) => {
|
|
16
|
-
const { logger } = context;
|
|
17
|
-
const cwd = path.resolve(process.cwd(), options.path);
|
|
18
|
-
const npmrcFile = 'tmp.npmrc';
|
|
19
|
-
const authTokenRegExp = /^(\/\/digitalforairlines.jfrog.io\/digitalforairlines\/api\/npm\/npm-otter\/:_authToken).*$/gm;
|
|
20
|
-
const deps = {
|
|
21
|
-
'@dapi/generator-sdk': '^3.0.16',
|
|
22
|
-
yo: '^3.1.1'
|
|
23
|
-
};
|
|
24
|
-
await context.getSpinner('Add Otter/Dapi registry').fromPromise(fs_1.promises.writeFile(path.resolve(cwd, npmrcFile), commands_helpers_1.generateBasicNpmrc(options['registry-token'])));
|
|
25
|
-
await context.getSpinner('Generate new SDK').fromPromise(core_1.promiseSpawn(`npx ${Object.entries(deps).map(([n, v]) => `-p ${n}@${v}`).join(' ')} --userconfig ${npmrcFile} yo${options.yes ? ' --force' : ''} @dapi/sdk:dapi-extension --projectName "${options.name}" --specPath ${options['spec-path']}`, { cwd, stderrLogger: logger.debug, logger }));
|
|
26
|
-
const npmrcFilePath = path.resolve(cwd, '.npmrc');
|
|
27
|
-
if (fs_1.existsSync(npmrcFilePath)) {
|
|
28
|
-
const updateNpmrcTask = context.getSpinner('Update generated .npmrc file');
|
|
29
|
-
updateNpmrcTask.start();
|
|
30
|
-
const generatedNpmrc = await fs_1.promises.readFile(npmrcFilePath, { encoding: 'utf-8' });
|
|
31
|
-
const newNpmrcContent = generatedNpmrc.replace(authTokenRegExp, `$1=${options['registry-token']}`);
|
|
32
|
-
await fs_1.promises.writeFile(npmrcFilePath, newNpmrcContent);
|
|
33
|
-
updateNpmrcTask.succeed();
|
|
34
|
-
}
|
|
35
|
-
await context.getSpinner('Clean up setup materials').fromPromise(fs_1.promises.unlink(path.resolve(cwd, npmrcFile)));
|
|
36
|
-
logger.info(`Application created in ${cwd}`);
|
|
37
|
-
};
|
|
38
|
-
exports.createSdk = createSdk;
|
|
39
|
-
//# sourceMappingURL=create-sdk.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-sdk.command.js","sourceRoot":"","sources":["../src/create-sdk.command.ts"],"names":[],"mappings":";;;;AAAA,2CAAyD;AACzD,2BAAgD;AAChD,mDAA6B;AAC7B,yDAAwD;AAsBxD;;;;;GAKG;AACI,MAAM,SAAS,GAAG,KAAK,EAAE,OAAgB,EAAE,OAAyB,EAAE,EAAE;IAC7E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD,MAAM,SAAS,GAAG,WAAW,CAAC;IAC9B,MAAM,eAAe,GAAG,+FAA+F,CAAC;IACxH,MAAM,IAAI,GAAG;QACX,qBAAqB,EAAE,SAAS;QAChC,EAAE,EAAE,QAAQ;KACb,CAAC;IAEF,MAAM,OAAO,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC,WAAW,CAC7D,aAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,qCAAkB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAC1F,CAAC;IAEF,MAAM,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,WAAW,CACtD,mBAAY,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MA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