fix(compiler-cli): prevent ng-xi18n from emitting the compilation output (#14115)
fixes #13567 PR Close #14115
This commit is contained in:
parent
7036e04ec6
commit
e58d683931
|
@ -65,6 +65,7 @@ const EXPECTED_XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
|
|||
|
||||
describe('template i18n extraction output', () => {
|
||||
const outDir = '';
|
||||
const genDir = 'out';
|
||||
|
||||
it('should extract i18n messages as xmb', () => {
|
||||
const xmbOutput = path.join(outDir, 'messages.xmb');
|
||||
|
@ -79,4 +80,9 @@ describe('template i18n extraction output', () => {
|
|||
const xlf = fs.readFileSync(xlfOutput, {encoding: 'utf-8'});
|
||||
expect(xlf).toEqual(EXPECTED_XLIFF);
|
||||
});
|
||||
|
||||
it('should not emit js', () => {
|
||||
const genOutput = path.join(genDir, '');
|
||||
expect(fs.existsSync(genOutput)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"angularCompilerOptions": {
|
||||
// For TypeScript 1.8, we have to lay out generated files
|
||||
// in the same source directory with your code.
|
||||
"genDir": ".",
|
||||
"debug": true
|
||||
},
|
||||
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./out",
|
||||
"rootDir": "",
|
||||
"declaration": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"baseUrl": ".",
|
||||
// Prevent scanning up the directory tree for types
|
||||
"typeRoots": ["node_modules/@types"]
|
||||
},
|
||||
|
||||
"files": [
|
||||
"src/module",
|
||||
"src/bootstrap",
|
||||
"test/all_spec",
|
||||
"test/test_ngtools_api",
|
||||
"test/test_summaries",
|
||||
"benchmarks/src/tree/ng2/index_aot.ts",
|
||||
"benchmarks/src/tree/ng2_switch/index_aot.ts",
|
||||
"benchmarks/src/largetable/ng2/index_aot.ts",
|
||||
"benchmarks/src/largetable/ng2_switch/index_aot.ts"
|
||||
]
|
||||
}
|
|
@ -30,7 +30,7 @@ if (require.main === module) {
|
|||
const args = require('minimist')(process.argv.slice(2));
|
||||
const project = args.p || args.project || '.';
|
||||
const cliOptions = new tsc.I18nExtractionCliOptions(args);
|
||||
tsc.main(project, cliOptions, extract)
|
||||
tsc.main(project, cliOptions, extract, {noEmit: true})
|
||||
.then((exitCode: any) => process.exit(exitCode))
|
||||
.catch((e: any) => {
|
||||
console.error(e.stack);
|
||||
|
|
|
@ -48,8 +48,8 @@ cp -v package.json $TMP
|
|||
|
||||
./node_modules/.bin/ngc -p tsconfig-build.json --i18nFile=src/messages.fi.xlf --locale=fi --i18nFormat=xlf
|
||||
|
||||
./node_modules/.bin/ng-xi18n -p tsconfig-build.json --i18nFormat=xlf
|
||||
./node_modules/.bin/ng-xi18n -p tsconfig-build.json --i18nFormat=xmb
|
||||
./node_modules/.bin/ng-xi18n -p tsconfig-xi18n.json --i18nFormat=xlf
|
||||
./node_modules/.bin/ng-xi18n -p tsconfig-xi18n.json --i18nFormat=xmb
|
||||
|
||||
node test/test_summaries.js
|
||||
node test/test_ngtools_api.js
|
||||
|
@ -80,4 +80,4 @@ cp -v package.json $TMP_2_1
|
|||
./node_modules/.bin/tsc --version
|
||||
node ./node_modules/@angular/tsc-wrapped/src/main -p third_party_src/tsconfig-build.json
|
||||
./node_modules/.bin/ngc -p tsconfig-build.json --i18nFile=src/messages.fi.xlf --locale=fi --i18nFormat=xlf
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue