@eclipse-che/che-devworkspace-generator 0.0.1-602dcb4 → 0.0.1-6ef61ae
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/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/generate.d.ts +0 -1
- package/lib/generate.js +5 -18
- package/lib/generate.js.map +1 -1
- package/lib/github/github-module.js +3 -1
- package/lib/github/github-module.js.map +1 -1
- package/lib/github/github-resolver.d.ts +6 -7
- package/lib/github/github-resolver.js +6 -3
- package/lib/github/github-resolver.js.map +1 -1
- package/lib/github/github-url.d.ts +2 -4
- package/lib/github/github-url.js +0 -3
- package/lib/github/github-url.js.map +1 -1
- package/lib/inversify/inversify-binding.js +6 -0
- package/lib/inversify/inversify-binding.js.map +1 -1
- package/lib/main.js +8 -8
- package/lib/main.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 +1 -1
- 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/generate.ts +2 -20
- package/src/github/github-module.ts +4 -1
- package/src/github/github-resolver.ts +13 -7
- package/src/github/github-url.ts +3 -4
- package/src/inversify/inversify-binding.ts +6 -0
- package/src/main.ts +8 -8
- 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
|
@@ -0,0 +1,12 @@
|
|
|
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 } from 'inversify';
|
|
11
|
+
declare const bitbucketModule: ContainerModule;
|
|
12
|
+
export { bitbucketModule };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.bitbucketModule = void 0;
|
|
4
|
+
/**********************************************************************
|
|
5
|
+
* Copyright (c) 2023 Red Hat, Inc.
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made
|
|
8
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
9
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
10
|
+
*
|
|
11
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
12
|
+
***********************************************************************/
|
|
13
|
+
var inversify_1 = require("inversify");
|
|
14
|
+
var bitbucket_resolver_1 = require("./bitbucket-resolver");
|
|
15
|
+
var types_1 = require("../types");
|
|
16
|
+
var Resolver = types_1.TYPES.Resolver;
|
|
17
|
+
var bitbucketModule = new inversify_1.ContainerModule(function (bind) {
|
|
18
|
+
bind(Resolver).to(bitbucket_resolver_1.BitbucketResolver).inSingletonScope();
|
|
19
|
+
});
|
|
20
|
+
exports.bitbucketModule = bitbucketModule;
|
|
21
|
+
//# sourceMappingURL=bitbucket-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-module.js","sourceRoot":"","sources":["../../src/bitbucket/bitbucket-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,uCAAwD;AAExD,2DAAyD;AACzD,kCAAiC;AAEzB,IAAA,QAAQ,GAAK,aAAK,SAAV,CAAW;AAE3B,IAAM,eAAe,GAAG,IAAI,2BAAe,CAAC,UAAC,IAAqB;IAChE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,sCAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEM,0CAAe"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { Url } from '../resolve/url';
|
|
11
|
+
import { Resolver } from '../resolve/resolver';
|
|
12
|
+
export declare class BitbucketResolver implements Resolver {
|
|
13
|
+
static readonly BITBUCKET_URL_PATTERN: RegExp;
|
|
14
|
+
isValid(url: string): boolean;
|
|
15
|
+
resolve(url: string): Url;
|
|
16
|
+
private getGroup;
|
|
17
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**********************************************************************
|
|
3
|
+
* Copyright (c) 2023 Red Hat, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made
|
|
6
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
7
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
8
|
+
*
|
|
9
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
***********************************************************************/
|
|
11
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
12
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
|
+
};
|
|
17
|
+
exports.__esModule = true;
|
|
18
|
+
exports.BitbucketResolver = void 0;
|
|
19
|
+
var bitbucket_url_1 = require("./bitbucket-url");
|
|
20
|
+
var inversify_1 = require("inversify");
|
|
21
|
+
var BitbucketResolver = /** @class */ (function () {
|
|
22
|
+
function BitbucketResolver() {
|
|
23
|
+
}
|
|
24
|
+
BitbucketResolver_1 = BitbucketResolver;
|
|
25
|
+
BitbucketResolver.prototype.isValid = function (url) {
|
|
26
|
+
return BitbucketResolver_1.BITBUCKET_URL_PATTERN.test(url);
|
|
27
|
+
};
|
|
28
|
+
BitbucketResolver.prototype.resolve = function (url) {
|
|
29
|
+
var match = BitbucketResolver_1.BITBUCKET_URL_PATTERN.exec(url);
|
|
30
|
+
if (!match) {
|
|
31
|
+
throw new Error("Invalid bitbucket URL: " + url);
|
|
32
|
+
}
|
|
33
|
+
var workspaceId = this.getGroup(match, 'workspaceId');
|
|
34
|
+
var repoName = this.getGroup(match, 'repoName');
|
|
35
|
+
if (/^[\w-][\w.-]*?\.git$/.test(repoName)) {
|
|
36
|
+
repoName = repoName.substring(0, repoName.length - 4);
|
|
37
|
+
}
|
|
38
|
+
var branchName = this.getGroup(match, 'branchName', 'HEAD');
|
|
39
|
+
return new bitbucket_url_1.BitbucketUrl(workspaceId, repoName, branchName);
|
|
40
|
+
};
|
|
41
|
+
BitbucketResolver.prototype.getGroup = function (match, groupName, defaultValue) {
|
|
42
|
+
if (match.groups && match.groups[groupName]) {
|
|
43
|
+
return match.groups[groupName];
|
|
44
|
+
}
|
|
45
|
+
return defaultValue;
|
|
46
|
+
};
|
|
47
|
+
var BitbucketResolver_1;
|
|
48
|
+
// eslint-disable-next-line max-len
|
|
49
|
+
BitbucketResolver.BITBUCKET_URL_PATTERN = /^https:\/\/.*@?bitbucket\.org\/(?<workspaceId>[^\/]+)\/(?<repoName>[^\/]+)(\/(src|branch)\/(?<branchName>[^\/]+))?\/?$/;
|
|
50
|
+
BitbucketResolver = BitbucketResolver_1 = __decorate([
|
|
51
|
+
(0, inversify_1.injectable)()
|
|
52
|
+
], BitbucketResolver);
|
|
53
|
+
return BitbucketResolver;
|
|
54
|
+
}());
|
|
55
|
+
exports.BitbucketResolver = BitbucketResolver;
|
|
56
|
+
//#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AO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAChC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;;IA3BD,mCAAmC;IACnB,uCAAqB,GACnC,wHAAyH,CAAA;IAHhH,iBAAiB;QAD7B,IAAA,sBAAU,GAAE;OACA,iBAAiB,CA6B7B;IAAD,wBAAC;CAAA,AA7BD,IA6BC;AA7BY,8CAAiB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { Url } from '../resolve/url';
|
|
11
|
+
export declare class BitbucketUrl implements Url {
|
|
12
|
+
private readonly workspaceId;
|
|
13
|
+
private readonly repoName;
|
|
14
|
+
private readonly branchName;
|
|
15
|
+
private static readonly BITBUCKET_URL;
|
|
16
|
+
constructor(workspaceId: string, repoName: string, branchName: string);
|
|
17
|
+
getContentUrl(path: string): string;
|
|
18
|
+
getUrl(): string;
|
|
19
|
+
getCloneUrl(): string;
|
|
20
|
+
getRepoName(): string;
|
|
21
|
+
getBranchName(): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**********************************************************************
|
|
3
|
+
* Copyright (c) 2023 Red Hat, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made
|
|
6
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
7
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
8
|
+
*
|
|
9
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
***********************************************************************/
|
|
11
|
+
exports.__esModule = true;
|
|
12
|
+
exports.BitbucketUrl = void 0;
|
|
13
|
+
var BitbucketUrl = /** @class */ (function () {
|
|
14
|
+
function BitbucketUrl(workspaceId, repoName, branchName) {
|
|
15
|
+
this.workspaceId = workspaceId;
|
|
16
|
+
this.repoName = repoName;
|
|
17
|
+
this.branchName = branchName;
|
|
18
|
+
}
|
|
19
|
+
BitbucketUrl.prototype.getContentUrl = function (path) {
|
|
20
|
+
return BitbucketUrl.BITBUCKET_URL + "/" + this.workspaceId + "/" + this.repoName + "/raw/" + this.branchName + "/" + path;
|
|
21
|
+
};
|
|
22
|
+
BitbucketUrl.prototype.getUrl = function () {
|
|
23
|
+
return BitbucketUrl.BITBUCKET_URL + "/" + this.workspaceId + "/" + this.repoName + "/src/" + this.branchName;
|
|
24
|
+
};
|
|
25
|
+
BitbucketUrl.prototype.getCloneUrl = function () {
|
|
26
|
+
return BitbucketUrl.BITBUCKET_URL + "/" + this.workspaceId + "/" + this.repoName + ".git";
|
|
27
|
+
};
|
|
28
|
+
BitbucketUrl.prototype.getRepoName = function () {
|
|
29
|
+
return this.repoName;
|
|
30
|
+
};
|
|
31
|
+
BitbucketUrl.prototype.getBranchName = function () {
|
|
32
|
+
return this.branchName;
|
|
33
|
+
};
|
|
34
|
+
BitbucketUrl.BITBUCKET_URL = 'https://bitbucket.org';
|
|
35
|
+
return BitbucketUrl;
|
|
36
|
+
}());
|
|
37
|
+
exports.BitbucketUrl = BitbucketUrl;
|
|
38
|
+
//# sourceMappingURL=bitbucket-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-url.js","sourceRoot":"","sources":["../../src/bitbucket/bitbucket-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAIzE;IAGE,sBACmB,WAAmB,EACnB,QAAgB,EAChB,UAAkB;QAFlB,gBAAW,GAAX,WAAW,CAAQ;QACnB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,oCAAa,GAAb,UAAc,IAAY;QACxB,OAAU,YAAY,CAAC,aAAa,SAAI,IAAI,CAAC,WAAW,SAAI,IAAI,CAAC,QAAQ,aAAQ,IAAI,CAAC,UAAU,SAAI,IAAM,CAAC;IAC7G,CAAC;IAED,6BAAM,GAAN;QACE,OAAU,YAAY,CAAC,aAAa,SAAI,IAAI,CAAC,WAAW,SAAI,IAAI,CAAC,QAAQ,aAAQ,IAAI,CAAC,UAAY,CAAC;IACrG,CAAC;IAED,kCAAW,GAAX;QACE,OAAU,YAAY,CAAC,aAAa,SAAI,IAAI,CAAC,WAAW,SAAI,IAAI,CAAC,QAAQ,SAAM,CAAC;IAClF,CAAC;IAED,kCAAW,GAAX;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,oCAAa,GAAb;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IA1BuB,0BAAa,GAAG,uBAAuB,CAAC;IA2BlE,mBAAC;CAAA,AA5BD,IA4BC;AA5BY,oCAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 } from 'inversify';
|
|
11
|
+
declare const bitbucketServerModule: ContainerModule;
|
|
12
|
+
export { bitbucketServerModule };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.bitbucketServerModule = void 0;
|
|
4
|
+
/**********************************************************************
|
|
5
|
+
* Copyright (c) 2023 Red Hat, Inc.
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made
|
|
8
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
9
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
10
|
+
*
|
|
11
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
12
|
+
***********************************************************************/
|
|
13
|
+
var inversify_1 = require("inversify");
|
|
14
|
+
var bitbucket_server_resolver_1 = require("./bitbucket-server-resolver");
|
|
15
|
+
var types_1 = require("../types");
|
|
16
|
+
var Resolver = types_1.TYPES.Resolver;
|
|
17
|
+
var bitbucketServerModule = new inversify_1.ContainerModule(function (bind) {
|
|
18
|
+
bind(Resolver).to(bitbucket_server_resolver_1.BitbucketServerResolver).inSingletonScope();
|
|
19
|
+
});
|
|
20
|
+
exports.bitbucketServerModule = bitbucketServerModule;
|
|
21
|
+
//# sourceMappingURL=bitbucket-server-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-server-module.js","sourceRoot":"","sources":["../../src/bitbucket-server/bitbucket-server-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,uCAAwD;AAExD,yEAAsE;AACtE,kCAAiC;AAEzB,IAAA,QAAQ,GAAK,aAAK,SAAV,CAAW;AAE3B,IAAM,qBAAqB,GAAG,IAAI,2BAAe,CAAC,UAAC,IAAqB;IACtE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,mDAAuB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAChE,CAAC,CAAC,CAAC;AAEM,sDAAqB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { Url } from '../resolve/url';
|
|
11
|
+
import { Resolver } from '../resolve/resolver';
|
|
12
|
+
export declare class BitbucketServerResolver implements Resolver {
|
|
13
|
+
static readonly BITBUCKET_URL_PATTERNS: RegExp[];
|
|
14
|
+
isValid(url: string): boolean;
|
|
15
|
+
resolve(url: string): Url;
|
|
16
|
+
private getGroup;
|
|
17
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**********************************************************************
|
|
3
|
+
* Copyright (c) 2023 Red Hat, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made
|
|
6
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
7
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
8
|
+
*
|
|
9
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
***********************************************************************/
|
|
11
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
12
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
|
+
};
|
|
17
|
+
exports.__esModule = true;
|
|
18
|
+
exports.BitbucketServerResolver = void 0;
|
|
19
|
+
var bitbucket_server_url_1 = require("./bitbucket-server-url");
|
|
20
|
+
var inversify_1 = require("inversify");
|
|
21
|
+
var BitbucketServerResolver = /** @class */ (function () {
|
|
22
|
+
function BitbucketServerResolver() {
|
|
23
|
+
}
|
|
24
|
+
BitbucketServerResolver_1 = BitbucketServerResolver;
|
|
25
|
+
BitbucketServerResolver.prototype.isValid = function (url) {
|
|
26
|
+
return BitbucketServerResolver_1.BITBUCKET_URL_PATTERNS.some(function (p) { return p.test(url); });
|
|
27
|
+
};
|
|
28
|
+
BitbucketServerResolver.prototype.resolve = function (url) {
|
|
29
|
+
var regExp = BitbucketServerResolver_1.BITBUCKET_URL_PATTERNS.find(function (p) { return p.test(url); });
|
|
30
|
+
if (!regExp) {
|
|
31
|
+
throw new Error("Invalid bitbucket-server URL: " + url);
|
|
32
|
+
}
|
|
33
|
+
var match = regExp.exec(url);
|
|
34
|
+
var scheme = this.getGroup(match, 'scheme');
|
|
35
|
+
var hostName = this.getGroup(match, 'host');
|
|
36
|
+
var user = this.getGroup(match, 'user');
|
|
37
|
+
var project = this.getGroup(match, 'project');
|
|
38
|
+
var repo = this.getGroup(match, 'repo');
|
|
39
|
+
var branch = this.getGroup(match, 'branch');
|
|
40
|
+
if (branch !== undefined && branch.startsWith('refs%2Fheads%2F')) {
|
|
41
|
+
branch = branch.substring(15);
|
|
42
|
+
}
|
|
43
|
+
return new bitbucket_server_url_1.BitbucketServerUrl(scheme, hostName, user, project, repo, branch);
|
|
44
|
+
};
|
|
45
|
+
BitbucketServerResolver.prototype.getGroup = function (match, groupName) {
|
|
46
|
+
if (match.groups && match.groups[groupName]) {
|
|
47
|
+
return match.groups[groupName];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var BitbucketServerResolver_1;
|
|
51
|
+
// eslint-disable-next-line max-len
|
|
52
|
+
BitbucketServerResolver.BITBUCKET_URL_PATTERNS = [
|
|
53
|
+
/^(?<scheme>https?):\/\/(?<host>.*)\/scm\/~(?<user>[^\/]+)\/(?<repo>.*).git$/,
|
|
54
|
+
/^(?<scheme>https?):\/\/(?<host>.*)\/users\/(?<user>[^\/]+)\/repos\/(?<repo>[^\/]+)\/browse(\?at=(?<branch>.*))?$/,
|
|
55
|
+
/^(?<scheme>https?):\/\/(?<host>.*)\/scm\/(?<project>[^\/~]+)\/(?<repo>[^\/]+).git$/,
|
|
56
|
+
/^(?<scheme>https?):\/\/(?<host>.*)\/projects\/(?<project>[^\/]+)\/repos\/(?<repo>[^\/]+)\/browse(\?at=(?<branch>.*))?$/,
|
|
57
|
+
];
|
|
58
|
+
BitbucketServerResolver = BitbucketServerResolver_1 = __decorate([
|
|
59
|
+
(0, inversify_1.injectable)()
|
|
60
|
+
], BitbucketServerResolver);
|
|
61
|
+
return BitbucketServerResolver;
|
|
62
|
+
}());
|
|
63
|
+
exports.BitbucketServerResolver = BitbucketServerResolver;
|
|
64
|
+
//# sourceMappingURL=bitbucket-server-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-server-resolver.js","sourceRoot":"","sources":["../../src/bitbucket-server/bitbucket-server-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;AAEzE,+DAA4D;AAC5D,uCAAuC;AAKvC;IAAA;IAoCA,CAAC;gCApCY,uBAAuB;IASlC,yCAAO,GAAP,UAAQ,GAAW;QACjB,OAAO,yBAAuB,CAAC,sBAAsB,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC;IAC/E,CAAC;IAED,yCAAO,GAAP,UAAQ,GAAW;QACjB,IAAM,MAAM,GAAG,yBAAuB,CAAC,sBAAsB,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC;QACrF,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,mCAAiC,GAAK,CAAC,CAAC;SACzD;QACD,IAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC9C,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9C,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAChD,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC5C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;YAChE,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SAC/B;QACD,OAAO,IAAI,yCAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;IAEO,0CAAQ,GAAhB,UAAiB,KAAsB,EAAE,SAAiB;QACxD,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC3C,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAChC;IACH,CAAC;;IAlCD,mCAAmC;IACnB,8CAAsB,GAAa;QACjD,6EAA6E;QAC7E,kHAAkH;QAClH,oFAAoF;QACpF,wHAAwH;KACxH,CAAA;IAPS,uBAAuB;QADnC,IAAA,sBAAU,GAAE;OACA,uBAAuB,CAoCnC;IAAD,8BAAC;CAAA,AApCD,IAoCC;AApCY,0DAAuB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { Url } from '../resolve/url';
|
|
11
|
+
export declare class BitbucketServerUrl implements Url {
|
|
12
|
+
private readonly scheme;
|
|
13
|
+
private readonly hostName;
|
|
14
|
+
private readonly user;
|
|
15
|
+
private readonly project;
|
|
16
|
+
private readonly repo;
|
|
17
|
+
private readonly branch;
|
|
18
|
+
constructor(scheme: string, hostName: string, user: string | undefined, project: string | undefined, repo: string, branch: string | undefined);
|
|
19
|
+
getContentUrl(path: string): string;
|
|
20
|
+
getUrl(): string;
|
|
21
|
+
getCloneUrl(): string;
|
|
22
|
+
getRepoName(): string;
|
|
23
|
+
getBranchName(): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**********************************************************************
|
|
3
|
+
* Copyright (c) 2023 Red Hat, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made
|
|
6
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
7
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
8
|
+
*
|
|
9
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
***********************************************************************/
|
|
11
|
+
exports.__esModule = true;
|
|
12
|
+
exports.BitbucketServerUrl = void 0;
|
|
13
|
+
var BitbucketServerUrl = /** @class */ (function () {
|
|
14
|
+
function BitbucketServerUrl(scheme, hostName, user, project, repo, branch) {
|
|
15
|
+
this.scheme = scheme;
|
|
16
|
+
this.hostName = hostName;
|
|
17
|
+
this.user = user;
|
|
18
|
+
this.project = project;
|
|
19
|
+
this.repo = repo;
|
|
20
|
+
this.branch = branch;
|
|
21
|
+
}
|
|
22
|
+
BitbucketServerUrl.prototype.getContentUrl = function (path) {
|
|
23
|
+
var isUser = this.user !== undefined;
|
|
24
|
+
return this.scheme + "://" + this.hostName + "/" + (isUser ? 'users' : 'projects') + "/" + (isUser ? this.user : this.project) + "/repos/" + this.repo + "/raw/" + path + (this.branch !== undefined ? '?/at=' + this.branch : '');
|
|
25
|
+
};
|
|
26
|
+
BitbucketServerUrl.prototype.getUrl = function () {
|
|
27
|
+
var isUser = this.user !== undefined;
|
|
28
|
+
return this.scheme + "://" + this.hostName + "/" + (isUser ? 'users' : 'projects') + "/" + (isUser ? this.user : this.project) + "/repos/" + this.repo + (this.branch !== undefined ? '/browse?at=' + this.branch : '');
|
|
29
|
+
};
|
|
30
|
+
BitbucketServerUrl.prototype.getCloneUrl = function () {
|
|
31
|
+
var isUser = this.user !== undefined;
|
|
32
|
+
return this.scheme + "://" + this.hostName + "/scm/" + (isUser ? '~' + this.user : this.project.toLowerCase()) + "/" + this.repo + ".git";
|
|
33
|
+
};
|
|
34
|
+
BitbucketServerUrl.prototype.getRepoName = function () {
|
|
35
|
+
return this.repo;
|
|
36
|
+
};
|
|
37
|
+
BitbucketServerUrl.prototype.getBranchName = function () {
|
|
38
|
+
return this.branch;
|
|
39
|
+
};
|
|
40
|
+
return BitbucketServerUrl;
|
|
41
|
+
}());
|
|
42
|
+
exports.BitbucketServerUrl = BitbucketServerUrl;
|
|
43
|
+
//# sourceMappingURL=bitbucket-server-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-server-url.js","sourceRoot":"","sources":["../../src/bitbucket-server/bitbucket-server-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAIzE;IACE,4BACmB,MAAc,EACd,QAAgB,EAChB,IAAwB,EACxB,OAA2B,EAC3B,IAAY,EACZ,MAA0B;QAL1B,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAChB,SAAI,GAAJ,IAAI,CAAoB;QACxB,YAAO,GAAP,OAAO,CAAoB;QAC3B,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAoB;IA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IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,0CAAa,GAAb;QACE,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACH,yBAAC;AAAD,CAAC,AAtCD,IAsCC;AAtCY,gDAAkB"}
|
package/lib/generate.d.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
***********************************************************************/
|
|
10
10
|
import { DevfileContext } from './api/devfile-context';
|
|
11
11
|
export declare class Generate {
|
|
12
|
-
static readonly MERGE_CONTRIBUTION = "controller.devfile.io/merge-contribution";
|
|
13
12
|
private devContainerComponentFinder;
|
|
14
13
|
generate(devfileContent: string, editorContent: string, outputFile?: string, injectDefaultComponent?: string, defaultComponentImage?: string): Promise<DevfileContext>;
|
|
15
14
|
generateContent(devfileContent: string, editorContent: string, injectDefaultComponent?: string, defaultComponentImage?: string): Promise<DevfileContext>;
|
package/lib/generate.js
CHANGED
|
@@ -78,7 +78,6 @@ var dev_container_component_finder_1 = require("./devfile/dev-container-componen
|
|
|
78
78
|
var Generate = /** @class */ (function () {
|
|
79
79
|
function Generate() {
|
|
80
80
|
}
|
|
81
|
-
Generate_1 = Generate;
|
|
82
81
|
Generate.prototype.generate = function (devfileContent, editorContent, outputFile, injectDefaultComponent, defaultComponentImage) {
|
|
83
82
|
return __awaiter(this, void 0, void 0, function () {
|
|
84
83
|
var context, allContentArray, generatedContent;
|
|
@@ -104,7 +103,7 @@ var Generate = /** @class */ (function () {
|
|
|
104
103
|
};
|
|
105
104
|
Generate.prototype.generateContent = function (devfileContent, editorContent, injectDefaultComponent, defaultComponentImage) {
|
|
106
105
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
var devfile, suffix, editorDevfile, metadata, editorDevWorkspaceTemplate, devfileMetadata, devfileCopy, editorSpecContribution, devWorkspace, devWorkspaceTemplates, context
|
|
106
|
+
var devfile, suffix, editorDevfile, metadata, editorDevWorkspaceTemplate, devfileMetadata, devfileCopy, editorSpecContribution, devWorkspace, devWorkspaceTemplates, context;
|
|
108
107
|
return __generator(this, function (_a) {
|
|
109
108
|
switch (_a.label) {
|
|
110
109
|
case 0:
|
|
@@ -150,21 +149,11 @@ var Generate = /** @class */ (function () {
|
|
|
150
149
|
devWorkspaceTemplates: devWorkspaceTemplates,
|
|
151
150
|
suffix: suffix
|
|
152
151
|
};
|
|
152
|
+
// find devContainer component, add a default one if not found
|
|
153
153
|
return [4 /*yield*/, this.devContainerComponentFinder.find(context, injectDefaultComponent, defaultComponentImage)];
|
|
154
154
|
case 1:
|
|
155
|
-
devContainer
|
|
156
|
-
|
|
157
|
-
return [2 /*return*/, context];
|
|
158
|
-
}
|
|
159
|
-
devContainerAttributes = devContainer.attributes;
|
|
160
|
-
if (!devContainerAttributes) {
|
|
161
|
-
devContainerAttributes = {};
|
|
162
|
-
devContainerAttributes[Generate_1.MERGE_CONTRIBUTION] = true;
|
|
163
|
-
devContainer.attributes = devContainerAttributes;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
devContainerAttributes[Generate_1.MERGE_CONTRIBUTION] = true;
|
|
167
|
-
}
|
|
155
|
+
// find devContainer component, add a default one if not found
|
|
156
|
+
_a.sent();
|
|
168
157
|
return [2 /*return*/, context];
|
|
169
158
|
}
|
|
170
159
|
});
|
|
@@ -187,12 +176,10 @@ var Generate = /** @class */ (function () {
|
|
|
187
176
|
}
|
|
188
177
|
return devWorkspaceMetadata;
|
|
189
178
|
};
|
|
190
|
-
var Generate_1;
|
|
191
|
-
Generate.MERGE_CONTRIBUTION = 'controller.devfile.io/merge-contribution';
|
|
192
179
|
__decorate([
|
|
193
180
|
(0, inversify_1.inject)(dev_container_component_finder_1.DevContainerComponentFinder)
|
|
194
181
|
], Generate.prototype, "devContainerComponentFinder");
|
|
195
|
-
Generate =
|
|
182
|
+
Generate = __decorate([
|
|
196
183
|
(0, inversify_1.injectable)()
|
|
197
184
|
], Generate);
|
|
198
185
|
return Generate;
|
package/lib/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWzE,uCAA+C;AAC/C,8CAAkC;AAClC,2CAA+B;AAE/B,2FAAuF;AASvF;IAAA;IAsHA,CAAC;IAlHO,2BAAQ,GAAd,UACE,cAAsB,EACtB,aAAqB,EACrB,UAAmB,EACnB,sBAA+B,EAC/B,qBAA8B;;;;;4BAEd,qBAAM,IAAI,CAAC,eAAe,CACxC,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,qBAAqB,CACtB,EAAA;;wBALK,OAAO,GAAG,SAKf;6BAGG,UAAU,EAAV,wBAAU;wBAEN,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAA,QAAQ,IAAI,OAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAArB,CAAqB,CAAC,CAAC;wBAC7F,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;wBAElD,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBAEvD,qBAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAA;;wBAAzD,SAAyD,CAAC;;;wBAG5D,OAAO,CAAC,GAAG,CAAC,kBAAgB,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,oBAAiB,CAAC,CAAC;wBAC7F,sBAAO,OAAO,EAA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AE,CAAC,sBAAsB,CAAC;6BACxC;yBACF,CAAC;wBAGI,qBAAqB,GAAG,CAAC,0BAA0B,CAAC,CAAC;wBAErD,OAAO,GAAG;4BACd,OAAO,SAAA;4BACP,YAAY,cAAA;4BACZ,qBAAqB,uBAAA;4BACrB,MAAM,QAAA;yBACP,CAAC;wBAEF,8DAA8D;wBAC9D,qBAAM,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,EAAA;;wBADnG,8DAA8D;wBAC9D,SAAmG,CAAC;wBAEpG,sBAAO,OAAO,EAAC;;;;KAChB;IAEO,6CAA0B,GAAlC,UAAmC,OAAoB,EAAE,iBAAyB;QAAzB,kCAAA,EAAA,yBAAyB;QAChF,IAAM,oBAAoB,GAAG,EAAkC,CAAC;QAChE,IAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;QAEzC,IAAI,eAAe,CAAC,IAAI,EAAE;YACxB,oBAAoB,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;SAClD;QACD,IAAI,eAAe,CAAC,YAAY,EAAE;YAChC,oBAAoB,CAAC,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC;SAClE;QACD,IAAI,iBAAiB,EAAE;YACrB,oBAAoB,CAAC,WAAW,GAAG;gBACjC,yBAAyB,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aAChD,CAAC;SACH;QAED,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAnHD;QADC,IAAA,kBAAM,EAAC,4DAA2B,CAAC;yDAC6B;IAFtD,QAAQ;QADpB,IAAA,sBAAU,GAAE;OACA,QAAQ,CAsHpB;IAAD,eAAC;CAAA,AAtHD,IAsHC;AAtHY,4BAAQ"}
|
|
@@ -12,8 +12,10 @@ exports.githubModule = void 0;
|
|
|
12
12
|
***********************************************************************/
|
|
13
13
|
var inversify_1 = require("inversify");
|
|
14
14
|
var github_resolver_1 = require("./github-resolver");
|
|
15
|
+
var types_1 = require("../types");
|
|
16
|
+
var Resolver = types_1.TYPES.Resolver;
|
|
15
17
|
var githubModule = new inversify_1.ContainerModule(function (bind) {
|
|
16
|
-
bind(github_resolver_1.GithubResolver).
|
|
18
|
+
bind(Resolver).to(github_resolver_1.GithubResolver).inSingletonScope();
|
|
17
19
|
});
|
|
18
20
|
exports.githubModule = githubModule;
|
|
19
21
|
//# sourceMappingURL=github-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-module.js","sourceRoot":"","sources":["../../src/github/github-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,uCAAwD;AAExD,qDAAmD;
|
|
1
|
+
{"version":3,"file":"github-module.js","sourceRoot":"","sources":["../../src/github/github-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,uCAAwD;AAExD,qDAAmD;AACnD,kCAAiC;AAEzB,IAAA,QAAQ,GAAK,aAAK,SAAV,CAAW;AAE3B,IAAM,YAAY,GAAG,IAAI,2BAAe,CAAC,UAAC,IAAqB;IAC7D,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,gCAAc,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACvD,CAAC,CAAC,CAAC;AAEM,oCAAY"}
|
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
***********************************************************************/
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
export declare class GithubResolver {
|
|
10
|
+
import { Url } from '../resolve/url';
|
|
11
|
+
import { Resolver } from '../resolve/resolver';
|
|
12
|
+
export declare class GithubResolver implements Resolver {
|
|
15
13
|
static readonly GITHUB_URL_PATTERN: RegExp;
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
isValid(url: string): boolean;
|
|
15
|
+
resolve(link: string): Url;
|
|
16
|
+
private getGroup;
|
|
18
17
|
}
|
|
@@ -18,13 +18,13 @@ exports.__esModule = true;
|
|
|
18
18
|
exports.GithubResolver = void 0;
|
|
19
19
|
var github_url_1 = require("./github-url");
|
|
20
20
|
var inversify_1 = require("inversify");
|
|
21
|
-
/**
|
|
22
|
-
* Provides a github URL object allowing to interact
|
|
23
|
-
*/
|
|
24
21
|
var GithubResolver = /** @class */ (function () {
|
|
25
22
|
function GithubResolver() {
|
|
26
23
|
}
|
|
27
24
|
GithubResolver_1 = GithubResolver;
|
|
25
|
+
GithubResolver.prototype.isValid = function (url) {
|
|
26
|
+
return GithubResolver_1.GITHUB_URL_PATTERN.test(url);
|
|
27
|
+
};
|
|
28
28
|
GithubResolver.prototype.resolve = function (link) {
|
|
29
29
|
var match = GithubResolver_1.GITHUB_URL_PATTERN.exec(link);
|
|
30
30
|
if (!match) {
|
|
@@ -34,6 +34,9 @@ var GithubResolver = /** @class */ (function () {
|
|
|
34
34
|
var hostName = this.getGroup(match, 'host');
|
|
35
35
|
var repoUser = this.getGroup(match, 'repoUser');
|
|
36
36
|
var repoName = this.getGroup(match, 'repoName');
|
|
37
|
+
if (/^[\w-][\w.-]*?\.git$/.test(repoName)) {
|
|
38
|
+
repoName = repoName.substring(0, repoName.length - 4);
|
|
39
|
+
}
|
|
37
40
|
var branchName = this.getGroup(match, 'branchName', 'HEAD');
|
|
38
41
|
var subFolder = this.getGroup(match, 'subFolder');
|
|
39
42
|
return new github_url_1.GithubUrl(scheme, hostName, repoUser, repoName, branchName, subFolder);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-resolver.js","sourceRoot":"","sources":["../../src/github/github-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;AAEzE,2CAAyC;AACzC,uCAAuC;
|
|
1
|
+
{"version":3,"file":"github-resolver.js","sourceRoot":"","sources":["../../src/github/github-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;AAEzE,2CAAyC;AACzC,u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K,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC3C,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAChC;QACD,OAAO,YAAY,IAAI,EAAE,CAAC;IAC5B,CAAC;;IA9BD,mCAAmC;IACnB,iCAAkB,GAChC,qKAAsK,CAAA;IAH7J,cAAc;QAD1B,IAAA,sBAAU,GAAE;OACA,cAAc,CAgC1B;IAAD,qBAAC;CAAA,AAhCD,IAgCC;AAhCY,wCAAc"}
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
***********************************************************************/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
export declare class GithubUrl {
|
|
10
|
+
import { Url } from '../resolve/url';
|
|
11
|
+
export declare class GithubUrl implements Url {
|
|
14
12
|
private readonly scheme;
|
|
15
13
|
private readonly hostName;
|
|
16
14
|
private readonly repoUser;
|
package/lib/github/github-url.js
CHANGED
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
***********************************************************************/
|
|
11
11
|
exports.__esModule = true;
|
|
12
12
|
exports.GithubUrl = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* Provides helper methods on top of github URL to get for example raw content of get relative links
|
|
15
|
-
*/
|
|
16
13
|
var GithubUrl = /** @class */ (function () {
|
|
17
14
|
function GithubUrl(scheme, hostName, repoUser, repoName, branchName, subFolder) {
|
|
18
15
|
this.scheme = scheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-url.js","sourceRoot":"","sources":["../../src/github/github-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;
|
|
1
|
+
{"version":3,"file":"github-url.js","sourceRoot":"","sources":["../../src/github/github-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAIzE;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"}
|
|
@@ -51,7 +51,10 @@ var inversify_1 = require("inversify");
|
|
|
51
51
|
var devfile_module_1 = require("../devfile/devfile-module");
|
|
52
52
|
var fetch_module_1 = require("../fetch/fetch-module");
|
|
53
53
|
var github_module_1 = require("../github/github-module");
|
|
54
|
+
var resolve_module_1 = require("../resolve/resolve-module");
|
|
54
55
|
var plugin_registry_module_1 = require("../plugin-registry/plugin-registry-module");
|
|
56
|
+
var bitbucket_module_1 = require("../bitbucket/bitbucket-module");
|
|
57
|
+
var bitbucket_server_module_1 = require("../bitbucket-server/bitbucket-server-module");
|
|
55
58
|
/**
|
|
56
59
|
* Manage all bindings for inversify
|
|
57
60
|
*/
|
|
@@ -65,6 +68,9 @@ var InversifyBinding = /** @class */ (function () {
|
|
|
65
68
|
this.container.load(devfile_module_1.devfileModule);
|
|
66
69
|
this.container.load(fetch_module_1.fetchModule);
|
|
67
70
|
this.container.load(github_module_1.githubModule);
|
|
71
|
+
this.container.load(bitbucket_module_1.bitbucketModule);
|
|
72
|
+
this.container.load(bitbucket_server_module_1.bitbucketServerModule);
|
|
73
|
+
this.container.load(resolve_module_1.resolveModule);
|
|
68
74
|
this.container.load(plugin_registry_module_1.pluginRegistryModule);
|
|
69
75
|
this.container.bind(Symbol["for"]('AxiosInstance')).toConstantValue(options.axiosInstance);
|
|
70
76
|
this.container.bind('string').toConstantValue(options.pluginRegistryUrl).whenTargetNamed('PLUGIN_REGISTRY_URL');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inversify-binding.js","sourceRoot":"","sources":["../../src/inversify/inversify-binding.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;yEAQyE;AACzE,4BAA0B;AAG1B,uCAAsC;AACtC,4DAA0D;AAC1D,sDAAoD;AACpD,yDAAuD;AACvD,oFAAiF;
|
|
1
|
+
{"version":3,"file":"inversify-binding.js","sourceRoot":"","sources":["../../src/inversify/inversify-binding.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;yEAQyE;AACzE,4BAA0B;AAG1B,uCAAsC;AACtC,4DAA0D;AAC1D,sDAAoD;AACpD,yDA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