@eclipse-che/che-devworkspace-generator 0.0.1-d7aefd7 → 7.69.0-8717dbc
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/README.md +56 -0
- package/lib/api/devfile-context.d.ts +19 -0
- package/lib/bitbucket/bitbucket-module.d.ts +12 -0
- package/lib/bitbucket/bitbucket-module.js +21 -0
- package/lib/bitbucket/bitbucket-module.js.map +1 -0
- package/lib/bitbucket/bitbucket-resolver.d.ts +17 -0
- package/lib/bitbucket/bitbucket-resolver.js +56 -0
- package/lib/bitbucket/bitbucket-resolver.js.map +1 -0
- package/lib/bitbucket/bitbucket-url.d.ts +22 -0
- package/lib/bitbucket/bitbucket-url.js +38 -0
- package/lib/bitbucket/bitbucket-url.js.map +1 -0
- package/lib/bitbucket-server/bitbucket-server-module.d.ts +12 -0
- package/lib/bitbucket-server/bitbucket-server-module.js +21 -0
- package/lib/bitbucket-server/bitbucket-server-module.js.map +1 -0
- package/lib/bitbucket-server/bitbucket-server-resolver.d.ts +17 -0
- package/lib/bitbucket-server/bitbucket-server-resolver.js +64 -0
- package/lib/bitbucket-server/bitbucket-server-resolver.js.map +1 -0
- package/lib/bitbucket-server/bitbucket-server-url.d.ts +24 -0
- package/lib/bitbucket-server/bitbucket-server-url.js +43 -0
- package/lib/bitbucket-server/bitbucket-server-url.js.map +1 -0
- package/lib/devfile/dev-container-component-finder.d.ts +18 -0
- package/lib/devfile/dev-container-component-finder.js +20 -7
- package/lib/devfile/dev-container-component-finder.js.map +1 -1
- package/lib/devfile/dev-container-component-inserter.d.ts +18 -0
- package/lib/devfile/dev-container-component-inserter.js +98 -0
- package/lib/devfile/dev-container-component-inserter.js.map +1 -0
- package/lib/devfile/devfile-module.d.ts +12 -0
- package/lib/devfile/devfile-module.js +2 -0
- package/lib/devfile/devfile-module.js.map +1 -1
- package/lib/entrypoint.d.ts +11 -0
- package/lib/fetch/fetch-module.d.ts +12 -0
- package/lib/fetch/url-fetcher.d.ts +9 -0
- package/lib/generate.d.ts +16 -0
- package/lib/generate.js +32 -21
- package/lib/generate.js.map +1 -1
- package/lib/github/github-module.d.ts +12 -0
- package/lib/github/github-module.js +3 -1
- package/lib/github/github-module.js.map +1 -1
- package/lib/github/github-resolver.d.ts +17 -0
- package/lib/github/github-resolver.js +10 -5
- package/lib/github/github-resolver.js.map +1 -1
- package/lib/github/github-url.d.ts +27 -0
- package/lib/github/github-url.js +7 -9
- package/lib/github/github-url.js.map +1 -1
- package/lib/inversify/inversify-binding.d.ts +26 -0
- package/lib/inversify/inversify-binding.js +6 -0
- package/lib/inversify/inversify-binding.js.map +1 -1
- package/lib/main.d.ts +38 -0
- package/lib/main.js +106 -66
- package/lib/main.js.map +1 -1
- package/lib/plugin-registry/plugin-registry-module.d.ts +12 -0
- package/lib/plugin-registry/plugin-registry-resolver.d.ts +17 -0
- package/lib/plugin-registry/plugin-registry-resolver.js +1 -1
- package/lib/plugin-registry/plugin-registry-resolver.js.map +1 -1
- package/lib/resolve/git-url-resolver.d.ts +5 -0
- package/lib/resolve/git-url-resolver.js +43 -0
- package/lib/resolve/git-url-resolver.js.map +1 -0
- package/lib/resolve/resolve-module.d.ts +12 -0
- package/lib/resolve/resolve-module.js +19 -0
- package/lib/resolve/resolve-module.js.map +1 -0
- package/lib/resolve/resolver.d.ts +22 -0
- package/lib/resolve/resolver.js +12 -0
- package/lib/resolve/resolver.js.map +1 -0
- package/lib/resolve/url.d.ts +35 -0
- package/lib/resolve/url.js +12 -0
- package/lib/resolve/url.js.map +1 -0
- package/lib/types.d.ts +13 -0
- package/lib/types.js +17 -0
- package/lib/types.js.map +1 -0
- package/package.json +6 -4
- package/src/bitbucket/bitbucket-module.ts +21 -0
- package/src/bitbucket/bitbucket-resolver.ts +46 -0
- package/src/bitbucket/bitbucket-url.ts +41 -0
- package/src/bitbucket-server/bitbucket-server-module.ts +21 -0
- package/src/bitbucket-server/bitbucket-server-resolver.ts +53 -0
- package/src/bitbucket-server/bitbucket-server-url.ts +51 -0
- package/src/devfile/dev-container-component-finder.ts +23 -4
- package/src/devfile/dev-container-component-inserter.ts +49 -0
- package/src/devfile/devfile-module.ts +2 -0
- package/src/generate.ts +59 -25
- package/src/github/github-module.ts +4 -1
- package/src/github/github-resolver.ts +17 -9
- package/src/github/github-url.ts +8 -9
- package/src/inversify/inversify-binding.ts +6 -0
- package/src/main.ts +126 -62
- package/src/plugin-registry/plugin-registry-resolver.ts +1 -1
- package/src/resolve/git-url-resolver.ts +30 -0
- package/src/resolve/resolve-module.ts +18 -0
- package/src/resolve/resolver.ts +25 -0
- package/src/resolve/url.ts +40 -0
- package/src/types.ts +14 -0
package/src/main.ts
CHANGED
|
@@ -11,67 +11,54 @@
|
|
|
11
11
|
import * as axios from 'axios';
|
|
12
12
|
import * as fs from 'fs-extra';
|
|
13
13
|
import { Generate } from './generate';
|
|
14
|
-
import { GithubResolver } from './github/github-resolver';
|
|
15
14
|
import * as jsYaml from 'js-yaml';
|
|
16
15
|
import { InversifyBinding } from './inversify/inversify-binding';
|
|
17
16
|
import { UrlFetcher } from './fetch/url-fetcher';
|
|
18
17
|
import { PluginRegistryResolver } from './plugin-registry/plugin-registry-resolver';
|
|
19
18
|
import { V1alpha2DevWorkspaceSpecTemplate } from '@devfile/api';
|
|
20
19
|
import { DevfileContext } from './api/devfile-context';
|
|
20
|
+
import { GitUrlResolver } from './resolve/git-url-resolver';
|
|
21
21
|
|
|
22
22
|
export class Main {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Default constructor.
|
|
25
|
+
*/
|
|
26
|
+
constructor() {
|
|
27
|
+
// no-op
|
|
28
|
+
}
|
|
29
|
+
// Generates a devfile context object based on params
|
|
30
|
+
public async generateDevfileContext(
|
|
31
|
+
params: {
|
|
32
|
+
devfilePath?: string;
|
|
33
|
+
devfileUrl?: string;
|
|
34
|
+
devfileContent?: string;
|
|
35
|
+
outputFile?: string;
|
|
36
|
+
editorPath?: string;
|
|
37
|
+
editorContent?: string;
|
|
38
|
+
editorEntry?: string;
|
|
39
|
+
pluginRegistryUrl?: string;
|
|
40
|
+
projects: { name: string; location: string }[];
|
|
41
|
+
injectDefaultComponent?: string;
|
|
42
|
+
defaultComponentImage?: string;
|
|
43
|
+
},
|
|
44
|
+
axiosInstance: axios.AxiosInstance
|
|
45
|
+
): Promise<DevfileContext> {
|
|
46
|
+
if (!params.editorPath && !params.editorEntry && !params.editorContent) {
|
|
47
|
+
throw new Error('missing editorPath or editorEntry or editorContent');
|
|
48
|
+
}
|
|
49
|
+
if (!params.devfilePath && !params.devfileUrl && !params.devfileContent) {
|
|
50
|
+
throw new Error('missing devfilePath or devfileUrl or devfileContent');
|
|
51
|
+
}
|
|
31
52
|
|
|
32
|
-
|
|
33
|
-
args.forEach(arg => {
|
|
34
|
-
if (arg.startsWith('--devfile-path:')) {
|
|
35
|
-
devfilePath = arg.substring('--devfile-path:'.length);
|
|
36
|
-
}
|
|
37
|
-
if (arg.startsWith('--devfile-url:')) {
|
|
38
|
-
devfileUrl = arg.substring('--devfile-url:'.length);
|
|
39
|
-
}
|
|
40
|
-
if (arg.startsWith('--plugin-registry-url:')) {
|
|
41
|
-
pluginRegistryUrl = arg.substring('--plugin-registry-url:'.length);
|
|
42
|
-
}
|
|
43
|
-
if (arg.startsWith('--editor-entry:')) {
|
|
44
|
-
editorEntry = arg.substring('--editor-entry:'.length);
|
|
45
|
-
}
|
|
46
|
-
if (arg.startsWith('--editor-path:')) {
|
|
47
|
-
editorPath = arg.substring('--editor-path:'.length);
|
|
48
|
-
}
|
|
49
|
-
if (arg.startsWith('--output-file:')) {
|
|
50
|
-
outputFile = arg.substring('--output-file:'.length);
|
|
51
|
-
}
|
|
52
|
-
if (arg.startsWith('--project.')) {
|
|
53
|
-
const name = arg.substring('--project.'.length, arg.indexOf('='));
|
|
54
|
-
let location = arg.substring(arg.indexOf('=') + 1);
|
|
55
|
-
location = location.replace('{{_INTERNAL_URL_}}', '{{ INTERNAL_URL }}');
|
|
53
|
+
let pluginRegistryUrl: string;
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
if (!editorPath && !editorEntry) {
|
|
61
|
-
throw new Error('missing --editor-path: or --editor-entry: parameter');
|
|
62
|
-
}
|
|
63
|
-
if (editorEntry && !pluginRegistryUrl) {
|
|
55
|
+
if (params.pluginRegistryUrl) {
|
|
56
|
+
pluginRegistryUrl = params.pluginRegistryUrl;
|
|
57
|
+
} else {
|
|
64
58
|
pluginRegistryUrl = 'https://eclipse-che.github.io/che-plugin-registry/main/v3';
|
|
65
59
|
console.log(`No plug-in registry url. Setting to ${pluginRegistryUrl}`);
|
|
66
60
|
}
|
|
67
|
-
if (!devfilePath && !devfileUrl) {
|
|
68
|
-
throw new Error('missing --devfile-path: or --devfile-url: parameter');
|
|
69
|
-
}
|
|
70
|
-
if (!outputFile) {
|
|
71
|
-
throw new Error('missing --output-file: parameter');
|
|
72
|
-
}
|
|
73
61
|
|
|
74
|
-
const axiosInstance = axios.default;
|
|
75
62
|
const inversifyBinbding = new InversifyBinding();
|
|
76
63
|
const container = await inversifyBinbding.initBindings({
|
|
77
64
|
pluginRegistryUrl,
|
|
@@ -82,12 +69,12 @@ export class Main {
|
|
|
82
69
|
let devfileContent;
|
|
83
70
|
let editorContent;
|
|
84
71
|
|
|
85
|
-
// gets the
|
|
86
|
-
if (devfileUrl) {
|
|
87
|
-
const
|
|
88
|
-
const
|
|
72
|
+
// gets the repo URL
|
|
73
|
+
if (params.devfileUrl) {
|
|
74
|
+
const resolver = container.get(GitUrlResolver);
|
|
75
|
+
const url = resolver.resolve(params.devfileUrl);
|
|
89
76
|
// user devfile
|
|
90
|
-
devfileContent = await container.get(UrlFetcher).fetchText(
|
|
77
|
+
devfileContent = await container.get(UrlFetcher).fetchText(url.getContentUrl('devfile.yaml'));
|
|
91
78
|
|
|
92
79
|
// load content
|
|
93
80
|
const devfileParsed = jsYaml.load(devfileContent);
|
|
@@ -97,33 +84,43 @@ export class Main {
|
|
|
97
84
|
// no, so add the current project being cloned
|
|
98
85
|
devfileParsed.projects = [
|
|
99
86
|
{
|
|
100
|
-
name:
|
|
87
|
+
name: url.getRepoName(),
|
|
101
88
|
git: {
|
|
102
|
-
remotes: { origin:
|
|
103
|
-
checkoutFrom: { revision:
|
|
89
|
+
remotes: { origin: url.getCloneUrl() },
|
|
90
|
+
checkoutFrom: { revision: url.getBranchName() },
|
|
104
91
|
},
|
|
105
92
|
},
|
|
106
93
|
];
|
|
107
94
|
}
|
|
108
95
|
// get back the content
|
|
109
96
|
devfileContent = jsYaml.dump(devfileParsed);
|
|
97
|
+
} else if (params.devfilePath) {
|
|
98
|
+
devfileContent = await fs.readFile(params.devfilePath);
|
|
110
99
|
} else {
|
|
111
|
-
devfileContent =
|
|
100
|
+
devfileContent = params.devfileContent;
|
|
112
101
|
}
|
|
113
102
|
|
|
114
103
|
// enhance projects
|
|
115
|
-
devfileContent = this.replaceIfExistingProjects(devfileContent, projects);
|
|
104
|
+
devfileContent = this.replaceIfExistingProjects(devfileContent, params.projects);
|
|
116
105
|
|
|
117
|
-
if (
|
|
106
|
+
if (params.editorContent) {
|
|
107
|
+
editorContent = params.editorContent;
|
|
108
|
+
} else if (params.editorEntry) {
|
|
118
109
|
// devfile of the editor
|
|
119
|
-
const editorDevfile = await container.get(PluginRegistryResolver).loadDevfilePlugin(editorEntry);
|
|
110
|
+
const editorDevfile = await container.get(PluginRegistryResolver).loadDevfilePlugin(params.editorEntry);
|
|
120
111
|
editorContent = jsYaml.dump(editorDevfile);
|
|
121
112
|
} else {
|
|
122
|
-
editorContent = await fs.readFile(editorPath);
|
|
113
|
+
editorContent = await fs.readFile(params.editorPath);
|
|
123
114
|
}
|
|
124
115
|
|
|
125
116
|
const generate = container.get(Generate);
|
|
126
|
-
return generate.generate(
|
|
117
|
+
return generate.generate(
|
|
118
|
+
devfileContent,
|
|
119
|
+
editorContent,
|
|
120
|
+
params.outputFile,
|
|
121
|
+
params.injectDefaultComponent,
|
|
122
|
+
params.defaultComponentImage
|
|
123
|
+
);
|
|
127
124
|
}
|
|
128
125
|
|
|
129
126
|
// Update project entry based on the projects passed as parameter
|
|
@@ -154,8 +151,75 @@ export class Main {
|
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
async start(): Promise<boolean> {
|
|
154
|
+
let devfilePath: string | undefined;
|
|
155
|
+
let devfileUrl: string | undefined;
|
|
156
|
+
let outputFile: string | undefined;
|
|
157
|
+
let editorPath: string | undefined;
|
|
158
|
+
let pluginRegistryUrl: string | undefined;
|
|
159
|
+
let editorEntry: string | undefined;
|
|
160
|
+
let injectDefaultComponent: string | undefined;
|
|
161
|
+
let defaultComponentImage: string | undefined;
|
|
162
|
+
const projects: { name: string; location: string }[] = [];
|
|
163
|
+
|
|
164
|
+
const args = process.argv.slice(2);
|
|
165
|
+
args.forEach(arg => {
|
|
166
|
+
if (arg.startsWith('--devfile-path:')) {
|
|
167
|
+
devfilePath = arg.substring('--devfile-path:'.length);
|
|
168
|
+
}
|
|
169
|
+
if (arg.startsWith('--devfile-url:')) {
|
|
170
|
+
devfileUrl = arg.substring('--devfile-url:'.length);
|
|
171
|
+
}
|
|
172
|
+
if (arg.startsWith('--plugin-registry-url:')) {
|
|
173
|
+
pluginRegistryUrl = arg.substring('--plugin-registry-url:'.length);
|
|
174
|
+
}
|
|
175
|
+
if (arg.startsWith('--editor-entry:')) {
|
|
176
|
+
editorEntry = arg.substring('--editor-entry:'.length);
|
|
177
|
+
}
|
|
178
|
+
if (arg.startsWith('--editor-path:')) {
|
|
179
|
+
editorPath = arg.substring('--editor-path:'.length);
|
|
180
|
+
}
|
|
181
|
+
if (arg.startsWith('--output-file:')) {
|
|
182
|
+
outputFile = arg.substring('--output-file:'.length);
|
|
183
|
+
}
|
|
184
|
+
if (arg.startsWith('--project.')) {
|
|
185
|
+
const name = arg.substring('--project.'.length, arg.indexOf('='));
|
|
186
|
+
let location = arg.substring(arg.indexOf('=') + 1);
|
|
187
|
+
location = location.replace('{{_INTERNAL_URL_}}', '{{ INTERNAL_URL }}');
|
|
188
|
+
|
|
189
|
+
projects.push({ name, location });
|
|
190
|
+
}
|
|
191
|
+
if (arg.startsWith('--injectDefaultComponent:')) {
|
|
192
|
+
injectDefaultComponent = arg.substring('--injectDefaultComponent:'.length);
|
|
193
|
+
}
|
|
194
|
+
if (arg.startsWith('--defaultComponentImage:')) {
|
|
195
|
+
defaultComponentImage = arg.substring('--defaultComponentImage:'.length);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
157
199
|
try {
|
|
158
|
-
|
|
200
|
+
if (!editorPath && !editorEntry) {
|
|
201
|
+
throw new Error('missing --editor-path: or --editor-entry: parameter');
|
|
202
|
+
}
|
|
203
|
+
if (!devfilePath && !devfileUrl) {
|
|
204
|
+
throw new Error('missing --devfile-path: or --devfile-url: parameter');
|
|
205
|
+
}
|
|
206
|
+
if (!outputFile) {
|
|
207
|
+
throw new Error('missing --output-file: parameter');
|
|
208
|
+
}
|
|
209
|
+
await this.generateDevfileContext(
|
|
210
|
+
{
|
|
211
|
+
devfilePath,
|
|
212
|
+
devfileUrl,
|
|
213
|
+
editorPath,
|
|
214
|
+
outputFile,
|
|
215
|
+
pluginRegistryUrl,
|
|
216
|
+
editorEntry,
|
|
217
|
+
projects,
|
|
218
|
+
injectDefaultComponent,
|
|
219
|
+
defaultComponentImage,
|
|
220
|
+
},
|
|
221
|
+
axios.default
|
|
222
|
+
);
|
|
159
223
|
return true;
|
|
160
224
|
} catch (error) {
|
|
161
225
|
console.error('stack=' + error.stack);
|
|
@@ -26,7 +26,7 @@ export class PluginRegistryResolver {
|
|
|
26
26
|
@inject(UrlFetcher)
|
|
27
27
|
private urlFetcher: UrlFetcher;
|
|
28
28
|
|
|
29
|
-
// FQN id (like
|
|
29
|
+
// FQN id (like che-incubator/che-code/next)
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
31
|
async loadDevfilePlugin(devfileId: string): Promise<any> {
|
|
32
32
|
const devfileUrl = `${this.pluginRegistryUrl}/plugins/${devfileId}/devfile.yaml`;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import { injectable, multiInject } from 'inversify';
|
|
11
|
+
import { Url } from './url';
|
|
12
|
+
import { TYPES } from '../types';
|
|
13
|
+
import { Resolver } from './resolver';
|
|
14
|
+
|
|
15
|
+
const { Resolver } = TYPES;
|
|
16
|
+
|
|
17
|
+
@injectable()
|
|
18
|
+
export class GitUrlResolver {
|
|
19
|
+
@multiInject(Resolver)
|
|
20
|
+
private resolvers: Resolver[];
|
|
21
|
+
|
|
22
|
+
resolve(link: string): Url {
|
|
23
|
+
const resolver = this.resolvers.find(r => r.isValid(link));
|
|
24
|
+
if (resolver) {
|
|
25
|
+
return resolver.resolve(link);
|
|
26
|
+
} else {
|
|
27
|
+
throw new Error('Can not resolver the URL');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { ContainerModule, interfaces } from 'inversify';
|
|
11
|
+
|
|
12
|
+
import { GitUrlResolver } from './git-url-resolver';
|
|
13
|
+
|
|
14
|
+
const resolveModule = new ContainerModule((bind: interfaces.Bind) => {
|
|
15
|
+
bind(GitUrlResolver).toSelf().inSingletonScope();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { resolveModule };
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { Url } from './url';
|
|
12
|
+
|
|
13
|
+
export interface Resolver {
|
|
14
|
+
/**
|
|
15
|
+
* Validates the string url for belonging to a specific Git provider.
|
|
16
|
+
* @param url string representation of Url.
|
|
17
|
+
*/
|
|
18
|
+
isValid(url: string): boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Resolves repository string URL to a {@class Url} object.
|
|
22
|
+
* @param url string representation of Url.
|
|
23
|
+
*/
|
|
24
|
+
resolve(url: string): Url;
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Url object
|
|
13
|
+
*/
|
|
14
|
+
export interface Url {
|
|
15
|
+
/**
|
|
16
|
+
* Provides RAW file content url
|
|
17
|
+
* @param path file path
|
|
18
|
+
*/
|
|
19
|
+
getContentUrl(path: string);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Provides repositories Url
|
|
23
|
+
*/
|
|
24
|
+
getUrl(): string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Provides Git clone url
|
|
28
|
+
*/
|
|
29
|
+
getCloneUrl(): string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Provides repository name
|
|
33
|
+
*/
|
|
34
|
+
getRepoName(): string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Provides branch name if initialised.
|
|
38
|
+
*/
|
|
39
|
+
getBranchName(): string;
|
|
40
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
const TYPES = {
|
|
11
|
+
Resolver: Symbol.for('Resolver'),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { TYPES };
|