@eclipse-che/che-devworkspace-generator 0.0.1-d7aefd7 → 0.0.1-ea73e8b

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.
Files changed (41) hide show
  1. package/README.md +56 -0
  2. package/lib/api/devfile-context.d.ts +19 -0
  3. package/lib/devfile/dev-container-component-finder.d.ts +18 -0
  4. package/lib/devfile/dev-container-component-finder.js +20 -7
  5. package/lib/devfile/dev-container-component-finder.js.map +1 -1
  6. package/lib/devfile/dev-container-component-inserter.d.ts +18 -0
  7. package/lib/devfile/dev-container-component-inserter.js +98 -0
  8. package/lib/devfile/dev-container-component-inserter.js.map +1 -0
  9. package/lib/devfile/devfile-module.d.ts +12 -0
  10. package/lib/devfile/devfile-module.js +2 -0
  11. package/lib/devfile/devfile-module.js.map +1 -1
  12. package/lib/entrypoint.d.ts +11 -0
  13. package/lib/fetch/fetch-module.d.ts +12 -0
  14. package/lib/fetch/url-fetcher.d.ts +9 -0
  15. package/lib/generate.d.ts +16 -0
  16. package/lib/generate.js +32 -21
  17. package/lib/generate.js.map +1 -1
  18. package/lib/github/github-module.d.ts +12 -0
  19. package/lib/github/github-resolver.d.ts +18 -0
  20. package/lib/github/github-resolver.js +4 -2
  21. package/lib/github/github-resolver.js.map +1 -1
  22. package/lib/github/github-url.d.ts +29 -0
  23. package/lib/github/github-url.js +7 -6
  24. package/lib/github/github-url.js.map +1 -1
  25. package/lib/inversify/inversify-binding.d.ts +26 -0
  26. package/lib/main.d.ts +38 -0
  27. package/lib/main.js +100 -60
  28. package/lib/main.js.map +1 -1
  29. package/lib/plugin-registry/plugin-registry-module.d.ts +12 -0
  30. package/lib/plugin-registry/plugin-registry-resolver.d.ts +17 -0
  31. package/lib/plugin-registry/plugin-registry-resolver.js +1 -1
  32. package/lib/plugin-registry/plugin-registry-resolver.js.map +1 -1
  33. package/package.json +6 -4
  34. package/src/devfile/dev-container-component-finder.ts +23 -4
  35. package/src/devfile/dev-container-component-inserter.ts +49 -0
  36. package/src/devfile/devfile-module.ts +2 -0
  37. package/src/generate.ts +59 -25
  38. package/src/github/github-resolver.ts +4 -2
  39. package/src/github/github-url.ts +6 -6
  40. package/src/main.ts +119 -55
  41. package/src/plugin-registry/plugin-registry-resolver.ts +1 -1
@@ -14,7 +14,9 @@ exports.GithubUrl = void 0;
14
14
  * Provides helper methods on top of github URL to get for example raw content of get relative links
15
15
  */
16
16
  var GithubUrl = /** @class */ (function () {
17
- function GithubUrl(repoUser, repoName, branchName, subFolder) {
17
+ function GithubUrl(scheme, hostName, repoUser, repoName, branchName, subFolder) {
18
+ this.scheme = scheme;
19
+ this.hostName = hostName;
18
20
  this.repoUser = repoUser;
19
21
  this.repoName = repoName;
20
22
  this.branchName = branchName;
@@ -24,13 +26,14 @@ var GithubUrl = /** @class */ (function () {
24
26
  * Provides the raw link to the given path based on the current repository information
25
27
  */
26
28
  GithubUrl.prototype.getContentUrl = function (path) {
27
- return GithubUrl.RAW_LINK + "/" + this.repoUser + "/" + this.repoName + "/" + this.branchName + "/" + path;
29
+ var hostName = this.hostName === 'github.com' ? 'githubusercontent.com' : this.hostName;
30
+ return this.scheme + "://raw." + hostName + "/" + this.repoUser + "/" + this.repoName + "/" + this.branchName + "/" + path;
28
31
  };
29
32
  GithubUrl.prototype.getUrl = function () {
30
- return "https://github.com/" + this.repoUser + "/" + this.repoName + "/tree/" + this.branchName + "/" + this.subFolder;
33
+ return this.scheme + "://" + this.hostName + "/" + this.repoUser + "/" + this.repoName + "/tree/" + this.branchName + "/" + this.subFolder;
31
34
  };
32
35
  GithubUrl.prototype.getCloneUrl = function () {
33
- return "https://github.com/" + this.repoUser + "/" + this.repoName + ".git";
36
+ return this.scheme + "://" + this.hostName + "/" + this.repoUser + "/" + this.repoName + ".git";
34
37
  };
35
38
  GithubUrl.prototype.getRepoName = function () {
36
39
  return this.repoName;
@@ -38,8 +41,6 @@ var GithubUrl = /** @class */ (function () {
38
41
  GithubUrl.prototype.getBranchName = function () {
39
42
  return this.branchName;
40
43
  };
41
- // raw link
42
- GithubUrl.RAW_LINK = 'https://raw.githubusercontent.com';
43
44
  return GithubUrl;
44
45
  }());
45
46
  exports.GithubUrl = GithubUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"github-url.js","sourceRoot":"","sources":["../../src/github/github-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAEzE;;GAEG;AACH;IAIE,mBACmB,QAAgB,EAChB,QAAgB,EAChB,UAAkB,EAClB,SAAiB;QAHjB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAQ;QAClB,cAAS,GAAT,SAAS,CAAQ;IACjC,CAAC;IAEJ;;OAEG;IACH,iCAAa,GAAb,UAAc,IAAY;QACxB,OAAU,SAAS,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,UAAU,SAAI,IAAM,CAAC;IAC9F,CAAC;IAED,0BAAM,GAAN;QACE,OAAO,wBAAsB,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,cAAS,IAAI,CAAC,UAAU,SAAI,IAAI,CAAC,SAAW,CAAC;IAC1G,CAAC;IAED,+BAAW,GAAX;QACE,OAAO,wBAAsB,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAM,CAAC;IACpE,CAAC;IAED,+BAAW,GAAX;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,iCAAa,GAAb;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IA/BD,WAAW;IACK,kBAAQ,GAAG,mCAAmC,CAAC;IA+BjE,gBAAC;CAAA,AAjCD,IAiCC;AAjCY,8BAAS"}
1
+ {"version":3,"file":"github-url.js","sourceRoot":"","sources":["../../src/github/github-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAEzE;;GAEG;AACH;IACE,mBACmB,MAAc,EACd,QAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,UAAkB,EAClB,SAAiB;QALjB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAQ;QAClB,cAAS,GAAT,SAAS,CAAQ;IACjC,CAAC;IAEJ;;OAEG;IACH,iCAAa,GAAb,UAAc,IAAY;QACxB,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC1F,OAAU,IAAI,CAAC,MAAM,eAAU,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,UAAU,SAAI,IAAM,CAAC;IACzG,CAAC;IAED,0BAAM,GAAN;QACE,OAAU,IAAI,CAAC,MAAM,WAAM,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,cAAS,IAAI,CAAC,UAAU,SAAI,IAAI,CAAC,SAAW,CAAC;IACzH,CAAC;IAED,+BAAW,GAAX;QACE,OAAU,IAAI,CAAC,MAAM,WAAM,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,QAAQ,SAAM,CAAC;IACnF,CAAC;IAED,+BAAW,GAAX;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,iCAAa,GAAb;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACH,gBAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,8BAAS"}
@@ -0,0 +1,26 @@
1
+ /**********************************************************************
2
+ * Copyright (c) 2022 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ ***********************************************************************/
10
+ import 'reflect-metadata';
11
+ import { AxiosInstance } from 'axios';
12
+ import { Container } from 'inversify';
13
+ /**
14
+ * Manage all bindings for inversify
15
+ */
16
+ export declare class InversifyBinding {
17
+ private container;
18
+ initBindings(options: InversifyBindingOptions): Promise<Container>;
19
+ }
20
+ /**
21
+ * Options for inversify bindings
22
+ */
23
+ export interface InversifyBindingOptions {
24
+ pluginRegistryUrl: string;
25
+ axiosInstance: AxiosInstance;
26
+ }
package/lib/main.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ /**********************************************************************
2
+ * Copyright (c) 2022 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ ***********************************************************************/
10
+ import * as axios from 'axios';
11
+ import { DevfileContext } from './api/devfile-context';
12
+ export declare class Main {
13
+ /**
14
+ * Default constructor.
15
+ */
16
+ constructor();
17
+ generateDevfileContext(params: {
18
+ devfilePath?: string;
19
+ devfileUrl?: string;
20
+ devfileContent?: string;
21
+ outputFile?: string;
22
+ editorPath?: string;
23
+ editorContent?: string;
24
+ editorEntry?: string;
25
+ pluginRegistryUrl?: string;
26
+ projects: {
27
+ name: string;
28
+ location: string;
29
+ }[];
30
+ injectDefaultComponent?: string;
31
+ defaultComponentImage?: string;
32
+ }, axiosInstance: axios.AxiosInstance): Promise<DevfileContext>;
33
+ replaceIfExistingProjects(devfileContent: string, projects: {
34
+ name: string;
35
+ location: string;
36
+ }[]): string;
37
+ start(): Promise<boolean>;
38
+ }
package/lib/main.js CHANGED
@@ -74,56 +74,32 @@ var inversify_binding_1 = require("./inversify/inversify-binding");
74
74
  var url_fetcher_1 = require("./fetch/url-fetcher");
75
75
  var plugin_registry_resolver_1 = require("./plugin-registry/plugin-registry-resolver");
76
76
  var Main = /** @class */ (function () {
77
+ /**
78
+ * Default constructor.
79
+ */
77
80
  function Main() {
81
+ // no-op
78
82
  }
79
- Main.prototype.doStart = function () {
83
+ // Generates a devfile context object based on params
84
+ Main.prototype.generateDevfileContext = function (params, axiosInstance) {
80
85
  return __awaiter(this, void 0, void 0, function () {
81
- var devfilePath, devfileUrl, outputFile, editorPath, pluginRegistryUrl, editorEntry, projects, args, axiosInstance, inversifyBinbding, container, devfileContent, editorContent, githubResolver, githubUrl, devfileParsed, editorDevfile, generate;
86
+ var pluginRegistryUrl, inversifyBinbding, container, devfileContent, editorContent, githubResolver, githubUrl, devfileParsed, editorDevfile, generate;
82
87
  return __generator(this, function (_a) {
83
88
  switch (_a.label) {
84
89
  case 0:
85
- projects = [];
86
- args = process.argv.slice(2);
87
- args.forEach(function (arg) {
88
- if (arg.startsWith('--devfile-path:')) {
89
- devfilePath = arg.substring('--devfile-path:'.length);
90
- }
91
- if (arg.startsWith('--devfile-url:')) {
92
- devfileUrl = arg.substring('--devfile-url:'.length);
93
- }
94
- if (arg.startsWith('--plugin-registry-url:')) {
95
- pluginRegistryUrl = arg.substring('--plugin-registry-url:'.length);
96
- }
97
- if (arg.startsWith('--editor-entry:')) {
98
- editorEntry = arg.substring('--editor-entry:'.length);
99
- }
100
- if (arg.startsWith('--editor-path:')) {
101
- editorPath = arg.substring('--editor-path:'.length);
102
- }
103
- if (arg.startsWith('--output-file:')) {
104
- outputFile = arg.substring('--output-file:'.length);
105
- }
106
- if (arg.startsWith('--project.')) {
107
- var name = arg.substring('--project.'.length, arg.indexOf('='));
108
- var location = arg.substring(arg.indexOf('=') + 1);
109
- location = location.replace('{{_INTERNAL_URL_}}', '{{ INTERNAL_URL }}');
110
- projects.push({ name: name, location: location });
111
- }
112
- });
113
- if (!editorPath && !editorEntry) {
114
- throw new Error('missing --editor-path: or --editor-entry: parameter');
90
+ if (!params.editorPath && !params.editorEntry && !params.editorContent) {
91
+ throw new Error('missing editorPath or editorEntry or editorContent');
115
92
  }
116
- if (editorEntry && !pluginRegistryUrl) {
117
- pluginRegistryUrl = 'https://eclipse-che.github.io/che-plugin-registry/main/v3';
118
- console.log("No plug-in registry url. Setting to " + pluginRegistryUrl);
93
+ if (!params.devfilePath && !params.devfileUrl && !params.devfileContent) {
94
+ throw new Error('missing devfilePath or devfileUrl or devfileContent');
119
95
  }
120
- if (!devfilePath && !devfileUrl) {
121
- throw new Error('missing --devfile-path: or --devfile-url: parameter');
96
+ if (params.pluginRegistryUrl) {
97
+ pluginRegistryUrl = params.pluginRegistryUrl;
122
98
  }
123
- if (!outputFile) {
124
- throw new Error('missing --output-file: parameter');
99
+ else {
100
+ pluginRegistryUrl = 'https://eclipse-che.github.io/che-plugin-registry/main/v3';
101
+ console.log("No plug-in registry url. Setting to " + pluginRegistryUrl);
125
102
  }
126
- axiosInstance = axios["default"];
127
103
  inversifyBinbding = new inversify_binding_1.InversifyBinding();
128
104
  return [4 /*yield*/, inversifyBinbding.initBindings({
129
105
  pluginRegistryUrl: pluginRegistryUrl,
@@ -132,9 +108,9 @@ var Main = /** @class */ (function () {
132
108
  case 1:
133
109
  container = _a.sent();
134
110
  container.bind(generate_1.Generate).toSelf().inSingletonScope();
135
- if (!devfileUrl) return [3 /*break*/, 3];
111
+ if (!params.devfileUrl) return [3 /*break*/, 3];
136
112
  githubResolver = container.get(github_resolver_1.GithubResolver);
137
- githubUrl = githubResolver.resolve(devfileUrl);
113
+ githubUrl = githubResolver.resolve(params.devfileUrl);
138
114
  return [4 /*yield*/, container.get(url_fetcher_1.UrlFetcher).fetchText(githubUrl.getContentUrl('devfile.yaml'))];
139
115
  case 2:
140
116
  // user devfile
@@ -155,27 +131,36 @@ var Main = /** @class */ (function () {
155
131
  }
156
132
  // get back the content
157
133
  devfileContent = jsYaml.dump(devfileParsed);
158
- return [3 /*break*/, 5];
159
- case 3: return [4 /*yield*/, fs.readFile(devfilePath)];
134
+ return [3 /*break*/, 6];
135
+ case 3:
136
+ if (!params.devfilePath) return [3 /*break*/, 5];
137
+ return [4 /*yield*/, fs.readFile(params.devfilePath)];
160
138
  case 4:
161
139
  devfileContent = _a.sent();
162
- _a.label = 5;
140
+ return [3 /*break*/, 6];
163
141
  case 5:
164
- // enhance projects
165
- devfileContent = this.replaceIfExistingProjects(devfileContent, projects);
166
- if (!editorEntry) return [3 /*break*/, 7];
167
- return [4 /*yield*/, container.get(plugin_registry_resolver_1.PluginRegistryResolver).loadDevfilePlugin(editorEntry)];
142
+ devfileContent = params.devfileContent;
143
+ _a.label = 6;
168
144
  case 6:
145
+ // enhance projects
146
+ devfileContent = this.replaceIfExistingProjects(devfileContent, params.projects);
147
+ if (!params.editorContent) return [3 /*break*/, 7];
148
+ editorContent = params.editorContent;
149
+ return [3 /*break*/, 11];
150
+ case 7:
151
+ if (!params.editorEntry) return [3 /*break*/, 9];
152
+ return [4 /*yield*/, container.get(plugin_registry_resolver_1.PluginRegistryResolver).loadDevfilePlugin(params.editorEntry)];
153
+ case 8:
169
154
  editorDevfile = _a.sent();
170
155
  editorContent = jsYaml.dump(editorDevfile);
171
- return [3 /*break*/, 9];
172
- case 7: return [4 /*yield*/, fs.readFile(editorPath)];
173
- case 8:
156
+ return [3 /*break*/, 11];
157
+ case 9: return [4 /*yield*/, fs.readFile(params.editorPath)];
158
+ case 10:
174
159
  editorContent = _a.sent();
175
- _a.label = 9;
176
- case 9:
160
+ _a.label = 11;
161
+ case 11:
177
162
  generate = container.get(generate_1.Generate);
178
- return [2 /*return*/, generate.generate(devfileContent, editorContent, outputFile)];
163
+ return [2 /*return*/, generate.generate(devfileContent, editorContent, params.outputFile, params.injectDefaultComponent, params.defaultComponentImage)];
179
164
  }
180
165
  });
181
166
  });
@@ -208,21 +193,76 @@ var Main = /** @class */ (function () {
208
193
  };
209
194
  Main.prototype.start = function () {
210
195
  return __awaiter(this, void 0, void 0, function () {
211
- var error_1;
196
+ var devfilePath, devfileUrl, outputFile, editorPath, pluginRegistryUrl, editorEntry, injectDefaultComponent, defaultComponentImage, projects, args, error_1;
212
197
  return __generator(this, function (_a) {
213
198
  switch (_a.label) {
214
199
  case 0:
215
- _a.trys.push([0, 2, , 3]);
216
- return [4 /*yield*/, this.doStart()];
200
+ projects = [];
201
+ args = process.argv.slice(2);
202
+ args.forEach(function (arg) {
203
+ if (arg.startsWith('--devfile-path:')) {
204
+ devfilePath = arg.substring('--devfile-path:'.length);
205
+ }
206
+ if (arg.startsWith('--devfile-url:')) {
207
+ devfileUrl = arg.substring('--devfile-url:'.length);
208
+ }
209
+ if (arg.startsWith('--plugin-registry-url:')) {
210
+ pluginRegistryUrl = arg.substring('--plugin-registry-url:'.length);
211
+ }
212
+ if (arg.startsWith('--editor-entry:')) {
213
+ editorEntry = arg.substring('--editor-entry:'.length);
214
+ }
215
+ if (arg.startsWith('--editor-path:')) {
216
+ editorPath = arg.substring('--editor-path:'.length);
217
+ }
218
+ if (arg.startsWith('--output-file:')) {
219
+ outputFile = arg.substring('--output-file:'.length);
220
+ }
221
+ if (arg.startsWith('--project.')) {
222
+ var name = arg.substring('--project.'.length, arg.indexOf('='));
223
+ var location = arg.substring(arg.indexOf('=') + 1);
224
+ location = location.replace('{{_INTERNAL_URL_}}', '{{ INTERNAL_URL }}');
225
+ projects.push({ name: name, location: location });
226
+ }
227
+ if (arg.startsWith('--injectDefaultComponent:')) {
228
+ injectDefaultComponent = arg.substring('--injectDefaultComponent:'.length);
229
+ }
230
+ if (arg.startsWith('--defaultComponentImage:')) {
231
+ defaultComponentImage = arg.substring('--defaultComponentImage:'.length);
232
+ }
233
+ });
234
+ _a.label = 1;
217
235
  case 1:
236
+ _a.trys.push([1, 3, , 4]);
237
+ if (!editorPath && !editorEntry) {
238
+ throw new Error('missing --editor-path: or --editor-entry: parameter');
239
+ }
240
+ if (!devfilePath && !devfileUrl) {
241
+ throw new Error('missing --devfile-path: or --devfile-url: parameter');
242
+ }
243
+ if (!outputFile) {
244
+ throw new Error('missing --output-file: parameter');
245
+ }
246
+ return [4 /*yield*/, this.generateDevfileContext({
247
+ devfilePath: devfilePath,
248
+ devfileUrl: devfileUrl,
249
+ editorPath: editorPath,
250
+ outputFile: outputFile,
251
+ pluginRegistryUrl: pluginRegistryUrl,
252
+ editorEntry: editorEntry,
253
+ projects: projects,
254
+ injectDefaultComponent: injectDefaultComponent,
255
+ defaultComponentImage: defaultComponentImage
256
+ }, axios["default"])];
257
+ case 2:
218
258
  _a.sent();
219
259
  return [2 /*return*/, true];
220
- case 2:
260
+ case 3:
221
261
  error_1 = _a.sent();
222
262
  console.error('stack=' + error_1.stack);
223
263
  console.error('Unable to start', error_1);
224
264
  return [2 /*return*/, false];
225
- case 3: return [2 /*return*/];
265
+ case 4: return [2 /*return*/];
226
266
  }
227
267
  });
228
268
  });
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,2CAA+B;AAC/B,2CAA+B;AAC/B,uCAAsC;AACtC,4DAA0D;AAC1D,8CAAkC;AAClC,mEAAiE;AACjE,mDAAiD;AACjD,uFAAoF;AAIpF;IAAA;IAgJA,CAAC;IA/IiB,sBAAO,GAAvB;;;;;;wBAOQ,QAAQ,GAAyC,EAAE,CAAC;wBAEpD,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;wBACnC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;4BACd,IAAI,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;gCACrC,WAAW,GAAG,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;6BACvD;4BACD,IAAI,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAA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,CAAC;wBACF,sBAAO,IAAI,EAAC;;;wBAEZ,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAK,CAAC,KAAK,CAAC,CAAC;wBACtC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,OAAK,CAAC,CAAC;wBACxC,sBAAO,KAAK,EAAC;;;;;KAEhB;IACH,WAAC;AAAD,CAAC,AAhND,IAgNC;AAhNY,oBAAI"}
@@ -0,0 +1,12 @@
1
+ /**********************************************************************
2
+ * Copyright (c) 2022 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ ***********************************************************************/
10
+ import { ContainerModule } from 'inversify';
11
+ declare const pluginRegistryModule: ContainerModule;
12
+ export { pluginRegistryModule };
@@ -0,0 +1,17 @@
1
+ /**********************************************************************
2
+ * Copyright (c) 2022 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ ***********************************************************************/
10
+ /**
11
+ * Resolve plug-ins by grabbing the definition from the plug-in registry.
12
+ */
13
+ export declare class PluginRegistryResolver {
14
+ private pluginRegistryUrl;
15
+ private urlFetcher;
16
+ loadDevfilePlugin(devfileId: string): Promise<any>;
17
+ }
@@ -80,7 +80,7 @@ var url_fetcher_1 = require("../fetch/url-fetcher");
80
80
  var PluginRegistryResolver = /** @class */ (function () {
81
81
  function PluginRegistryResolver() {
82
82
  }
83
- // FQN id (like eclipse/che-theia/next)
83
+ // FQN id (like che-incubator/che-code/next)
84
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
85
  PluginRegistryResolver.prototype.loadDevfilePlugin = function (devfileId) {
86
86
  return __awaiter(this, void 0, void 0, function () {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-registry-resolver.js","sourceRoot":"","sources":["../../src/plugin-registry/plugin-registry-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,8CAAkC;AAElC,uCAAsD;AAEtD,oDAAkD;AAElD;;GAEG;AAEH;IAAA;IAeA,CAAC;IAPC,uCAAuC;IACvC,8DAA8D;IACxD,kDAAiB,GAAvB,UAAwB,SAAiB;;;;;;wBACjC,UAAU,GAAM,IAAI,CAAC,iBAAiB,iBAAY,SAAS,kBAAe,CAAC;wBAC1D,qBAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAAA;;wBAA5D,cAAc,GAAG,SAA2C;wBAClE,sBAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAC;;;;KACpC;IAXD;QAFC,IAAA,kBAAM,EAAC,QAAQ,CAAC;QAChB,IAAA,iBAAK,EAAC,qBAAqB,CAAC;6DACK;IAGlC;QADC,IAAA,kBAAM,EAAC,wBAAU,CAAC;sDACY;IANpB,sBAAsB;QADlC,IAAA,sBAAU,GAAE;OACA,sBAAsB,CAelC;IAAD,6BAAC;CAAA,AAfD,IAeC;AAfY,wDAAsB"}
1
+ {"version":3,"file":"plugin-registry-resolver.js","sourceRoot":"","sources":["../../src/plugin-registry/plugin-registry-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,8CAAkC;AAElC,uCAAsD;AAEtD,oDAAkD;AAElD;;GAEG;AAEH;IAAA;IAeA,CAAC;IAPC,4CAA4C;IAC5C,8DAA8D;IACxD,kDAAiB,GAAvB,UAAwB,SAAiB;;;;;;wBACjC,UAAU,GAAM,IAAI,CAAC,iBAAiB,iBAAY,SAAS,kBAAe,CAAC;wBAC1D,qBAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAAA;;wBAA5D,cAAc,GAAG,SAA2C;wBAClE,sBAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAC;;;;KACpC;IAXD;QAFC,IAAA,kBAAM,EAAC,QAAQ,CAAC;QAChB,IAAA,iBAAK,EAAC,qBAAqB,CAAC;6DACK;IAGlC;QADC,IAAA,kBAAM,EAAC,wBAAU,CAAC;sDACY;IANpB,sBAAsB;QADlC,IAAA,sBAAU,GAAE;OACA,sBAAsB,CAelC;IAAD,6BAAC;CAAA,AAfD,IAeC;AAfY,wDAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-che/che-devworkspace-generator",
3
- "version": "0.0.1-d7aefd7",
3
+ "version": "0.0.1-ea73e8b",
4
4
  "private": false,
5
5
  "description": "Generates DevWorkspaces by transforming existing devfiles",
6
6
  "main": "lib/entrypoint.js",
@@ -18,13 +18,15 @@
18
18
  "prepare": "yarn run clean && yarn run build",
19
19
  "clean": "rimraf lib",
20
20
  "build": "yarn run format && yarn run compile && yarn run lint && yarn run test",
21
- "compile": "tsc --project .",
21
+ "compile": "tsc --declaration --project .",
22
22
  "format": "if-env SKIP_FORMAT=true && echo 'skip format check' || prettier --check '{src,tests}/**/*.ts' package.json",
23
23
  "format:fix": "prettier --write '{src,tests}/**/*.ts' package.json",
24
24
  "lint": "if-env SKIP_LINT=true && echo 'skip lint check' || eslint --cache=true --no-error-on-unmatched-pattern=true '{src,tests}/(!model|**)/*.ts'",
25
- "lint:fix": "eslint --fix --cache=true --no-error-on-unmatched-pattern=true \"{src,tests}/(!model|**)/*.{ts,tsx}\"",
25
+ "lint:fix": "eslint --fix --cache=true --no-error-on-unmatched-pattern=true \"{src,tests}/(!model|**)/*.ts\"",
26
26
  "test": "if-env SKIP_TEST=true && echo 'skip test' || jest --forceExit",
27
27
  "watch": "tsc -w",
28
+ "license:check": "docker run --rm -t -v ${PWD}/:/workspace/project quay.io/che-incubator/dash-licenses:next --check",
29
+ "license:generate": "docker run --rm -t -v ${PWD}/:/workspace/project quay.io/che-incubator/dash-licenses:next",
28
30
  "publish:next": "yarn publish --registry=https://registry.npmjs.org/ --no-git-tag-version --new-version 0.0.1-\"$(date +%s)\""
29
31
  },
30
32
  "repository": {
@@ -72,7 +74,7 @@
72
74
  "clearMocks": true,
73
75
  "collectCoverage": true,
74
76
  "collectCoverageFrom": [
75
- "src/**/*.{ts,tsx}"
77
+ "src/**/*.ts"
76
78
  ],
77
79
  "coverageThreshold": {
78
80
  "global": {
@@ -10,14 +10,26 @@
10
10
 
11
11
  import { DevfileContext } from '../api/devfile-context';
12
12
  import { V1alpha2DevWorkspaceSpecTemplateComponents } from '@devfile/api';
13
- import { injectable } from 'inversify';
13
+ import { inject, injectable } from 'inversify';
14
+ import { DevContainerComponentInserter } from './dev-container-component-inserter';
14
15
 
15
16
  /**
16
17
  * Need to find dev container from main dev workspace
17
18
  */
18
19
  @injectable()
19
20
  export class DevContainerComponentFinder {
20
- async find(devfileContext: DevfileContext): Promise<V1alpha2DevWorkspaceSpecTemplateComponents | undefined> {
21
+ @inject(DevContainerComponentInserter)
22
+ private devContainerComponentInserter: DevContainerComponentInserter;
23
+
24
+ async find(
25
+ devfileContext: DevfileContext,
26
+ injectDefaultComponent?: string,
27
+ defaultComponentImage?: string
28
+ ): Promise<V1alpha2DevWorkspaceSpecTemplateComponents | undefined> {
29
+ // if a devfile contains a parent, we should not add a default dev container
30
+ if (devfileContext.devfile?.parent) {
31
+ return undefined;
32
+ }
21
33
  // search in main devWorkspace
22
34
  const devComponents = devfileContext.devWorkspace.spec?.template?.components
23
35
  ?.filter(component => component.container)
@@ -26,9 +38,16 @@ export class DevContainerComponentFinder {
26
38
  component => component.container && component.container.mountSources !== false
27
39
  );
28
40
 
29
- // only one, fine, else error
30
41
  if (!devComponents || devComponents.length === 0) {
31
- throw new Error('Not able to find any dev container component in DevWorkspace');
42
+ // do not inject a default component if injectDefaultComponent parameter is false
43
+ if (!injectDefaultComponent || injectDefaultComponent !== 'true') {
44
+ return undefined;
45
+ }
46
+ this.devContainerComponentInserter.insert(devfileContext, defaultComponentImage);
47
+
48
+ let devComponents = devfileContext.devWorkspace.spec.template.components.filter(component => component.container);
49
+
50
+ return devComponents[0];
32
51
  } else if (devComponents.length === 1) {
33
52
  return devComponents[0];
34
53
  } else {
@@ -0,0 +1,49 @@
1
+ /**********************************************************************
2
+ * Copyright (c) 2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ ***********************************************************************/
10
+
11
+ import { DevfileContext } from '../api/devfile-context';
12
+ import { V1alpha2DevWorkspaceSpecTemplateComponents } from '@devfile/api';
13
+ import { injectable } from 'inversify';
14
+
15
+ /**
16
+ * Adds a new component on empty devfile with specific name and image
17
+ */
18
+ @injectable()
19
+ export class DevContainerComponentInserter {
20
+ readonly DEFAULT_DEV_CONTAINER_IMAGE = 'quay.io/devfile/universal-developer-image:ubi8-latest';
21
+ readonly DEFAULT_DEV_CONTAINER_NAME = 'dev';
22
+
23
+ async insert(devfileContext: DevfileContext, defaultComponentImage?: string): Promise<void> {
24
+ if (!devfileContext.devWorkspace.spec) {
25
+ devfileContext.devWorkspace.spec = {
26
+ started: true,
27
+ };
28
+ }
29
+ if (!devfileContext.devWorkspace.spec.template) {
30
+ devfileContext.devWorkspace.spec.template = {};
31
+ }
32
+ if (!devfileContext.devWorkspace.spec.template.components) {
33
+ devfileContext.devWorkspace.spec.template.components = [];
34
+ }
35
+
36
+ const devContainerImage = defaultComponentImage ? defaultComponentImage : this.DEFAULT_DEV_CONTAINER_IMAGE;
37
+ console.log(
38
+ `No container component has been found. A default container component with image ${devContainerImage} will be added.`
39
+ );
40
+ const devContainerComponent: V1alpha2DevWorkspaceSpecTemplateComponents = {
41
+ name: this.DEFAULT_DEV_CONTAINER_NAME,
42
+ container: {
43
+ image: devContainerImage,
44
+ },
45
+ };
46
+
47
+ devfileContext.devWorkspace.spec.template.components.push(devContainerComponent);
48
+ }
49
+ }
@@ -10,9 +10,11 @@
10
10
  import { ContainerModule, interfaces } from 'inversify';
11
11
 
12
12
  import { DevContainerComponentFinder } from './dev-container-component-finder';
13
+ import { DevContainerComponentInserter } from './dev-container-component-inserter';
13
14
 
14
15
  const devfileModule = new ContainerModule((bind: interfaces.Bind) => {
15
16
  bind(DevContainerComponentFinder).toSelf().inSingletonScope();
17
+ bind(DevContainerComponentInserter).toSelf().inSingletonScope();
16
18
  });
17
19
 
18
20
  export { devfileModule };