@o3r/amaterasu-otter 0.0.7 → 0.0.15
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/index.js +17 -38
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,37 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
22
4
|
/* eslint-disable no-shadow */
|
|
23
5
|
const core_1 = require("@o3r-ama/core");
|
|
24
6
|
const fs_1 = require("fs");
|
|
25
|
-
const path = __importStar(require("path"));
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
26
8
|
const commands_helpers_1 = require("./commands.helpers");
|
|
27
9
|
module.exports = {
|
|
28
10
|
name: 'otter',
|
|
29
11
|
description: 'Commands relative to Otter framework',
|
|
30
|
-
init: (yargs,
|
|
12
|
+
init: (yargs, contextFactory) => {
|
|
31
13
|
return yargs
|
|
32
14
|
.option('yarn', {
|
|
33
15
|
type: 'boolean',
|
|
34
|
-
description: 'Use
|
|
16
|
+
description: 'Use Yarn instead of NPM'
|
|
35
17
|
})
|
|
36
18
|
.demandCommand()
|
|
37
19
|
.command('create', 'Generate a new Otter based project', (yargs) => yargs
|
|
@@ -41,11 +23,11 @@ module.exports = {
|
|
|
41
23
|
description: 'Path to the generated application',
|
|
42
24
|
default: '.'
|
|
43
25
|
})
|
|
44
|
-
.option(
|
|
26
|
+
.option(core_1.EXTRA_COMMON_OPTIONS.registryToken, {
|
|
27
|
+
...core_1.MODULE_OPTIONS.registryToken,
|
|
45
28
|
type: 'string',
|
|
46
|
-
alias: 'T',
|
|
47
29
|
description: 'Token used for Amadeus NPM registries',
|
|
48
|
-
demandOption: '
|
|
30
|
+
demandOption: 'Amadeus NPM registries token is mandatory'
|
|
49
31
|
})
|
|
50
32
|
.command('application <name>', 'Generate a new Otter based application', (yargs) => yargs
|
|
51
33
|
.positional('name', {
|
|
@@ -57,32 +39,29 @@ module.exports = {
|
|
|
57
39
|
type: 'boolean',
|
|
58
40
|
description: 'Add material dependency'
|
|
59
41
|
}), async (options) => {
|
|
60
|
-
const
|
|
42
|
+
const context = contextFactory.getContext(options);
|
|
43
|
+
const { logger } = context;
|
|
61
44
|
let cwd = path.resolve(process.cwd(), options.path);
|
|
62
45
|
const directory = options.name.replace(/ /g, '-');
|
|
63
46
|
if (!fs_1.existsSync(cwd)) {
|
|
64
47
|
await fs_1.promises.mkdir(cwd, { recursive: true });
|
|
65
48
|
}
|
|
66
|
-
|
|
67
|
-
await 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, stderrLogger: logger.debug, stdoutLogger: logger.debug, logger });
|
|
49
|
+
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 }));
|
|
68
50
|
cwd = path.resolve(cwd, directory);
|
|
69
|
-
|
|
70
|
-
await
|
|
71
|
-
|
|
72
|
-
await core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npm'} install`, { cwd, stderrLogger: logger.debug, stdoutLogger: logger.debug, logger });
|
|
73
|
-
progress.tick({ title: 'Add Otter Dependency' });
|
|
74
|
-
await core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npx'} ng add @otter/ng-tools --interactive=${!options.yes} --skip-confirmation`, { cwd, stderrLogger: logger.debug, stdoutLogger: logger.debug, logger });
|
|
51
|
+
await context.getSpinner('Add Otter registry').fromPromise(fs_1.promises.writeFile(path.resolve(cwd, '.npmrc'), commands_helpers_1.generateBasicNpmrc(options['registry-token'])));
|
|
52
|
+
await context.getSpinner('NPM Installation').fromPromise(core_1.promiseSpawn(`${options.yarn ? 'yarn' : 'npm'} install`, { cwd, logger, stderrLogger: logger.debug }));
|
|
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 }));
|
|
75
54
|
if (options.material) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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();
|
|
79
58
|
const style = await (await fs_1.promises.readFile(path.resolve(cwd, 'src/styles.scss'), { encoding: 'utf-8' }))
|
|
80
59
|
.replace('// @include mat-core', '@include mat-core')
|
|
81
60
|
.replace('// @include angular-material-typography', '@include angular-material-typography')
|
|
82
61
|
.replace('// @include angular-material-theme', '@include angular-material-theme');
|
|
83
62
|
await fs_1.promises.writeFile(path.resolve(cwd, 'src/styles.scss'), style);
|
|
63
|
+
updateStyleTask.succeed();
|
|
84
64
|
}
|
|
85
|
-
progress.terminate();
|
|
86
65
|
logger.info(`Application created in ${cwd}`);
|
|
87
66
|
}));
|
|
88
67
|
}
|
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,wCAAiG;AACjG,2BAAgD;AAChD,mDAA6B;AAC7B,yDAAwD;AAExD,MAAM,CAAC,OAAO,GAAG;IACf,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,sCAAsC;IACnD,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;QAC9B,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,aAAa,EAAE;aACf,MAAM,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,mCAAmC;YAChD,OAAO,EAAE,GAAG;SACb,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,w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E,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;qBACjG,OAAO,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;qBACpD,OAAO,CAAC,yCAAyC,EAAE,sCAAsC,CAAC;qBAC1F,OAAO,CAAC,oCAAoC,EAAE,iCAAiC,CAAC,CAAC;gBACpF,MAAM,aAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,KAAK,CAAC,CAAC;gBAChE,eAAe,CAAC,OAAO,EAAE,CAAC;aAC3B;YAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CACH,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.15",
|
|
4
4
|
"description": "Command Line Interface to administrate a DES project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/"
|
|
13
13
|
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"tslib": "^2.3.1"
|
|
16
|
+
},
|
|
14
17
|
"devDependencies": {
|
|
15
|
-
"@o3r-ama/core": "^0.0.
|
|
16
|
-
"@types/
|
|
18
|
+
"@o3r-ama/core": "^0.0.15",
|
|
19
|
+
"@types/node": "^14.0.0",
|
|
17
20
|
"typescript": "^4.3.5"
|
|
18
21
|
},
|
|
19
22
|
"peerDependencies": {
|
|
20
|
-
"@o3r-ama/core": "^0.0.
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"prompts": "^2.4.1"
|
|
23
|
+
"@o3r-ama/core": "^0.0.15"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": "
|
|
26
|
+
"node": ">=14.0.0",
|
|
27
27
|
"vscode": "^1.22.0"
|
|
28
28
|
}
|
|
29
29
|
}
|