How to use the @ckeditor/ckeditor5-dev-utils.git.parseRepositoryUrl function in @ckeditor/ckeditor5-dev-utils

To help you get started, we’ve selected a few @ckeditor/ckeditor5-dev-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / tasks / install / index.js View on Github external
}
	}

	// Check if name is repository URL.
	if ( !urlInfo ) {
		urlInfo = git.parseRepositoryUrl( name );
		dependency = name;
	}

	// Check if name is NPM package.
	if ( !urlInfo ) {
		log.info( `Not a GitHub URL. Trying to get GitHub URL from NPM package...` );
		const url = tools.getGitUrlFromNpm( name );

		if ( url ) {
			urlInfo = git.parseRepositoryUrl( url );
			dependency  = url;
		}
	}

	if ( urlInfo ) {
		repositoryPath = path.join( workspaceAbsolutePath, urlInfo.name );

		if ( tools.isDirectory( repositoryPath ) ) {
			log.info( `Directory ${ repositoryPath } already exists.` );
		} else {
			log.info( `Cloning ${ urlInfo.name } into ${ repositoryPath }...` );
			git.cloneRepository( urlInfo, workspaceAbsolutePath );
		}

		// Checkout to specified branch if one is provided.
		if ( urlInfo.branch ) {
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / tasks / update / index.js View on Github external
const log = logger();
	const workspaceAbsolutePath = path.join( ckeditor5Path, workspaceRoot );

	// Fetch main repository
	log.info( `Fetching branches from ${ packageJSON.name }...` );
	git.fetchAll( ckeditor5Path );

	// Get all CKEditor dependencies from package.json.
	const dependencies = workspace.getDependencies( packageJSON.dependencies );

	if ( dependencies ) {
		const directories = workspace.getDirectories( workspaceAbsolutePath );

		for ( let dependency in dependencies ) {
			const repositoryURL = dependencies[ dependency ];
			const urlInfo = git.parseRepositoryUrl( repositoryURL );
			const repositoryAbsolutePath = path.join( workspaceAbsolutePath, dependency );

			// Check if repository's directory already exists.
			if ( directories.indexOf( urlInfo.name ) > -1 ) {
				log.info( `Fetching branches from ${ urlInfo.name }...` );
				git.fetchAll( repositoryAbsolutePath );

				log.info( `Checking out ${ urlInfo.name } to ${ urlInfo.branch }...` );
				git.checkout( repositoryAbsolutePath, urlInfo.branch );

				log.info( `Pulling changes to ${ urlInfo.name }...` );
				git.pull( repositoryAbsolutePath, urlInfo.branch );

				if ( runNpmUpdate ) {
					log.info( `Running "npm update" in ${ urlInfo.name }...` );
					tools.npmUpdate( repositoryAbsolutePath );
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / tasks / install / index.js View on Github external
if ( tools.isDirectory( repositoryPath ) ) {
		const packageName = tools.readPackageName( repositoryPath );

		if ( packageName ) {
			log.info( `Package located at ${ repositoryPath }.` );
			urlInfo = {
				name: packageName
			};

			dependency = repositoryPath;
		}
	}

	// Check if name is repository URL.
	if ( !urlInfo ) {
		urlInfo = git.parseRepositoryUrl( name );
		dependency = name;
	}

	// Check if name is NPM package.
	if ( !urlInfo ) {
		log.info( `Not a GitHub URL. Trying to get GitHub URL from NPM package...` );
		const url = tools.getGitUrlFromNpm( name );

		if ( url ) {
			urlInfo = git.parseRepositoryUrl( url );
			dependency  = url;
		}
	}

	if ( urlInfo ) {
		repositoryPath = path.join( workspaceAbsolutePath, urlInfo.name );