Parcourir la source

Merge pull request #394 from ckeditor/t/387

Feature: Added gulp tasks to manage translations. Closes #387.
Piotrek Koszuliński il y a 9 ans
Parent
commit
72af30cdb5
3 fichiers modifiés avec 20 ajouts et 6 suppressions
  1. 14 0
      gulpfile.js
  2. 3 3
      package.json
  3. 3 3
      scripts/fix-src-imports.js

+ 14 - 0
gulpfile.js

@@ -47,6 +47,20 @@ function getTestOptions() {
 		.parseArguments( process.argv.slice( 2 ) );
 }
 
+// Translations. --------------------------------------------------------------
+
+gulp.task( 'translations:collect', () => {
+	return require( '@ckeditor/ckeditor5-dev-env' ).collectTranslations();
+} );
+
+gulp.task( 'translations:upload', () => {
+	return require( '@ckeditor/ckeditor5-dev-env' ).uploadTranslations();
+} );
+
+gulp.task( 'translations:download', () => {
+	return require( '@ckeditor/ckeditor5-dev-env' ).downloadTranslations();
+} );
+
 // Releasing. -----------------------------------------------------------------
 
 gulp.task( 'changelog:dependencies', () => {

+ 3 - 3
package.json

@@ -28,10 +28,10 @@
     "@ckeditor/ckeditor5-utils": "^0.7.0"
   },
   "devDependencies": {
-    "@ckeditor/ckeditor5-dev-docs": "^6.1.2",
-    "@ckeditor/ckeditor5-dev-env": "^4.0.0",
+    "@ckeditor/ckeditor5-dev-docs": "^6.1.3",
+    "@ckeditor/ckeditor5-dev-env": "^4.1.0",
     "@ckeditor/ckeditor5-dev-lint": "^2.0.2",
-    "@ckeditor/ckeditor5-dev-tests": "^7.0.2",
+    "@ckeditor/ckeditor5-dev-tests": "^7.0.3",
     "gulp": "^3.9.0",
     "guppy-pre-commit": "^0.4.0",
     "lerna": "2.0.0-beta.37",

+ 3 - 3
scripts/fix-src-imports.js

@@ -12,7 +12,7 @@ const path = require( 'path' );
 const glob = require( 'glob' );
 
 const srcDir = path.join( process.cwd(), 'src' );
-const srcPath = path.join( srcDir , '**', '*.js' );
+const srcPath = path.join( srcDir, '**', '*.js' );
 
 for ( const filePath of glob.sync( srcPath ) ) {
 	const fileDepth = countOcurrences( filePath.replace( srcDir + '/', '' ), path.sep );
@@ -21,12 +21,12 @@ for ( const filePath of glob.sync( srcPath ) ) {
 	const fileContent = fs.readFileSync( filePath, 'utf-8' )
 		.replace( /\nimport[^']+?'((\.\.\/)+[\w-]+)\/[^']+?'/gm, fix );
 
-	fs.writeFileSync( filePath, fileContent , 'utf-8' );
+	fs.writeFileSync( filePath, fileContent, 'utf-8' );
 }
 
 function fixImport( wholeImport, pathStart, fileDepth ) {
 	const indexOfPathStart = wholeImport.indexOf( '../' );
-	const packageShortName = pathStart.split( '/' ).slice( -1 )[0];
+	const packageShortName = pathStart.split( '/' ).slice( -1 )[ 0 ];
 	const importDepth = countOcurrences( pathStart, '../' );
 
 	if ( importDepth <= fileDepth ) {