Skip to content

Commit

Permalink
fix(compiler-cli): prevent ng-xi18n from emitting the compilation out…
Browse files Browse the repository at this point in the history
…put (#14115)

fixes #13567

PR Close #14115
  • Loading branch information
marclaval authored and mhevery committed Feb 7, 2017
1 parent 7036e04 commit e58d683
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();
});
});
34 changes: 34 additions & 0 deletions modules/@angular/compiler-cli/integrationtest/tsconfig-xi18n.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
2 changes: 1 addition & 1 deletion modules/@angular/compiler-cli/src/extract_i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci-lite/offline_compiler_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
)

0 comments on commit e58d683

Please sign in to comment.