Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eclipse-che/che-devworkspace-generator

Package Overview
Dependencies
Maintainers
4
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eclipse-che/che-devworkspace-generator - npm Package Compare versions

Comparing version 0.0.1-ea73e8b to 7.69.0-8717dbc

lib/bitbucket-server/bitbucket-server-module.d.ts

4

lib/github/github-module.js

@@ -15,6 +15,8 @@ "use strict";

var github_resolver_1 = require("./github-resolver");
var types_1 = require("../types");
var Resolver = types_1.TYPES.Resolver;
var githubModule = new inversify_1.ContainerModule(function (bind) {
bind(github_resolver_1.GithubResolver).toSelf().inSingletonScope();
bind(Resolver).to(github_resolver_1.GithubResolver).inSingletonScope();
});
exports.githubModule = githubModule;
//# sourceMappingURL=github-module.js.map

@@ -10,10 +10,9 @@ /**********************************************************************

***********************************************************************/
import { GithubUrl } from './github-url';
/**
* Provides a github URL object allowing to interact
*/
export declare class GithubResolver {
import { Url } from '../resolve/url';
import { Resolver } from '../resolve/resolver';
export declare class GithubResolver implements Resolver {
static readonly GITHUB_URL_PATTERN: RegExp;
resolve(link: string): GithubUrl;
getGroup(match: RegExpExecArray, groupName: string, defaultValue?: string): string;
isValid(url: string): boolean;
resolve(link: string): Url;
private getGroup;
}

@@ -21,5 +21,2 @@ "use strict";

var inversify_1 = require("inversify");
/**
* Provides a github URL object allowing to interact
*/
var GithubResolver = /** @class */ (function () {

@@ -29,2 +26,5 @@ function GithubResolver() {

GithubResolver_1 = GithubResolver;
GithubResolver.prototype.isValid = function (url) {
return GithubResolver_1.GITHUB_URL_PATTERN.test(url);
};
GithubResolver.prototype.resolve = function (link) {

@@ -39,2 +39,5 @@ var match = GithubResolver_1.GITHUB_URL_PATTERN.exec(link);

var repoName = this.getGroup(match, 'repoName');
if (/^[\w-][\w.-]*?\.git$/.test(repoName)) {
repoName = repoName.substring(0, repoName.length - 4);
}
var branchName = this.getGroup(match, 'branchName', 'HEAD');

@@ -41,0 +44,0 @@ var subFolder = this.getGroup(match, 'subFolder');

@@ -10,6 +10,4 @@ /**********************************************************************

***********************************************************************/
/**
* Provides helper methods on top of github URL to get for example raw content of get relative links
*/
export declare class GithubUrl {
import { Url } from '../resolve/url';
export declare class GithubUrl implements Url {
private readonly scheme;

@@ -16,0 +14,0 @@ private readonly hostName;

@@ -13,5 +13,2 @@ "use strict";

exports.GithubUrl = void 0;
/**
* Provides helper methods on top of github URL to get for example raw content of get relative links
*/
var GithubUrl = /** @class */ (function () {

@@ -18,0 +15,0 @@ function GithubUrl(scheme, hostName, repoUser, repoName, branchName, subFolder) {

@@ -54,3 +54,6 @@ "use strict";

var github_module_1 = require("../github/github-module");
var resolve_module_1 = require("../resolve/resolve-module");
var plugin_registry_module_1 = require("../plugin-registry/plugin-registry-module");
var bitbucket_module_1 = require("../bitbucket/bitbucket-module");
var bitbucket_server_module_1 = require("../bitbucket-server/bitbucket-server-module");
/**

@@ -69,2 +72,5 @@ * Manage all bindings for inversify

this.container.load(github_module_1.githubModule);
this.container.load(bitbucket_module_1.bitbucketModule);
this.container.load(bitbucket_server_module_1.bitbucketServerModule);
this.container.load(resolve_module_1.resolveModule);
this.container.load(plugin_registry_module_1.pluginRegistryModule);

@@ -71,0 +77,0 @@ this.container.bind(Symbol["for"]('AxiosInstance')).toConstantValue(options.axiosInstance);

@@ -71,3 +71,2 @@ "use strict";

var generate_1 = require("./generate");
var github_resolver_1 = require("./github/github-resolver");
var jsYaml = __importStar(require("js-yaml"));

@@ -77,2 +76,3 @@ var inversify_binding_1 = require("./inversify/inversify-binding");

var plugin_registry_resolver_1 = require("./plugin-registry/plugin-registry-resolver");
var git_url_resolver_1 = require("./resolve/git-url-resolver");
var Main = /** @class */ (function () {

@@ -88,3 +88,3 @@ /**

return __awaiter(this, void 0, void 0, function () {
var pluginRegistryUrl, inversifyBinbding, container, devfileContent, editorContent, githubResolver, githubUrl, devfileParsed, editorDevfile, generate;
var pluginRegistryUrl, inversifyBinbding, container, devfileContent, editorContent, resolver, url, devfileParsed, editorDevfile, generate;
return __generator(this, function (_a) {

@@ -115,5 +115,5 @@ switch (_a.label) {

if (!params.devfileUrl) return [3 /*break*/, 3];
githubResolver = container.get(github_resolver_1.GithubResolver);
githubUrl = githubResolver.resolve(params.devfileUrl);
return [4 /*yield*/, container.get(url_fetcher_1.UrlFetcher).fetchText(githubUrl.getContentUrl('devfile.yaml'))];
resolver = container.get(git_url_resolver_1.GitUrlResolver);
url = resolver.resolve(params.devfileUrl);
return [4 /*yield*/, container.get(url_fetcher_1.UrlFetcher).fetchText(url.getContentUrl('devfile.yaml'))];
case 2:

@@ -128,6 +128,6 @@ // user devfile

{
name: githubUrl.getRepoName(),
name: url.getRepoName(),
git: {
remotes: { origin: githubUrl.getCloneUrl() },
checkoutFrom: { revision: githubUrl.getBranchName() }
remotes: { origin: url.getCloneUrl() },
checkoutFrom: { revision: url.getBranchName() }
}

@@ -134,0 +134,0 @@ },

{
"name": "@eclipse-che/che-devworkspace-generator",
"version": "0.0.1-ea73e8b",
"version": "7.69.0-8717dbc",
"private": false,

@@ -5,0 +5,0 @@ "description": "Generates DevWorkspaces by transforming existing devfiles",

@@ -13,7 +13,10 @@ /**********************************************************************

import { GithubResolver } from './github-resolver';
import { TYPES } from '../types';
const { Resolver } = TYPES;
const githubModule = new ContainerModule((bind: interfaces.Bind) => {
bind(GithubResolver).toSelf().inSingletonScope();
bind(Resolver).to(GithubResolver).inSingletonScope();
});
export { githubModule };

@@ -13,8 +13,7 @@ /**********************************************************************

import { injectable } from 'inversify';
import { Url } from '../resolve/url';
import { Resolver } from '../resolve/resolver';
/**
* Provides a github URL object allowing to interact
*/
@injectable()
export class GithubResolver {
export class GithubResolver implements Resolver {
// eslint-disable-next-line max-len

@@ -24,3 +23,7 @@ static readonly GITHUB_URL_PATTERN =

resolve(link: string): GithubUrl {
isValid(url: string): boolean {
return GithubResolver.GITHUB_URL_PATTERN.test(url);
}
resolve(link: string): Url {
const match = GithubResolver.GITHUB_URL_PATTERN.exec(link);

@@ -33,3 +36,6 @@ if (!match) {

const repoUser = this.getGroup(match, 'repoUser');
const repoName = this.getGroup(match, 'repoName');
let repoName = this.getGroup(match, 'repoName');
if (/^[\w-][\w.-]*?\.git$/.test(repoName)) {
repoName = repoName.substring(0, repoName.length - 4);
}
const branchName = this.getGroup(match, 'branchName', 'HEAD');

@@ -40,3 +46,3 @@ const subFolder = this.getGroup(match, 'subFolder');

getGroup(match: RegExpExecArray, groupName: string, defaultValue?: string) {
private getGroup(match: RegExpExecArray, groupName: string, defaultValue?: string) {
if (match.groups && match.groups[groupName]) {

@@ -43,0 +49,0 @@ return match.groups[groupName];

@@ -11,6 +11,5 @@ /**********************************************************************

/**
* Provides helper methods on top of github URL to get for example raw content of get relative links
*/
export class GithubUrl {
import { Url } from '../resolve/url';
export class GithubUrl implements Url {
constructor(

@@ -17,0 +16,0 @@ private readonly scheme: string,

@@ -17,3 +17,6 @@ /**********************************************************************

import { githubModule } from '../github/github-module';
import { resolveModule } from '../resolve/resolve-module';
import { pluginRegistryModule } from '../plugin-registry/plugin-registry-module';
import { bitbucketModule } from '../bitbucket/bitbucket-module';
import { bitbucketServerModule } from '../bitbucket-server/bitbucket-server-module';

@@ -32,2 +35,5 @@ /**

this.container.load(githubModule);
this.container.load(bitbucketModule);
this.container.load(bitbucketServerModule);
this.container.load(resolveModule);
this.container.load(pluginRegistryModule);

@@ -34,0 +40,0 @@

@@ -14,3 +14,2 @@ /**********************************************************************

import { Generate } from './generate';
import { GithubResolver } from './github/github-resolver';
import * as jsYaml from 'js-yaml';

@@ -22,2 +21,3 @@ import { InversifyBinding } from './inversify/inversify-binding';

import { DevfileContext } from './api/devfile-context';
import { GitUrlResolver } from './resolve/git-url-resolver';

@@ -74,8 +74,8 @@ export class Main {

// gets the github URL
// gets the repo URL
if (params.devfileUrl) {
const githubResolver = container.get(GithubResolver);
const githubUrl = githubResolver.resolve(params.devfileUrl);
const resolver = container.get(GitUrlResolver);
const url = resolver.resolve(params.devfileUrl);
// user devfile
devfileContent = await container.get(UrlFetcher).fetchText(githubUrl.getContentUrl('devfile.yaml'));
devfileContent = await container.get(UrlFetcher).fetchText(url.getContentUrl('devfile.yaml'));

@@ -90,6 +90,6 @@ // load content

{
name: githubUrl.getRepoName(),
name: url.getRepoName(),
git: {
remotes: { origin: githubUrl.getCloneUrl() },
checkoutFrom: { revision: githubUrl.getBranchName() },
remotes: { origin: url.getCloneUrl() },
checkoutFrom: { revision: url.getBranchName() },
},

@@ -96,0 +96,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc