@eclipse-che/che-devworkspace-generator 7.92.0 → 7.93.0-next-e0a0622
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/lib/api/devfile-context.js +2 -2
- package/lib/api/devfile-context.js.map +1 -1
- package/lib/bitbucket/bitbucket-module.js +6 -6
- package/lib/bitbucket/bitbucket-module.js.map +1 -1
- package/lib/bitbucket/bitbucket-resolver.js +23 -26
- package/lib/bitbucket/bitbucket-resolver.js.map +1 -1
- package/lib/bitbucket/bitbucket-url.js +21 -19
- package/lib/bitbucket/bitbucket-url.js.map +1 -1
- package/lib/bitbucket-server/bitbucket-server-module.js +6 -6
- package/lib/bitbucket-server/bitbucket-server-module.js.map +1 -1
- package/lib/bitbucket-server/bitbucket-server-resolver.js +32 -35
- package/lib/bitbucket-server/bitbucket-server-resolver.js.map +1 -1
- package/lib/bitbucket-server/bitbucket-server-url.js +26 -21
- package/lib/bitbucket-server/bitbucket-server-url.js.map +1 -1
- package/lib/devfile/dev-container-component-finder.js +39 -81
- package/lib/devfile/dev-container-component-finder.js.map +1 -1
- package/lib/devfile/dev-container-component-inserter.js +30 -75
- package/lib/devfile/dev-container-component-inserter.js.map +1 -1
- package/lib/devfile/devfile-module.js +5 -5
- package/lib/devfile/devfile-module.js.map +1 -1
- package/lib/devfile-schema/devfile-schema-module.js +4 -4
- package/lib/devfile-schema/devfile-schema-module.js.map +1 -1
- package/lib/devfile-schema/devfile-schema-validator.js +22 -25
- package/lib/devfile-schema/devfile-schema-validator.js.map +1 -1
- package/lib/entrypoint.js +9 -54
- package/lib/entrypoint.js.map +1 -1
- package/lib/fetch/fetch-module.js +4 -4
- package/lib/fetch/fetch-module.js.map +1 -1
- package/lib/fetch/url-fetcher.js +33 -87
- package/lib/fetch/url-fetcher.js.map +1 -1
- package/lib/generate.js +89 -144
- package/lib/generate.js.map +1 -1
- package/lib/github/github-module.js +6 -6
- package/lib/github/github-module.js.map +1 -1
- package/lib/github/github-resolver.js +26 -29
- package/lib/github/github-resolver.js.map +1 -1
- package/lib/github/github-url.js +24 -19
- package/lib/github/github-url.js.map +1 -1
- package/lib/inversify/inversify-binding.js +26 -68
- package/lib/inversify/inversify-binding.js.map +1 -1
- package/lib/main.js +170 -225
- package/lib/main.js.map +1 -1
- package/lib/plugin-registry/plugin-registry-module.js +4 -4
- package/lib/plugin-registry/plugin-registry-module.js.map +1 -1
- package/lib/plugin-registry/plugin-registry-resolver.js +23 -70
- package/lib/plugin-registry/plugin-registry-resolver.js.map +1 -1
- package/lib/resolve/git-url-resolver.js +16 -18
- package/lib/resolve/git-url-resolver.js.map +1 -1
- package/lib/resolve/resolve-module.js +4 -4
- package/lib/resolve/resolve-module.js.map +1 -1
- package/lib/resolve/resolver.js +1 -1
- package/lib/resolve/url.js +1 -1
- package/lib/types.js +3 -3
- package/lib/types.js.map +1 -1
- package/package.json +2 -2
package/lib/main.js
CHANGED
|
@@ -31,169 +31,119 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
31
31
|
__setModuleDefault(result, mod);
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
36
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
38
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
40
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
44
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
45
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
46
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
47
|
-
function step(op) {
|
|
48
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
49
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
50
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
51
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
52
|
-
switch (op[0]) {
|
|
53
|
-
case 0: case 1: t = op; break;
|
|
54
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
55
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
56
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
57
|
-
default:
|
|
58
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
59
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
60
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
61
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
62
|
-
if (t[2]) _.ops.pop();
|
|
63
|
-
_.trys.pop(); continue;
|
|
64
|
-
}
|
|
65
|
-
op = body.call(thisArg, _);
|
|
66
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
67
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
exports.__esModule = true;
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
35
|
exports.Main = void 0;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
36
|
+
const axios = __importStar(require("axios"));
|
|
37
|
+
const fs = __importStar(require("fs-extra"));
|
|
38
|
+
const generate_1 = require("./generate");
|
|
39
|
+
const devfile_schema_validator_1 = require("./devfile-schema/devfile-schema-validator");
|
|
40
|
+
const jsYaml = __importStar(require("js-yaml"));
|
|
41
|
+
const inversify_binding_1 = require("./inversify/inversify-binding");
|
|
42
|
+
const url_fetcher_1 = require("./fetch/url-fetcher");
|
|
43
|
+
const plugin_registry_resolver_1 = require("./plugin-registry/plugin-registry-resolver");
|
|
44
|
+
const git_url_resolver_1 = require("./resolve/git-url-resolver");
|
|
45
|
+
class Main {
|
|
82
46
|
/**
|
|
83
47
|
* Default constructor.
|
|
84
48
|
*/
|
|
85
|
-
|
|
49
|
+
constructor() {
|
|
86
50
|
// no-op
|
|
87
51
|
}
|
|
88
52
|
// Generates a devfile context object based on params
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
inversifyBinbding = new inversify_binding_1.InversifyBinding();
|
|
109
|
-
return [4 /*yield*/, inversifyBinbding.initBindings({
|
|
110
|
-
pluginRegistryUrl: pluginRegistryUrl,
|
|
111
|
-
axiosInstance: axiosInstance
|
|
112
|
-
})];
|
|
113
|
-
case 1:
|
|
114
|
-
container = _a.sent();
|
|
115
|
-
container.bind(generate_1.Generate).toSelf().inSingletonScope();
|
|
116
|
-
if (!params.devfileUrl) return [3 /*break*/, 3];
|
|
117
|
-
resolver = container.get(git_url_resolver_1.GitUrlResolver);
|
|
118
|
-
url = resolver.resolve(params.devfileUrl);
|
|
119
|
-
return [4 /*yield*/, container.get(url_fetcher_1.UrlFetcher).fetchText(url.getContentUrl('devfile.yaml'))];
|
|
120
|
-
case 2:
|
|
121
|
-
// user devfile
|
|
122
|
-
devfileContent = _a.sent();
|
|
123
|
-
devfileParsed = jsYaml.load(devfileContent);
|
|
124
|
-
// is there projects in the devfile ?
|
|
125
|
-
if (devfileParsed && !devfileParsed.projects) {
|
|
126
|
-
// no, so add the current project being cloned
|
|
127
|
-
devfileParsed.projects = [
|
|
128
|
-
{
|
|
129
|
-
name: url.getRepoName(),
|
|
130
|
-
git: {
|
|
131
|
-
remotes: { origin: url.getCloneUrl() },
|
|
132
|
-
checkoutFrom: { revision: url.getBranchName() }
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
}
|
|
137
|
-
// get back the content
|
|
138
|
-
devfileContent = jsYaml.dump(devfileParsed);
|
|
139
|
-
return [3 /*break*/, 6];
|
|
140
|
-
case 3:
|
|
141
|
-
if (!params.devfilePath) return [3 /*break*/, 5];
|
|
142
|
-
return [4 /*yield*/, fs.readFile(params.devfilePath)];
|
|
143
|
-
case 4:
|
|
144
|
-
devfileContent = _a.sent();
|
|
145
|
-
return [3 /*break*/, 6];
|
|
146
|
-
case 5:
|
|
147
|
-
devfileContent = params.devfileContent;
|
|
148
|
-
_a.label = 6;
|
|
149
|
-
case 6:
|
|
150
|
-
jsYamlDevfileContent = jsYaml.load(devfileContent);
|
|
151
|
-
schemaVersion = jsYamlDevfileContent.schemaVersion;
|
|
152
|
-
if (!schemaVersion) {
|
|
153
|
-
throw new Error("Devfile is not valid, schemaVersion is required");
|
|
154
|
-
}
|
|
155
|
-
devfileSchemaValidator = container.get(devfile_schema_validator_1.DevfileSchemaValidator);
|
|
156
|
-
console.log("Validating devfile");
|
|
157
|
-
validationResult = devfileSchemaValidator.validateDevfile(jsYamlDevfileContent, schemaVersion);
|
|
158
|
-
if (!validationResult.valid) {
|
|
159
|
-
throw new Error("Devfile schema validation failed. Error: ".concat(validationResult.toString()));
|
|
160
|
-
}
|
|
161
|
-
console.log("Devfile is valid with schema version ".concat(schemaVersion));
|
|
162
|
-
// enhance projects
|
|
163
|
-
devfileContent = this.replaceIfExistingProjects(devfileContent, params.projects);
|
|
164
|
-
if (!params.editorContent) return [3 /*break*/, 7];
|
|
165
|
-
editorContent = params.editorContent;
|
|
166
|
-
return [3 /*break*/, 11];
|
|
167
|
-
case 7:
|
|
168
|
-
if (!params.editorEntry) return [3 /*break*/, 9];
|
|
169
|
-
return [4 /*yield*/, container.get(plugin_registry_resolver_1.PluginRegistryResolver).loadDevfilePlugin(params.editorEntry)];
|
|
170
|
-
case 8:
|
|
171
|
-
editorDevfile = _a.sent();
|
|
172
|
-
editorContent = jsYaml.dump(editorDevfile);
|
|
173
|
-
return [3 /*break*/, 11];
|
|
174
|
-
case 9: return [4 /*yield*/, fs.readFile(params.editorPath)];
|
|
175
|
-
case 10:
|
|
176
|
-
editorContent = _a.sent();
|
|
177
|
-
_a.label = 11;
|
|
178
|
-
case 11:
|
|
179
|
-
generate = container.get(generate_1.Generate);
|
|
180
|
-
return [2 /*return*/, generate.generate(devfileContent, editorContent, params.outputFile, params.injectDefaultComponent, params.defaultComponentImage)];
|
|
181
|
-
}
|
|
182
|
-
});
|
|
53
|
+
async generateDevfileContext(params, axiosInstance) {
|
|
54
|
+
if (!params.editorPath && !params.editorEntry && !params.editorContent) {
|
|
55
|
+
throw new Error('missing editorPath or editorEntry or editorContent');
|
|
56
|
+
}
|
|
57
|
+
if (!params.devfilePath && !params.devfileUrl && !params.devfileContent) {
|
|
58
|
+
throw new Error('missing devfilePath or devfileUrl or devfileContent');
|
|
59
|
+
}
|
|
60
|
+
let pluginRegistryUrl;
|
|
61
|
+
if (params.pluginRegistryUrl) {
|
|
62
|
+
pluginRegistryUrl = params.pluginRegistryUrl;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
pluginRegistryUrl = 'https://eclipse-che.github.io/che-plugin-registry/main/v3';
|
|
66
|
+
console.log(`No plug-in registry url. Setting to ${pluginRegistryUrl}`);
|
|
67
|
+
}
|
|
68
|
+
const inversifyBinbding = new inversify_binding_1.InversifyBinding();
|
|
69
|
+
const container = await inversifyBinbding.initBindings({
|
|
70
|
+
pluginRegistryUrl,
|
|
71
|
+
axiosInstance,
|
|
183
72
|
});
|
|
184
|
-
|
|
73
|
+
container.bind(generate_1.Generate).toSelf().inSingletonScope();
|
|
74
|
+
let devfileContent;
|
|
75
|
+
let editorContent;
|
|
76
|
+
// gets the repo URL
|
|
77
|
+
if (params.devfileUrl) {
|
|
78
|
+
const resolver = container.get(git_url_resolver_1.GitUrlResolver);
|
|
79
|
+
const url = resolver.resolve(params.devfileUrl);
|
|
80
|
+
// user devfile
|
|
81
|
+
devfileContent = await container.get(url_fetcher_1.UrlFetcher).fetchText(url.getContentUrl('devfile.yaml'));
|
|
82
|
+
// load content
|
|
83
|
+
const devfileParsed = jsYaml.load(devfileContent);
|
|
84
|
+
// is there projects in the devfile ?
|
|
85
|
+
if (devfileParsed && !devfileParsed.projects) {
|
|
86
|
+
// no, so add the current project being cloned
|
|
87
|
+
devfileParsed.projects = [
|
|
88
|
+
{
|
|
89
|
+
name: url.getRepoName(),
|
|
90
|
+
git: {
|
|
91
|
+
remotes: { origin: url.getCloneUrl() },
|
|
92
|
+
checkoutFrom: { revision: url.getBranchName() },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
// get back the content
|
|
98
|
+
devfileContent = jsYaml.dump(devfileParsed);
|
|
99
|
+
}
|
|
100
|
+
else if (params.devfilePath) {
|
|
101
|
+
devfileContent = await fs.readFile(params.devfilePath);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
devfileContent = params.devfileContent;
|
|
105
|
+
}
|
|
106
|
+
const jsYamlDevfileContent = jsYaml.load(devfileContent);
|
|
107
|
+
const schemaVersion = jsYamlDevfileContent.schemaVersion;
|
|
108
|
+
if (!schemaVersion) {
|
|
109
|
+
throw new Error(`Devfile is not valid, schemaVersion is required`);
|
|
110
|
+
}
|
|
111
|
+
// validate devfile
|
|
112
|
+
const devfileSchemaValidator = container.get(devfile_schema_validator_1.DevfileSchemaValidator);
|
|
113
|
+
console.log(`Validating devfile`);
|
|
114
|
+
const validationResult = devfileSchemaValidator.validateDevfile(jsYamlDevfileContent, schemaVersion);
|
|
115
|
+
if (!validationResult.valid) {
|
|
116
|
+
throw new Error(`Devfile schema validation failed. Error: ${validationResult.toString()}`);
|
|
117
|
+
}
|
|
118
|
+
console.log(`Devfile is valid with schema version ${schemaVersion}`);
|
|
119
|
+
// enhance projects
|
|
120
|
+
devfileContent = this.replaceIfExistingProjects(devfileContent, params.projects);
|
|
121
|
+
if (params.editorContent) {
|
|
122
|
+
editorContent = params.editorContent;
|
|
123
|
+
}
|
|
124
|
+
else if (params.editorEntry) {
|
|
125
|
+
// devfile of the editor
|
|
126
|
+
const editorDevfile = await container.get(plugin_registry_resolver_1.PluginRegistryResolver).loadDevfilePlugin(params.editorEntry);
|
|
127
|
+
editorContent = jsYaml.dump(editorDevfile);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
editorContent = await fs.readFile(params.editorPath);
|
|
131
|
+
}
|
|
132
|
+
const generate = container.get(generate_1.Generate);
|
|
133
|
+
return generate.generate(devfileContent, editorContent, params.outputFile, params.injectDefaultComponent, params.defaultComponentImage);
|
|
134
|
+
}
|
|
185
135
|
// Update project entry based on the projects passed as parameter
|
|
186
|
-
|
|
136
|
+
replaceIfExistingProjects(devfileContent, projects) {
|
|
187
137
|
// do nothing if no override
|
|
188
138
|
if (projects.length === 0) {
|
|
189
139
|
return devfileContent;
|
|
190
140
|
}
|
|
191
|
-
|
|
141
|
+
const devfileParsed = jsYaml.load(devfileContent);
|
|
192
142
|
if (!devfileParsed || !devfileParsed.projects) {
|
|
193
143
|
return devfileContent;
|
|
194
144
|
}
|
|
195
|
-
devfileParsed.projects = devfileParsed.projects.map(
|
|
196
|
-
|
|
145
|
+
devfileParsed.projects = devfileParsed.projects.map(project => {
|
|
146
|
+
const userProjectConfiguration = projects.find(p => p.name === project.name);
|
|
197
147
|
if (userProjectConfiguration) {
|
|
198
148
|
if (userProjectConfiguration.location.endsWith('.zip')) {
|
|
199
149
|
// delete git section and use instead zip
|
|
@@ -207,84 +157,79 @@ var Main = /** @class */ (function () {
|
|
|
207
157
|
return project;
|
|
208
158
|
});
|
|
209
159
|
return jsYaml.dump(devfileParsed);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
_a.trys.push([1, 3, , 4]);
|
|
254
|
-
if (!editorPath && !editorEntry) {
|
|
255
|
-
throw new Error('missing --editor-path: or --editor-entry: parameter');
|
|
256
|
-
}
|
|
257
|
-
if (!devfilePath && !devfileUrl) {
|
|
258
|
-
throw new Error('missing --devfile-path: or --devfile-url: parameter');
|
|
259
|
-
}
|
|
260
|
-
if (!outputFile) {
|
|
261
|
-
throw new Error('missing --output-file: parameter');
|
|
262
|
-
}
|
|
263
|
-
return [4 /*yield*/, this.generateDevfileContext({
|
|
264
|
-
devfilePath: devfilePath,
|
|
265
|
-
devfileUrl: devfileUrl,
|
|
266
|
-
editorPath: editorPath,
|
|
267
|
-
outputFile: outputFile,
|
|
268
|
-
pluginRegistryUrl: pluginRegistryUrl,
|
|
269
|
-
editorEntry: editorEntry,
|
|
270
|
-
projects: projects,
|
|
271
|
-
injectDefaultComponent: injectDefaultComponent,
|
|
272
|
-
defaultComponentImage: defaultComponentImage
|
|
273
|
-
}, axios["default"])];
|
|
274
|
-
case 2:
|
|
275
|
-
_a.sent();
|
|
276
|
-
return [2 /*return*/, true];
|
|
277
|
-
case 3:
|
|
278
|
-
error_1 = _a.sent();
|
|
279
|
-
console.error('stack=' + error_1.stack);
|
|
280
|
-
console.error('Unable to start', error_1);
|
|
281
|
-
return [2 /*return*/, false];
|
|
282
|
-
case 4: return [2 /*return*/];
|
|
283
|
-
}
|
|
284
|
-
});
|
|
160
|
+
}
|
|
161
|
+
async start() {
|
|
162
|
+
let devfilePath;
|
|
163
|
+
let devfileUrl;
|
|
164
|
+
let outputFile;
|
|
165
|
+
let editorPath;
|
|
166
|
+
let pluginRegistryUrl;
|
|
167
|
+
let editorEntry;
|
|
168
|
+
let injectDefaultComponent;
|
|
169
|
+
let defaultComponentImage;
|
|
170
|
+
const projects = [];
|
|
171
|
+
const args = process.argv.slice(2);
|
|
172
|
+
args.forEach(arg => {
|
|
173
|
+
if (arg.startsWith('--devfile-path:')) {
|
|
174
|
+
devfilePath = arg.substring('--devfile-path:'.length);
|
|
175
|
+
}
|
|
176
|
+
if (arg.startsWith('--devfile-url:')) {
|
|
177
|
+
devfileUrl = arg.substring('--devfile-url:'.length);
|
|
178
|
+
}
|
|
179
|
+
if (arg.startsWith('--plugin-registry-url:')) {
|
|
180
|
+
pluginRegistryUrl = arg.substring('--plugin-registry-url:'.length);
|
|
181
|
+
}
|
|
182
|
+
if (arg.startsWith('--editor-entry:')) {
|
|
183
|
+
editorEntry = arg.substring('--editor-entry:'.length);
|
|
184
|
+
}
|
|
185
|
+
if (arg.startsWith('--editor-path:')) {
|
|
186
|
+
editorPath = arg.substring('--editor-path:'.length);
|
|
187
|
+
}
|
|
188
|
+
if (arg.startsWith('--output-file:')) {
|
|
189
|
+
outputFile = arg.substring('--output-file:'.length);
|
|
190
|
+
}
|
|
191
|
+
if (arg.startsWith('--project.')) {
|
|
192
|
+
const name = arg.substring('--project.'.length, arg.indexOf('='));
|
|
193
|
+
let location = arg.substring(arg.indexOf('=') + 1);
|
|
194
|
+
location = location.replace('{{_INTERNAL_URL_}}', '{{ INTERNAL_URL }}');
|
|
195
|
+
projects.push({ name, location });
|
|
196
|
+
}
|
|
197
|
+
if (arg.startsWith('--injectDefaultComponent:')) {
|
|
198
|
+
injectDefaultComponent = arg.substring('--injectDefaultComponent:'.length);
|
|
199
|
+
}
|
|
200
|
+
if (arg.startsWith('--defaultComponentImage:')) {
|
|
201
|
+
defaultComponentImage = arg.substring('--defaultComponentImage:'.length);
|
|
202
|
+
}
|
|
285
203
|
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
204
|
+
try {
|
|
205
|
+
if (!editorPath && !editorEntry) {
|
|
206
|
+
throw new Error('missing --editor-path: or --editor-entry: parameter');
|
|
207
|
+
}
|
|
208
|
+
if (!devfilePath && !devfileUrl) {
|
|
209
|
+
throw new Error('missing --devfile-path: or --devfile-url: parameter');
|
|
210
|
+
}
|
|
211
|
+
if (!outputFile) {
|
|
212
|
+
throw new Error('missing --output-file: parameter');
|
|
213
|
+
}
|
|
214
|
+
await this.generateDevfileContext({
|
|
215
|
+
devfilePath,
|
|
216
|
+
devfileUrl,
|
|
217
|
+
editorPath,
|
|
218
|
+
outputFile,
|
|
219
|
+
pluginRegistryUrl,
|
|
220
|
+
editorEntry,
|
|
221
|
+
projects,
|
|
222
|
+
injectDefaultComponent,
|
|
223
|
+
defaultComponentImage,
|
|
224
|
+
}, axios.default);
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
console.error('stack=' + error.stack);
|
|
229
|
+
console.error('Unable to start', error);
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
289
234
|
exports.Main = Main;
|
|
290
235
|
//# sourceMappingURL=main.js.map
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,6CAA+B;AAC/B,6CAA+B;AAC/B,yCAAsC;AACtC,wFAAmF;AACnF,gDAAkC;AAClC,qEAAiE;AACjE,qDAAiD;AACjD,yFAAoF;AAGpF,iEAA4D;AAG5D,MAAa,IAAI;IACf;;OAEG;IACH;QACE,QAAQ;IACV,CAAC;IACD,qDAAqD;IAC9C,KAAK,CAAC,sBAAsB,CACjC,MAYC,EACD,aAAkC;QAElC,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YACxE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QAED,IAAI,iBAAyB,CAAC;QAE9B,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC7B,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,iBAAiB,GAAG,2DAA2D,CAAC;YAChF,OAAO,CAAC,GAAG,CAAC,uCAAuC,iBAAiB,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,iBAAiB,GAAG,IAAI,oCAAgB,EAAE,CAAC;QACj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MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;YACD,MAAM,IAAI,CAAC,sBAAsB,CAC/B;gBACE,WAAW;gBACX,UAAU;gBACV,UAAU;gBACV,UAAU;gBACV,iBAAiB;gBACjB,WAAW;gBACX,QAAQ;gBACR,sBAAsB;gBACtB,qBAAqB;aACtB,EACD,KAAK,CAAC,OAAO,CACd,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAlOD,oBAkOC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pluginRegistryModule = void 0;
|
|
4
4
|
/**********************************************************************
|
|
5
5
|
* Copyright (c) 2022-2024
|
|
@@ -10,9 +10,9 @@ exports.pluginRegistryModule = void 0;
|
|
|
10
10
|
*
|
|
11
11
|
* SPDX-License-Identifier: EPL-2.0
|
|
12
12
|
***********************************************************************/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const inversify_1 = require("inversify");
|
|
14
|
+
const plugin_registry_resolver_1 = require("./plugin-registry-resolver");
|
|
15
|
+
const pluginRegistryModule = new inversify_1.ContainerModule((bind) => {
|
|
16
16
|
bind(plugin_registry_resolver_1.PluginRegistryResolver).toSelf().inSingletonScope();
|
|
17
17
|
});
|
|
18
18
|
exports.pluginRegistryModule = pluginRegistryModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry-module.js","sourceRoot":"","sources":["../../src/plugin-registry/plugin-registry-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,
|
|
1
|
+
{"version":3,"file":"plugin-registry-module.js","sourceRoot":"","sources":["../../src/plugin-registry/plugin-registry-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,yCAAwD;AAExD,yEAAoE;AAEpE,MAAM,oBAAoB,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IACzE,IAAI,CAAC,iDAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;AAC3D,CAAC,CAAC,CAAC;AAEM,oDAAoB"}
|
|
@@ -37,81 +37,34 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
37
37
|
__setModuleDefault(result, mod);
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
-
function step(op) {
|
|
54
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
56
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
-
switch (op[0]) {
|
|
59
|
-
case 0: case 1: t = op; break;
|
|
60
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
-
default:
|
|
64
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
-
if (t[2]) _.ops.pop();
|
|
69
|
-
_.trys.pop(); continue;
|
|
70
|
-
}
|
|
71
|
-
op = body.call(thisArg, _);
|
|
72
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.__esModule = true;
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
41
|
exports.PluginRegistryResolver = void 0;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
42
|
+
const jsYaml = __importStar(require("js-yaml"));
|
|
43
|
+
const inversify_1 = require("inversify");
|
|
44
|
+
const url_fetcher_1 = require("../fetch/url-fetcher");
|
|
81
45
|
/**
|
|
82
46
|
* Resolve plug-ins by grabbing the definition from the plug-in registry.
|
|
83
47
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
48
|
+
let PluginRegistryResolver = class PluginRegistryResolver {
|
|
49
|
+
pluginRegistryUrl;
|
|
50
|
+
urlFetcher;
|
|
87
51
|
// FQN id (like che-incubator/che-code/next)
|
|
88
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
devfileUrl = "".concat(this.pluginRegistryUrl, "/plugins/").concat(devfileId, "/devfile.yaml");
|
|
96
|
-
return [4 /*yield*/, this.urlFetcher.fetchText(devfileUrl)];
|
|
97
|
-
case 1:
|
|
98
|
-
devfileContent = _a.sent();
|
|
99
|
-
return [2 /*return*/, jsYaml.load(devfileContent)];
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
__decorate([
|
|
105
|
-
(0, inversify_1.inject)('string'),
|
|
106
|
-
(0, inversify_1.named)('PLUGIN_REGISTRY_URL')
|
|
107
|
-
], PluginRegistryResolver.prototype, "pluginRegistryUrl");
|
|
108
|
-
__decorate([
|
|
109
|
-
(0, inversify_1.inject)(url_fetcher_1.UrlFetcher)
|
|
110
|
-
], PluginRegistryResolver.prototype, "urlFetcher");
|
|
111
|
-
PluginRegistryResolver = __decorate([
|
|
112
|
-
(0, inversify_1.injectable)()
|
|
113
|
-
], PluginRegistryResolver);
|
|
114
|
-
return PluginRegistryResolver;
|
|
115
|
-
}());
|
|
53
|
+
async loadDevfilePlugin(devfileId) {
|
|
54
|
+
const devfileUrl = `${this.pluginRegistryUrl}/plugins/${devfileId}/devfile.yaml`;
|
|
55
|
+
const devfileContent = await this.urlFetcher.fetchText(devfileUrl);
|
|
56
|
+
return jsYaml.load(devfileContent);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
116
59
|
exports.PluginRegistryResolver = PluginRegistryResolver;
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, inversify_1.inject)('string'),
|
|
62
|
+
(0, inversify_1.named)('PLUGIN_REGISTRY_URL')
|
|
63
|
+
], PluginRegistryResolver.prototype, "pluginRegistryUrl", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, inversify_1.inject)(url_fetcher_1.UrlFetcher)
|
|
66
|
+
], PluginRegistryResolver.prototype, "urlFetcher", void 0);
|
|
67
|
+
exports.PluginRegistryResolver = PluginRegistryResolver = __decorate([
|
|
68
|
+
(0, inversify_1.injectable)()
|
|
69
|
+
], PluginRegistryResolver);
|
|
117
70
|
//# sourceMappingURL=plugin-registry-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry-resolver.js","sourceRoot":"","sources":["../../src/plugin-registry/plugin-registry-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE
|
|
1
|
+
{"version":3,"file":"plugin-registry-resolver.js","sourceRoot":"","sources":["../../src/plugin-registry/plugin-registry-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,gDAAkC;AAElC,yCAAsD;AAEtD,sDAAkD;AAElD;;GAEG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAGzB,iBAAiB,CAAS;IAG1B,UAAU,CAAa;IAE/B,4CAA4C;IAC5C,8DAA8D;IAC9D,KAAK,CAAC,iBAAiB,CAAC,SAAiB;QACvC,MAAM,UAAU,GAAG,GAAG,IAAI,CAAC,iBAAiB,YAAY,SAAS,eAAe,CAAC;QACjF,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AAfY,wDAAsB;AAGzB;IAFP,IAAA,kBAAM,EAAC,QAAQ,CAAC;IAChB,IAAA,iBAAK,EAAC,qBAAqB,CAAC;iEACK;AAG1B;IADP,IAAA,kBAAM,EAAC,wBAAU,CAAC;0DACY;iCANpB,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAelC"}
|