@c8y/websdk 1020.40.1 → 1021.0.4
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/ng-add/index.js +25 -46
- package/dist/ng-add/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/ng-add/load-esm.d.ts +0 -13
- package/dist/ng-add/load-esm.js +0 -25
- package/dist/ng-add/load-esm.js.map +0 -1
package/dist/ng-add/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ngAdd =
|
|
3
|
+
exports.ngAdd = ngAdd;
|
|
4
4
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
|
-
const load_esm_1 = require("./load-esm");
|
|
6
5
|
const helpers_1 = require("yargs/helpers");
|
|
7
6
|
const yargs = require("yargs");
|
|
8
7
|
const fs_extra_1 = require("fs-extra");
|
|
@@ -11,6 +10,7 @@ const path_1 = require("path");
|
|
|
11
10
|
const npmFetch = require("npm-registry-fetch");
|
|
12
11
|
const npmConfig = require("@npmcli/config");
|
|
13
12
|
const definitions_1 = require("@npmcli/config/lib/definitions");
|
|
13
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
14
14
|
/**
|
|
15
15
|
* This function adds a rule to the tree using the provided commandline options, predefined
|
|
16
16
|
* application options and module definitions.
|
|
@@ -28,7 +28,6 @@ function ngAdd(options) {
|
|
|
28
28
|
triggerDevkitNgAdd(appName, selectedVersion, tree, context, options);
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
exports.ngAdd = ngAdd;
|
|
32
31
|
async function getApplicationNameAndVersion(argAppPackage, registry) {
|
|
33
32
|
// case 0: ''
|
|
34
33
|
if (!argAppPackage) {
|
|
@@ -89,56 +88,36 @@ function triggerDevkitNgAdd(appName, selectedVersion, tree, context, options) {
|
|
|
89
88
|
}
|
|
90
89
|
async function chooseProjectToScaffoldFrom() {
|
|
91
90
|
const pathToAppList = (0, path_1.join)(__dirname, '../app-list.json');
|
|
92
|
-
const choices = await (0, fs_extra_1.readJson)(pathToAppList)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
name: 'base_project',
|
|
99
|
-
message: 'Which base project do you want to scaffold from?',
|
|
100
|
-
choices
|
|
101
|
-
}
|
|
102
|
-
])
|
|
103
|
-
.then((input) => {
|
|
104
|
-
return `@c8y/${input.base_project}`;
|
|
91
|
+
const choices = (await (0, fs_extra_1.readJson)(pathToAppList)).map(appName => ({
|
|
92
|
+
value: appName
|
|
93
|
+
}));
|
|
94
|
+
const selectedAppName = await (0, prompts_1.select)({
|
|
95
|
+
message: 'Which base project do you want to scaffold from?',
|
|
96
|
+
choices
|
|
105
97
|
});
|
|
98
|
+
return `@c8y/${selectedAppName}`;
|
|
106
99
|
}
|
|
107
100
|
async function selectBaseVersion(shownVersions) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
name: 'base_version',
|
|
114
|
-
message: 'Which base version do you want to scaffold from?',
|
|
115
|
-
choices: shownVersions
|
|
116
|
-
}
|
|
117
|
-
])
|
|
118
|
-
.then(async (answers) => {
|
|
119
|
-
if (answers.base_version.includes('latest') || answers.base_version.includes('next')) {
|
|
120
|
-
// Check if latest or next was selected and clean the string to include only the version.
|
|
121
|
-
answers.base_version = answers.base_version.split(' (')[0];
|
|
122
|
-
}
|
|
123
|
-
else if (answers.base_version === 'other') {
|
|
124
|
-
answers.base_version = await otherVersionSelectedPrompt();
|
|
125
|
-
}
|
|
126
|
-
return answers.base_version;
|
|
101
|
+
let result = '';
|
|
102
|
+
const choices = shownVersions.map(version => ({ value: version }));
|
|
103
|
+
const answer = await (0, prompts_1.select)({
|
|
104
|
+
message: 'Which base version do you want to scaffold from?',
|
|
105
|
+
choices
|
|
127
106
|
});
|
|
107
|
+
if (answer.includes('latest') || answer.includes('next')) {
|
|
108
|
+
// Check if latest or next was selected and clean the string to include only the version.
|
|
109
|
+
result = answer.split(' (')[0];
|
|
110
|
+
}
|
|
111
|
+
else if (answer === 'other') {
|
|
112
|
+
result = await otherVersionSelectedPrompt();
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
128
115
|
}
|
|
129
116
|
async function otherVersionSelectedPrompt() {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
.prompt([
|
|
133
|
-
{
|
|
134
|
-
type: 'input',
|
|
135
|
-
name: 'version_choice',
|
|
136
|
-
message: 'Enter the desired version: '
|
|
137
|
-
}
|
|
138
|
-
])
|
|
139
|
-
.then((input) => {
|
|
140
|
-
return input.version_choice;
|
|
117
|
+
const answer = await (0, prompts_1.input)({
|
|
118
|
+
message: 'Enter the desired version: '
|
|
141
119
|
});
|
|
120
|
+
return answer;
|
|
142
121
|
}
|
|
143
122
|
async function getAllRelevantVersions(appName, registry) {
|
|
144
123
|
const versionLimit = 5;
|
package/dist/ng-add/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ng-add/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ng-add/index.ts"],"names":[],"mappings":";;AAuBA,sBAaC;AAnCD,4DAA4F;AAC5F,2CAAwC;AACxC,+BAA+B;AAC/B,uCAAoC;AACpC,2EAIkD;AAClD,+BAA4B;AAE5B,+CAA+C;AAC/C,4CAA4C;AAC5C,gEAAkF;AAClF,+CAAkD;AAElD;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,OAA+B;IACnD;;OAEG;IACH,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACrD,MAAM,QAAQ,GAAG,IAAI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,CAAC;QACtC,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;IAED,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,OAAO,CAAC,CAAC;IACxC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC;AACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c8y/websdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1021.0.4",
|
|
4
4
|
"description": "Allows to scaffold a Cumulocity IoT application with ng add @c8y/websdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"scripts": {
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
"dist/"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"yargs": "17.7.2",
|
|
19
|
+
"@inquirer/prompts": "5.3.7",
|
|
20
|
+
"@npmcli/config": "^8.3.4",
|
|
21
|
+
"npm-registry-fetch": "^17.1.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/npmcli__config": "^6.0.3",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This uses a dynamic import to load a module which may be ESM.
|
|
3
|
-
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
4
|
-
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
5
|
-
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
6
|
-
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
7
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
8
|
-
* be dropped.
|
|
9
|
-
*
|
|
10
|
-
* @param modulePath The path of the module to load.
|
|
11
|
-
* @returns A Promise that resolves to the dynamically imported module.
|
|
12
|
-
*/
|
|
13
|
-
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
package/dist/ng-add/load-esm.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadEsmModule = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Lazily compiled dynamic import loader function.
|
|
6
|
-
*/
|
|
7
|
-
let load;
|
|
8
|
-
/**
|
|
9
|
-
* This uses a dynamic import to load a module which may be ESM.
|
|
10
|
-
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
11
|
-
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
12
|
-
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
13
|
-
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
14
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
15
|
-
* be dropped.
|
|
16
|
-
*
|
|
17
|
-
* @param modulePath The path of the module to load.
|
|
18
|
-
* @returns A Promise that resolves to the dynamically imported module.
|
|
19
|
-
*/
|
|
20
|
-
function loadEsmModule(modulePath) {
|
|
21
|
-
load ?? (load = new Function('modulePath', `return import(modulePath);`));
|
|
22
|
-
return load(modulePath);
|
|
23
|
-
}
|
|
24
|
-
exports.loadEsmModule = loadEsmModule;
|
|
25
|
-
//# sourceMappingURL=load-esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-esm.js","sourceRoot":"","sources":["../../ng-add/load-esm.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAI,IAA+D,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAI,UAAwB;IACvD,IAAI,KAAJ,IAAI,GAAK,IAAI,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAG/D,EAAC;IAEF,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC;AAPD,sCAOC"}
|