Răsfoiți Sursa

Remove unused scripts.

Piotrek Koszuliński 8 ani în urmă
părinte
comite
af2f91e968

+ 0 - 46
scripts/fix-src-imports.js

@@ -1,46 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-const fs = require( 'fs' );
-const path = require( 'path' );
-const glob = require( 'glob' );
-
-const srcDir = path.join( process.cwd(), 'src' );
-const srcPath = path.join( srcDir, '**', '*.js' );
-
-for ( const filePath of glob.sync( srcPath ) ) {
-	const fileDepth = countOcurrences( filePath.replace( srcDir + '/', '' ), path.sep );
-	const fix = ( wholeImport, pathStart ) => fixImport( wholeImport, pathStart, fileDepth );
-
-	const fileContent = fs.readFileSync( filePath, 'utf-8' )
-		.replace( /\nimport[^']+?'((\.\.\/)+[\w-]+)\/[^']+?'/gm, fix );
-
-	fs.writeFileSync( filePath, fileContent, 'utf-8' );
-}
-
-function fixImport( wholeImport, pathStart, fileDepth ) {
-	const indexOfPathStart = wholeImport.indexOf( '../' );
-	const packageShortName = pathStart.split( '/' ).slice( -1 )[ 0 ];
-	const importDepth = countOcurrences( pathStart, '../' );
-
-	if ( importDepth <= fileDepth ) {
-		return wholeImport;
-	}
-
-	return (
-		wholeImport.slice( 0, indexOfPathStart ) +
-		'ckeditor5-' + packageShortName +
-		'/src' +
-		wholeImport.slice( indexOfPathStart + pathStart.length )
-	);
-}
-
-function countOcurrences( str, pattern ) {
-	return str.split( pattern ).length - 1;
-}

+ 0 - 59
scripts/fix-test-imports.js

@@ -1,59 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-const fs = require( 'fs' );
-const path = require( 'path' );
-const glob = require( 'glob' );
-
-const testDir = path.join( process.cwd(), 'tests' );
-const testPath = path.join( testDir , '**', '*.js' );
-
-for ( const filePath of glob.sync( testPath ) ) {
-	const fileContent = fs.readFileSync( filePath, 'utf-8' )
-		.replace( /\nimport[^']+?'([^']+?)'/gm, fixImport );
-
-	fs.writeFileSync( filePath, fileContent , 'utf-8' );
-}
-
-function fixImport( wholeImport , path ) {
-	let fixedImport = fixCkeditorPaths( wholeImport, path );
-	fixedImport = fixTestPaths( fixedImport, path );
-
-	return fixedImport;
-}
-
-function fixCkeditorPaths( wholeImport, path ) {
-	if ( path.indexOf( 'ckeditor5/' ) !== 0 ) {
-		return wholeImport;
-	}
-
-	const index = wholeImport.indexOf( path );
-	const pathChunks = path.split( '/' );
-
-	return (
-		wholeImport.slice( 0, index ) +
-		'ckeditor5-' + pathChunks[ 1 ] + '/src/' + pathChunks.slice( 2 ).join( '/' ) +
-		wholeImport.slice( path.length + index )
-	);
-}
-
-function fixTestPaths( wholeImport, path ) {
-	if ( path.indexOf( 'tests/' ) !== 0 ) {
-		return wholeImport;
-	}
-
-	const index = wholeImport.indexOf( path );
-	const pathChunks = path.split( '/' );
-
-	return (
-		wholeImport.slice( 0, index ) +
-		'ckeditor5-' + pathChunks[ 1 ] + '/tests/' + pathChunks.slice( 2 ).join( '/' ) +
-		wholeImport.slice( path.length + index )
-	);
-}

+ 0 - 21
scripts/remove-js-extensions-from-imports.js

@@ -1,21 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-const fs = require( 'fs' );
-const path = require( 'path' );
-const glob = require( 'glob' );
-
-const srcPath = path.join( process.cwd(), '@(src|tests)', '**', '*.js' );
-
-for ( const filePath of glob.sync( srcPath ) ) {
-	const fileContent = fs.readFileSync( filePath, 'utf-8' )
-		.replace( /\nimport([^;]+)\.js';/g, '\nimport$1\';' );
-
-	fs.writeFileSync( filePath, fileContent , 'utf-8' );
-}

+ 0 - 33
scripts/switch-to-scoped-imports.js

@@ -1,33 +0,0 @@
-#!/usr/bin/env node
-
-'use strict';
-
-const fs = require( 'fs' );
-const path = require( 'path' );
-const glob = require( 'glob' );
-
-const srcPath = path.join( process.cwd(), '@(src|tests)' );
-
-for ( const filePath of glob.sync( path.join( srcPath, '**', '*.js' ) ) ) {
-	let fileContent = fs.readFileSync( filePath, 'utf-8' );
-
-	fileContent = fileContent.replace( /from '(ckeditor5-[\w\-]+)\//g, 'from \'@ckeditor/$1/' );
-	fileContent = fixInnerImports( filePath, fileContent );
-
-	fs.writeFileSync( filePath, fileContent );
-}
-
-// Inner imports should be relative.
-function fixInnerImports( filePath, fileContent ) {
-	const packageName = filePath.match( /ckeditor5-[\w-]+/ )[ 0 ];
-	const relativePath = filePath.replace( /^.+ckeditor5-[\w-]+\//, '' );
-	const depth = relativePath.split( '/' ).length - 1;
-
-	fileContent = fileContent.replace( new RegExp( ` '@ckeditor/${ packageName }/`, 'g' ), () => {
-		const relativePath = '../'.repeat( depth );
-
-		return ` '${ relativePath }`;
-	} );
-
-	return fileContent;
-}