build: move clang formating out of gulp stream for cldr (#33699)
PR Close #33699
This commit is contained in:
parent
b197e90206
commit
6cb9988d63
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const yargs = require('yargs').argv;
|
const yargs = require('yargs').argv;
|
||||||
|
const shelljs = require('shelljs');
|
||||||
const {I18N_DATA_FOLDER, RELATIVE_I18N_DATA_FOLDER, HEADER} = require('./extract');
|
const {I18N_DATA_FOLDER, RELATIVE_I18N_DATA_FOLDER, HEADER} = require('./extract');
|
||||||
const OUTPUT_NAME = `closure-locale.ts`;
|
const OUTPUT_NAME = `closure-locale.ts`;
|
||||||
|
|
||||||
|
@ -57,11 +58,8 @@ module.exports = (gulp, done) => {
|
||||||
`${RELATIVE_I18N_DATA_FOLDER}/${OUTPUT_NAME}`, generateAllLocalesFile(GOOG_LOCALES, ALIASES));
|
`${RELATIVE_I18N_DATA_FOLDER}/${OUTPUT_NAME}`, generateAllLocalesFile(GOOG_LOCALES, ALIASES));
|
||||||
|
|
||||||
console.log(`Formatting ${I18N_DATA_FOLDER}/${OUTPUT_NAME}..."`);
|
console.log(`Formatting ${I18N_DATA_FOLDER}/${OUTPUT_NAME}..."`);
|
||||||
const format = require('gulp-clang-format');
|
shelljs.exec(`yarn clang-format -i ${I18N_DATA_FOLDER}/${OUTPUT_NAME}`, {silent: true});
|
||||||
const clangFormat = require('clang-format');
|
done();
|
||||||
return gulp.src([`${I18N_DATA_FOLDER}/${OUTPUT_NAME}`], {base: '.'})
|
|
||||||
.pipe(format.format('file', clangFormat))
|
|
||||||
.pipe(gulp.dest('.'));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,6 +13,8 @@ const stringify = require('./util').stringify;
|
||||||
const cldr = require('cldr');
|
const cldr = require('cldr');
|
||||||
// used to extract all other cldr data
|
// used to extract all other cldr data
|
||||||
const cldrJs = require('cldrjs');
|
const cldrJs = require('cldrjs');
|
||||||
|
// used to call to clang-format
|
||||||
|
const shelljs = require('shelljs');
|
||||||
|
|
||||||
const COMMON_PACKAGE = 'packages/common';
|
const COMMON_PACKAGE = 'packages/common';
|
||||||
const CORE_PACKAGE = 'packages/core';
|
const CORE_PACKAGE = 'packages/core';
|
||||||
|
@ -94,19 +96,10 @@ module.exports = (gulp, done) => {
|
||||||
console.log(`${LOCALES.length} locale files generated.`);
|
console.log(`${LOCALES.length} locale files generated.`);
|
||||||
|
|
||||||
console.log(`All i18n cldr files have been generated, formatting files..."`);
|
console.log(`All i18n cldr files have been generated, formatting files..."`);
|
||||||
const format = require('gulp-clang-format');
|
shelljs.exec(
|
||||||
const clangFormat = require('clang-format');
|
`yarn clang-format -i ${I18N_DATA_FOLDER}/**/*.ts ${I18N_DATA_FOLDER}/*.ts ${I18N_FOLDER}/currencies.ts ${I18N_CORE_FOLDER}/locale_en.ts ${I18N_GLOBAL_FOLDER}/*.js`,
|
||||||
return gulp
|
{silent: true});
|
||||||
.src(
|
done();
|
||||||
[
|
|
||||||
`${I18N_DATA_FOLDER}/**/*.ts`,
|
|
||||||
`${I18N_FOLDER}/currencies.ts`,
|
|
||||||
`${I18N_CORE_FOLDER}/locale_en.ts`,
|
|
||||||
`${I18N_GLOBAL_FOLDER}/*.js`,
|
|
||||||
],
|
|
||||||
{base: '.'})
|
|
||||||
.pipe(format.format('file', clangFormat))
|
|
||||||
.pipe(gulp.dest('.'));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue