Skip to content

Commit 70f1372

Browse files
committed
Fix e2e tests after rebase master
1 parent 3d24127 commit 70f1372

File tree

10 files changed

+23
-22
lines changed

10 files changed

+23
-22
lines changed

packages/@ngtools/webpack/src/extract_i18n_plugin.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ExtractI18nPlugin implements Tapable {
2828
private _rootFilePath: string[];
2929
private _compilerOptions: any = null;
3030
private _angularCompilerOptions: any = null;
31-
//private _compilerHost: WebpackCompilerHost;
31+
// private _compilerHost: WebpackCompilerHost;
3232
private _compilerHost: ts.CompilerHost;
3333
private _program: ts.Program;
3434

@@ -94,12 +94,10 @@ export class ExtractI18nPlugin implements Tapable {
9494
// By default messages will be generated in basePath
9595
let genDir = basePath;
9696

97-
if(options.hasOwnProperty('genDir')) {
97+
if (options.hasOwnProperty('genDir')) {
9898
genDir = path.resolve(process.cwd(), options.genDir);
9999
}
100100

101-
console.log(genDir);
102-
103101
this._compilerOptions = tsConfig.options;
104102
this._angularCompilerOptions = Object.assign(
105103
{ genDir },
@@ -111,7 +109,7 @@ export class ExtractI18nPlugin implements Tapable {
111109
this._basePath = basePath;
112110
this._genDir = genDir;
113111

114-
//this._compilerHost = new WebpackCompilerHost(this._compilerOptions, this._basePath);
112+
// this._compilerHost = new WebpackCompilerHost(this._compilerOptions, this._basePath);
115113
this._compilerHost = ts.createCompilerHost(this._compilerOptions, true);
116114
this._program = ts.createProgram(
117115
this._rootFilePath, this._compilerOptions, this._compilerHost);
@@ -136,8 +134,9 @@ export class ExtractI18nPlugin implements Tapable {
136134

137135
private _make(compilation: any, cb: (err?: any, request?: any) => void) {
138136
this._compilation = compilation;
139-
if(this._compilation._ngToolsWebpackXi18nPluginInstance) {
140-
return cb(new Error('An @ngtools/webpack xi18n plugin already exist for this compilation.'));
137+
if (this._compilation._ngToolsWebpackXi18nPluginInstance) {
138+
return cb(new Error('An @ngtools/webpack xi18n plugin already exist for ' +
139+
'this compilation.'));
141140
}
142141

143142
this._compilation._ngToolsWebpackXi18nPluginInstance = this;
+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'reflect-metadata';
22

33
export * from './plugin';
4+
export * from './extract_i18n_plugin';
45
export {ngcLoader as default} from './loader';
56
export {PathsPlugin} from './paths-plugin';

packages/angular-cli/commands/xi18n.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Xi18nCommand = Command.extend({
1919
default: 'xlf',
2020
aliases: ['f', {'xmb': 'xmb'}, {'xlf': 'xlf'}, {'xliff': 'xlf'}]
2121
},
22-
{ name: 'output-path', type: 'Path', default: null, aliases: ['o']},
22+
{ name: 'output-path', type: 'Path', default: null, aliases: ['op']},
2323
{ name: 'verbose', type: Boolean, default: false},
2424
{ name: 'progress', type: Boolean, default: true }
2525

packages/angular-cli/models/webpack-configs/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export * from './production';
44
export * from './styles';
55
export * from './typescript';
66
export * from './utils';
7+
export * from './xi18n';

packages/angular-cli/models/webpack-extract-i18n.ts renamed to packages/angular-cli/models/webpack-configs/xi18n.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as path from 'path';
2-
import {ExtractI18nPlugin} from '../../@ngtools/webpack/src/extract_i18n_plugin';
2+
import {ExtractI18nPlugin} from '@ngtools/webpack';
33

44
export const getWebpackExtractI18nConfig = function(
55
projectRoot: string,
66
appConfig: any,
77
genDir: string,
8-
i18nFormat: string):any {
8+
i18nFormat: string): any {
99

1010
let exclude: string[] = [];
1111
if (appConfig.test) {
@@ -21,5 +21,5 @@ export const getWebpackExtractI18nConfig = function(
2121
i18nFormat: i18nFormat
2222
})
2323
]
24-
}
24+
};
2525
};

packages/angular-cli/models/webpack-xi18n-config.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import * as path from 'path';
33
import {CliConfig} from './config';
44
import {NgCliWebpackConfig} from './webpack-config';
55
const webpackMerge = require('webpack-merge');
6-
import {getWebpackExtractI18nConfig} from './webpack-extract-i18n';
6+
import {getWebpackExtractI18nConfig} from './webpack-configs';
77

88
export interface XI18WebpackOptions {
9-
genDir?: string,
10-
buildDir?: string,
11-
i18nFormat?: string,
12-
verbose?: boolean,
13-
progress?: boolean
9+
genDir?: string;
10+
buildDir?: string;
11+
i18nFormat?: string;
12+
verbose?: boolean;
13+
progress?: boolean;
1414
}
1515
export class XI18nWebpackConfig extends NgCliWebpackConfig {
1616

packages/angular-cli/tasks/extract-i18n.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const Extracti18nTask = Task.extend({
2727
}).config;
2828

2929
const webpackCompiler = webpack(config);
30-
//const statsConfig = getWebpackStatsConfig(runTaskOptions.verbose);
3130

3231
return new Promise((resolve, reject) => {
3332
const callback: webpack.compiler.CompilerCallback = (err, stats) => {
@@ -50,7 +49,8 @@ export const Extracti18nTask = Task.extend({
5049
})
5150
.catch((err: Error) => {
5251
if (err) {
53-
this.ui.writeError('\nAn error occured during the i18n extraction:\n' + ((err && err.stack) || err));
52+
this.ui.writeError('\nAn error occured during the i18n extraction:\n'
53+
+ ((err && err.stack) || err));
5454
}
5555
throw err;
5656
});

tests/e2e/tests/i18n/extract-default.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function() {
1313
.then(() => writeFile(
1414
join(testComponentDir, 'i18n-test.component.html'),
1515
'<p i18n>Hello world</p>'))
16-
.then(() => ng('xi18n'))
16+
.then(() => ng('xi18n', '--no-progress'))
1717
.then(() => expectFileToExist(join('src', 'messages.xlf')))
1818
.then(() => expectFileToMatch(join('src', 'messages.xlf'), /Hello world/));
1919
}

tests/e2e/tests/i18n/extract-output.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function() {
1313
.then(() => writeFile(
1414
join(testComponentDir, 'i18n-test.component.html'),
1515
'<p i18n>Hello world</p>'))
16-
.then(() => ng('xi18n -o src/locale'))
16+
.then(() => ng('xi18n', '--no-progress', '--output-path', 'src/locale'))
1717
.then(() => expectFileToExist(join('src', 'locale', 'messages.xlf')))
1818
.then(() => expectFileToMatch(join('src', 'locale', 'messages.xlf'), /Hello world/));
1919
}

tests/e2e/tests/i18n/extract-xmb.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function() {
1313
.then(() => writeFile(
1414
join(testComponentDir, 'i18n-test.component.html'),
1515
'<p i18n>Hello world</p>'))
16-
.then(() => ng('xi18n', '--i18n-format=xmb'))
16+
.then(() => ng('xi18n', '--no-progress', '--i18n-format', 'xmb'))
1717
.then(() => expectFileToExist(join('src', 'messages.xmb')))
1818
.then(() => expectFileToMatch(join('src', 'messages.xmb'), /Hello world/));
1919
}

0 commit comments

Comments
 (0)