@pristine-ts/cli 0.0.304 → 0.0.305
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/lib/cjs/cli.js +45 -9
- package/dist/lib/cjs/cli.js.map +1 -1
- package/package.json +9 -7
package/dist/lib/cjs/cli.js
CHANGED
|
@@ -38,6 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
38
|
const core_1 = require("@pristine-ts/core");
|
|
39
39
|
const fs_1 = __importDefault(require("fs"));
|
|
40
40
|
const logging_1 = require("@pristine-ts/logging");
|
|
41
|
+
const file_1 = require("@pristine-ts/file");
|
|
41
42
|
const getLocalAppModuleCJSPath = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
43
|
return new Promise((resolve, reject) => {
|
|
43
44
|
const packageJson = process.cwd() + "/package.json";
|
|
@@ -46,36 +47,71 @@ const getLocalAppModuleCJSPath = () => __awaiter(void 0, void 0, void 0, functio
|
|
|
46
47
|
const message = "Cannot find the package.json at '" + packageJson + "'. Make sure that you execute this script directly from the parent of your 'package.json'";
|
|
47
48
|
console.error(message);
|
|
48
49
|
console.error(err);
|
|
49
|
-
|
|
50
|
+
return resolve(undefined);
|
|
50
51
|
}
|
|
51
52
|
const { pristine } = yield Promise.resolve(`${packageJson}`).then(s => __importStar(require(s)));
|
|
52
53
|
if (pristine === undefined) {
|
|
53
54
|
const message = "There needs to be a section 'pristine' in your package.json file located at: '" + packageJson + "'";
|
|
54
55
|
console.error(message);
|
|
55
|
-
|
|
56
|
+
return resolve(undefined);
|
|
56
57
|
}
|
|
57
58
|
if (pristine.appModule === undefined) {
|
|
58
59
|
const message = "There should be a section 'appModule' under 'pristine' in your package.json file located at: '" + packageJson + "'";
|
|
59
60
|
console.error(message);
|
|
60
|
-
|
|
61
|
+
return resolve(undefined);
|
|
61
62
|
}
|
|
62
63
|
if (pristine.appModule.cjsPath === undefined) {
|
|
63
64
|
const message = "There should be a property 'cjsPath' under 'pristine.appModule' in your package.json file located at: '" + packageJson + "'";
|
|
64
65
|
console.error(message);
|
|
65
|
-
|
|
66
|
+
return resolve(undefined);
|
|
66
67
|
}
|
|
67
68
|
return resolve(process.cwd() + "/" + pristine.appModule.cjsPath);
|
|
68
69
|
}));
|
|
69
70
|
});
|
|
70
71
|
});
|
|
71
72
|
const bootstrap = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
let localAppModule;
|
|
74
|
+
let isLoggingModulePresent = false;
|
|
72
75
|
const cjsPath = yield getLocalAppModuleCJSPath();
|
|
73
|
-
|
|
76
|
+
if (cjsPath !== undefined) {
|
|
77
|
+
localAppModule = (yield Promise.resolve(`${cjsPath}`).then(s => __importStar(require(s)))).AppModule;
|
|
78
|
+
isLoggingModulePresent = localAppModule.importModules.find((module) => module.keyname === logging_1.LoggingModuleKeyname) !== undefined;
|
|
79
|
+
}
|
|
80
|
+
else { // Try the automatic Module creation.
|
|
81
|
+
// Loop over the `node_modules/@pristine-ts/*/dist/lib/cjs/*.module.js` folders and find all the module files that are loaded.
|
|
82
|
+
const directoryManager = new file_1.DirectoryManager();
|
|
83
|
+
const moduleFiles = yield directoryManager.list(process.cwd() + "/node_modules/@pristine-ts", {
|
|
84
|
+
matchType: file_1.MatchTypeEnum.Path,
|
|
85
|
+
match: /.*\/cjs\/.*\.module\.js$/,
|
|
86
|
+
types: file_1.TypesEnum.File,
|
|
87
|
+
resultType: file_1.DirectoryListResultEnum.FilePath,
|
|
88
|
+
recurse: true,
|
|
89
|
+
});
|
|
90
|
+
const modules = [];
|
|
91
|
+
for (const moduleFile of moduleFiles) {
|
|
92
|
+
const module = yield Promise.resolve(`${moduleFile}`).then(s => __importStar(require(s)));
|
|
93
|
+
for (const key in module) {
|
|
94
|
+
if (key === "LoggingModule") {
|
|
95
|
+
isLoggingModulePresent = true;
|
|
96
|
+
}
|
|
97
|
+
if (key.endsWith("Module")) {
|
|
98
|
+
modules.push(module[key]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
localAppModule = {
|
|
103
|
+
keyname: "__auto_generated_app.module__",
|
|
104
|
+
importModules: modules,
|
|
105
|
+
importServices: [],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const configuration = {};
|
|
109
|
+
if (isLoggingModulePresent) {
|
|
110
|
+
configuration[logging_1.LoggingModuleKeyname + ".consoleLoggerOutputMode"] = logging_1.OutputModeEnum.Simple;
|
|
111
|
+
configuration[logging_1.LoggingModuleKeyname + ".logSeverityLevelConfiguration"] = logging_1.SeverityEnum.Error;
|
|
112
|
+
}
|
|
74
113
|
const kernel = new core_1.Kernel();
|
|
75
|
-
yield kernel.start(localAppModule
|
|
76
|
-
[logging_1.LoggingModuleKeyname + ".consoleLoggerOutputMode"]: logging_1.OutputModeEnum.Simple,
|
|
77
|
-
[logging_1.LoggingModuleKeyname + ".logSeverityLevelConfiguration"]: logging_1.SeverityEnum.Error,
|
|
78
|
-
});
|
|
114
|
+
yield kernel.start(localAppModule, configuration);
|
|
79
115
|
yield kernel.handle(process.argv, { keyname: core_1.ExecutionContextKeynameEnum.Cli, context: null });
|
|
80
116
|
});
|
|
81
117
|
bootstrap();
|
package/dist/lib/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsE;AACtE,4CAAoB;AACpB,kDAAwF;AACxF,4CAAsG;AAItG,MAAM,wBAAwB,GAAG,GAAsC,EAAE;IACrE,OAAO,IAAI,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACvD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,E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zB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC;QACL,CAAC;QAED,cAAc,GAAG;YACb,OAAO,EAAE,+BAA+B;YACxC,aAAa,EAAE,OAAO;YACtB,cAAc,EAAE,EAAE;SACrB,CAAA;IACL,CAAC;IAED,MAAM,aAAa,GAAgD,EAAE,CAAC;IAEtE,IAAG,sBAAsB,EAAE,CAAC;QACxB,aAAa,CAAC,8BAAoB,GAAG,0BAA0B,CAAC,GAAG,wBAAc,CAAC,MAAM,CAAC;QACzF,aAAa,CAAC,8BAAoB,GAAG,gCAAgC,CAAC,GAAG,sBAAY,CAAC,KAAK,CAAC;IAChG,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,aAAM,EAAE,CAAC;IAC5B,MAAM,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;IAElD,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAC,OAAO,EAAE,kCAA2B,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAA;AAChG,CAAC,CAAA,CAAA;AAED,SAAS,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.305",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/cli.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/cli.module.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
|
|
13
13
|
"prepublish": "npm run build",
|
|
14
14
|
"test": "jest",
|
|
15
|
-
"test:cov": "jest --coverage"
|
|
15
|
+
"test:cov": "jest --coverage",
|
|
16
|
+
"pristine:command": "pristine help"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"dist"
|
|
@@ -23,10 +24,11 @@
|
|
|
23
24
|
"access": "public"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@pristine-ts/common": "^0.0.
|
|
27
|
-
"@pristine-ts/core": "^0.0.
|
|
28
|
-
"@pristine-ts/
|
|
29
|
-
"@pristine-ts/
|
|
27
|
+
"@pristine-ts/common": "^0.0.305",
|
|
28
|
+
"@pristine-ts/core": "^0.0.305",
|
|
29
|
+
"@pristine-ts/file": "^0.0.305",
|
|
30
|
+
"@pristine-ts/logging": "^0.0.305",
|
|
31
|
+
"@pristine-ts/validation": "^0.0.305",
|
|
30
32
|
"class-transformer": "^0.5.1"
|
|
31
33
|
},
|
|
32
34
|
"jest": {
|
|
@@ -63,5 +65,5 @@
|
|
|
63
65
|
"src/*.{js,ts}"
|
|
64
66
|
]
|
|
65
67
|
},
|
|
66
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ed6e909488deb638ee7901c4e7663e57cca1b9a2"
|
|
67
69
|
}
|