How to use the @ckeditor/ckeditor5-dev-utils.tools.linkDirectories 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
}

		// Checkout to specified branch if one is provided.
		if ( urlInfo.branch ) {
			log.info( `Checking ${ urlInfo.name } to ${ urlInfo.branch }...` );
			git.checkout( repositoryPath, urlInfo.branch );
		}

		// Run `npm install` in new repository.
		log.info( `Running "npm install" in ${ urlInfo.name }...` );
		tools.npmInstall( repositoryPath );

		const linkPath = path.join( ckeditor5Path, 'node_modules', urlInfo.name );

		log.info( `Linking ${ linkPath } to ${ repositoryPath }...` );
		tools.linkDirectories( repositoryPath, linkPath );

		log.info( `Adding ${ urlInfo.name } dependency to CKEditor5 package.json...` );
		tools.updateJSONFile( path.join( ckeditor5Path, 'package.json' ), ( json ) => {
			json.dependencies = json.dependencies || {};
			json.dependencies[ urlInfo.name ] = dependency;
			json.dependencies = tools.sortObject( json.dependencies );

			return json;
		} );
	} else {
		throw new Error( 'Please provide valid GitHub URL, NPM module name or path.' );
	}
};
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / tasks / update / index.js View on Github external
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 );
				}

				try {
					log.info( `Linking ${ repositoryURL }...` );
					tools.linkDirectories( repositoryAbsolutePath, path.join( ckeditor5Path, 'node_modules', dependency ) );
				} catch ( error ) {
					log.error( error );
				}
			} else {
				// Directory does not exits in workspace - install it.
				installTask( ckeditor5Path, workspaceRoot, repositoryURL );
			}
		}

		if ( runNpmUpdate ) {
			log.info( `Running "npm update" in CKEditor5 repository...` );
			tools.npmUpdate( ckeditor5Path );
		}
	} else {
		log.info( 'No CKEditor5 dependencies found in package.json file.' );
	}
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / tasks / relink / index.js View on Github external
// Get all CKEditor dependencies from package.json.
	const dependencies = workspace.getDependencies( packageJSON.dependencies );

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

		if ( directories.length ) {
			for ( let dependency in dependencies ) {
				const repositoryAbsolutePath = path.join( workspaceAbsolutePath, dependency );
				const repositoryURL = dependencies[ dependency ];

				// Check if repository's directory exists.
				if ( directories.indexOf( dependency ) > -1 ) {
					try {
						log.info( `Linking ${ repositoryURL }...` );
						tools.linkDirectories( repositoryAbsolutePath, path.join( ckeditor5Path, 'node_modules', dependency ) );
					} catch ( error ) {
						log.error( error );
					}
				}
			}
		} else {
			log.info( 'No CKEditor5 plugins in development mode.' );
		}
	} else {
		log.info( 'No CKEditor5 dependencies found in package.json file.' );
	}
};
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-tests / bin / link-package-to-node-modules.js View on Github external
#!/usr/bin/env node

/**
 * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md.
 */

'use strict';

const path = require( 'path' );
const cwd = process.cwd();
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );

const packageName = require( path.join( cwd, 'package.json' ) ).name;

tools.linkDirectories( '../..', `node_modules/${ packageName }` );
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / tasks / create-package / index.js View on Github external
tools.updateJSONFile( path.join( ckeditor5Path, 'package.json' ), ( json ) => {
				if ( !json.dependencies ) {
					json.dependencies = {};
				}
				json.dependencies[ packageName ] = gitHubPath;
				json.dependencies = tools.sortObject( json.dependencies );

				return json;
			} );

			log.info( `Creating initial commit...` );
			git.initialCommit( packageName, repositoryPath );

			log.info( `Linking ${ packageName } to node_modules...` );
			tools.linkDirectories( repositoryPath, path.join( ckeditor5Path, 'node_modules', packageName ) );
		} );
};