@o3r/amaterasu-otter 0.0.18 → 0.0.22
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/create-application.command.d.ts +36 -0
- package/dist/create-application.command.d.ts.map +1 -0
- package/dist/create-application.command.js +41 -0
- package/dist/create-application.command.js.map +1 -0
- package/dist/create-sdk.command.d.ts +28 -0
- package/dist/create-sdk.command.d.ts.map +1 -0
- package/dist/create-sdk.command.js +39 -0
- package/dist/create-sdk.command.js.map +1 -0
- package/dist/index.js +23 -36
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/readme.md +15 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context } from '@o3r-ama/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
|
+
/** Registry Token */
|
|
15
|
+
'registry-token': 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
|
+
//# sourceMappingURL=create-application.command.d.ts.map
|
|
@@ -0,0 +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,eAAe,CAAC;AAKtD,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;;;;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,kBA2C1F,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApplication = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@o3r-ama/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 Application
|
|
11
|
+
*
|
|
12
|
+
* @param context Context of the command
|
|
13
|
+
* @param options Options
|
|
14
|
+
*/
|
|
15
|
+
const createApplication = async (context, options) => {
|
|
16
|
+
const { logger } = context;
|
|
17
|
+
let cwd = path.resolve(process.cwd(), options.path);
|
|
18
|
+
const directory = options.name.replace(/ /g, '-');
|
|
19
|
+
if (!fs_1.existsSync(cwd)) {
|
|
20
|
+
await fs_1.promises.mkdir(cwd, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
await context.getSpinner('Create 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'}`, { cwd, logger, stderrLogger: logger.debug }));
|
|
23
|
+
cwd = path.resolve(cwd, directory);
|
|
24
|
+
await context.getSpinner('Add Otter registry').fromPromise(fs_1.promises.writeFile(path.resolve(cwd, '.npmrc'), commands_helpers_1.generateBasicNpmrc(options['registry-token'])));
|
|
25
|
+
await context.getSpinner('NPM Installation').fromPromise(core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npm'} install`, { cwd, logger, stderrLogger: logger.debug }));
|
|
26
|
+
await context.getSpinner('Add Otter Dependency').fromPromise(core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npx'} ng add @otter/ng-tools --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }));
|
|
27
|
+
if (options.material) {
|
|
28
|
+
await context.getSpinner('Add Material Dependency').fromPromise(core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npx'} ng add @angular/material --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }));
|
|
29
|
+
const updateStyleTask = context.getSpinner('Update style');
|
|
30
|
+
updateStyleTask.start();
|
|
31
|
+
const style = await (await fs_1.promises.readFile(path.resolve(cwd, 'src/styles.scss'), { encoding: 'utf-8' }))
|
|
32
|
+
.replace('// @include mat-core', '@include mat-core')
|
|
33
|
+
.replace('// @include angular-material-typography', '@include angular-material-typography')
|
|
34
|
+
.replace('// @include angular-material-theme', '@include angular-material-theme');
|
|
35
|
+
await fs_1.promises.writeFile(path.resolve(cwd, 'src/styles.scss'), style);
|
|
36
|
+
updateStyleTask.succeed();
|
|
37
|
+
}
|
|
38
|
+
logger.info(`Application created in ${cwd}`);
|
|
39
|
+
};
|
|
40
|
+
exports.createApplication = createApplication;
|
|
41
|
+
//# sourceMappingURL=create-application.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-application.command.js","source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CAAC,CAAC;QACpF,MAAM,aAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,KAAK,CAAC,CAAC;QAChE,eAAe,CAAC,OAAO,EAAE,CAAC;KAC3B;IAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AA3CW,QAAA,iBAAiB,qBA2C5B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Context } from '@o3r-ama/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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-sdk.command.d.ts","sourceRoot":"","sources":["../src/create-sdk.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAC;AAKtD,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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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("@o3r-ama/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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-sdk.command.js","sourceRoot":"","sources":["../src/create-sdk.command.ts"],"names":[],"mappings":";;;;AAAA,wCAAsD;AACtD,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;IA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C;QACnD,eAAe,CAAC,OAAO,EAAE,CAAC;KAC3B;IAED,MAAM,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,WAAW,CAC9D,aAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CACxC,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAnCW,QAAA,SAAS,aAmCpB"}
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
/* eslint-disable no-shadow */
|
|
5
4
|
const core_1 = require("@o3r-ama/core");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
5
|
+
const create_application_command_1 = require("./create-application.command");
|
|
6
|
+
const create_sdk_command_1 = require("./create-sdk.command");
|
|
7
|
+
const name = 'otter';
|
|
9
8
|
module.exports = {
|
|
10
|
-
name
|
|
9
|
+
name,
|
|
11
10
|
description: 'Commands relative to Otter framework',
|
|
12
|
-
init: (yargs,
|
|
11
|
+
init: (yargs, baseContext) => {
|
|
13
12
|
return yargs
|
|
14
13
|
.option('yarn', {
|
|
15
14
|
type: 'boolean',
|
|
16
|
-
description: 'Use Yarn instead of NPM'
|
|
15
|
+
description: 'Use Yarn instead of NPM',
|
|
17
16
|
})
|
|
18
17
|
.demandCommand()
|
|
19
18
|
.command('create', 'Generate a new Otter based project', (yargs) => yargs
|
|
19
|
+
.usage(baseContext.generateUsageMessage(name, 'create <command>'))
|
|
20
20
|
.demandCommand()
|
|
21
|
-
.option(
|
|
21
|
+
.option(core_1.EXTRA_COMMON_OPTIONS.path, {
|
|
22
|
+
...core_1.MODULE_OPTIONS.path,
|
|
22
23
|
type: 'string',
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
default: '.',
|
|
25
|
+
description: 'Path to the generated application'
|
|
25
26
|
})
|
|
26
27
|
.option(core_1.EXTRA_COMMON_OPTIONS.registryToken, {
|
|
27
28
|
...core_1.MODULE_OPTIONS.registryToken,
|
|
@@ -38,32 +39,18 @@ module.exports = {
|
|
|
38
39
|
.option('material', {
|
|
39
40
|
type: 'boolean',
|
|
40
41
|
description: 'Add material dependency'
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
await context.getSpinner('Add Otter Dependency').fromPromise(core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npx'} ng add @otter/ng-tools --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }));
|
|
54
|
-
if (options.material) {
|
|
55
|
-
await context.getSpinner('Add Material Dependency').fromPromise(core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npx'} ng add @angular/material --interactive=${!options.yes} --skip-confirmation`, { cwd, logger, stderrLogger: logger.debug }));
|
|
56
|
-
const updateStyleTask = context.getSpinner('Update style');
|
|
57
|
-
updateStyleTask.start();
|
|
58
|
-
const style = await (await fs_1.promises.readFile(path.resolve(cwd, 'src/styles.scss'), { encoding: 'utf-8' }))
|
|
59
|
-
.replace('// @include mat-core', '@include mat-core')
|
|
60
|
-
.replace('// @include angular-material-typography', '@include angular-material-typography')
|
|
61
|
-
.replace('// @include angular-material-theme', '@include angular-material-theme');
|
|
62
|
-
await fs_1.promises.writeFile(path.resolve(cwd, 'src/styles.scss'), style);
|
|
63
|
-
updateStyleTask.succeed();
|
|
64
|
-
}
|
|
65
|
-
logger.info(`Application created in ${cwd}`);
|
|
66
|
-
}));
|
|
42
|
+
}), (options) => create_application_command_1.createApplication(baseContext.getContext(options), options))
|
|
43
|
+
.command('sdk <name>', 'Generate a new SDK', (yargs) => yargs
|
|
44
|
+
.positional('name', {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'SDK name',
|
|
47
|
+
demandOption: 'SDK name is mandatory'
|
|
48
|
+
})
|
|
49
|
+
.option('spec-path', {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Specification file',
|
|
52
|
+
demandOption: 'Need a specification to generate an SDK'
|
|
53
|
+
}), (options) => create_sdk_command_1.createSdk(baseContext.getContext(options), options)));
|
|
67
54
|
}
|
|
68
55
|
};
|
|
69
56
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA8B;AAC9B,wCAAmF;AACnF,6EAAiE;AACjE,6DAAiD;AAEjD,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,MAAM,EAAE;YACd,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,yBAAyB;SACvC,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,OAAO,CAAC,oBAAoB,EAAE,wCAAwC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;aACtF,UAAU,CAAC,MAAM,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kBAAkB;YAC/B,YAAY,EAAE,+BAA+B;SAC9C,CAAC;aACD,MAAM,CAAC,UAAU,EAAE;YAClB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,yBAAyB;SACvC,CAAC,EACF,CAAC,OAAO,EAAE,EAAE,CAAC,8CAAiB,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CACzE;aACA,OAAO,CAAC,YAAY,EAAE,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;aAC1D,UAAU,CAAC,MAAM,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,uBAAuB;SACtC,CAAC;aACD,MAAM,CAAC,WAAW,EAAE;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,oBAAoB;YACjC,YAAY,EAAE,yCAAyC;SACxD,CAAC,EACF,CAAC,OAAO,EAAE,EAAE,CAAC,8BAAS,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CACjE,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.22",
|
|
4
4
|
"description": "Command Line Interface to administrate a DES project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"tslib": "^2.3.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@o3r-ama/core": "^0.0.
|
|
18
|
+
"@o3r-ama/core": "^0.0.22",
|
|
19
19
|
"@types/node": "^14.0.0",
|
|
20
20
|
"typescript": "^4.3.5"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@o3r-ama/core": "^0.0.
|
|
23
|
+
"@o3r-ama/core": "^0.0.22"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=14.0.0",
|
package/readme.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Ama-terasu Otter
|
|
2
|
+
|
|
3
|
+
This is a module for **Ama-terasu** CLI to execute action relative to the Otter Framework.
|
|
4
|
+
|
|
5
|
+
## Available commands
|
|
6
|
+
|
|
7
|
+
List of available command exposed by this module:
|
|
8
|
+
|
|
9
|
+
### create application
|
|
10
|
+
|
|
11
|
+
Generate a new Otter based application
|
|
12
|
+
|
|
13
|
+
### create sdk
|
|
14
|
+
|
|
15
|
+
Generate a Typescript SDK based on Digital Amadeus compatible specification
|