Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC cli update #33510

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/bazel-schematics/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function testNonBazel() {
# disable CLI's version check (if version is 0.0.0, then no version check happens)
yarn --cwd node_modules/@angular/cli version --new-version 0.0.0 --no-git-tag-version
# re-add build-angular
yarn add --dev @angular-devkit/build-angular@0.900.0-next.11
yarn add --dev @angular-devkit/build-angular@0.900.0-rc.0
yarn webdriver-manager update --gecko=false --standalone=false ${CI_CHROMEDRIVER_VERSION_ARG:---versions.chrome 2.45}
ng build --progress=false
ng test --progress=false --watch=false
Expand Down
2 changes: 1 addition & 1 deletion integration/cli-hello-world-ivy-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"zone.js": "file:../../node_modules/zone.js"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.900.0-next.15",
"@angular-devkit/build-angular": "^0.900.0-rc.0",
"@angular/cli": "file:../../node_modules/@angular/cli",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/language-service": "file:../../dist/packages-dist/language-service",
Expand Down
3 changes: 3 additions & 0 deletions integration/cli-hello-world-ivy-i18n/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ testem.log
# System Files
.DS_Store
Thumbs.db

# Don't accidentally commit locale translates
src/locales
26 changes: 2 additions & 24 deletions integration/cli-hello-world-ivy-i18n/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
# CliHelloWorldIvyI18n

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.0-next.9.
This project tests i18n using localize with CLI.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
It includes a date pipe to ensure localeData is pulled into builds correctly.
100 changes: 26 additions & 74 deletions integration/cli-hello-world-ivy-i18n/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
"root": "",
"sourceRoot": "src",
"prefix": "app",
"i18n": {
"sourceLocale": "en-US",
"locales": {
"fr": "src/locale/messages.fr.xlf",
"de": "src/locale/messages.de.xlf"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
Expand All @@ -26,14 +33,11 @@
"src/styles.css"
],
"scripts": [],
"progress": false
"progress": false,
"i18nMissingTranslation": "error"
},
"configurations": {
"view-engine": {
"tsConfig": "tsconfig.view-engine.json"
},
"production": {
"localize": false, // TODO: enable when CLI supports inlining the locale
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
Expand Down Expand Up @@ -62,37 +66,13 @@
}
]
},
"runtime-translations": {
"fileReplacements": [
{
"replace": "src/polyfills.ts",
"with": "src/polyfills-runtime.ts"
}
]
"fr": {
"localize": ["fr"],
"deleteOutputPath": false
},
"translated-legacy": {
"tsConfig": "tsconfig.legacy.json",
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
},
"translated-legacy-xmb": {
"tsConfig": "tsconfig.legacy-xmb.json",
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
"de": {
"localize": ["de"],
"deleteOutputPath": false
}
}
},
Expand All @@ -104,26 +84,14 @@
"configurations": {
"production": {
"browserTarget": "cli-hello-world-ivy-i18n:build:production"
},
"ci": {
"progress": false
},
"ci-production": {
"browserTarget": "cli-hello-world-ivy-i18n:build:production",
"progress": false
},
"runtime-translations": {
"browserTarget": "cli-hello-world-ivy-i18n:build:runtime-translations",
"progress": false
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "cli-hello-world-ivy-i18n:build:view-engine",
"outputPath": "../tmp/legacy-locales/",
"outFile": "messages.legacy.xlf"
"browserTarget": "cli-hello-world-ivy-i18n:build",
"outputPath": "src/locale"
}
},
"test": {
Expand Down Expand Up @@ -161,39 +129,23 @@
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/en/protractor.conf.js",
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "cli-hello-world-ivy-i18n:serve",
"webdriverUpdate": false
"webdriverUpdate": false,
"specs": ["./en/app.e2e-spec.ts"]
},
"configurations": {
"production": {
"devServerTarget": "cli-hello-world-ivy-i18n:serve:production"
},
"ci": {
"devServerTarget": "cli-hello-world-ivy-i18n:serve:ci"
},
"ci-production": {
"devServerTarget": "cli-hello-world-ivy-i18n:serve:ci-production"
},
"runtime-translations": {
"devServerTarget": "cli-hello-world-ivy-i18n:serve:runtime-translations",
"protractorConfig": "e2e/runtime/protractor.conf.js"
},
"translated-legacy": {
"devServerTarget": "",
"protractorConfig": "e2e/legacy/protractor.conf.js"
},
"translated-en": {
"devServerTarget": "",
"protractorConfig": "e2e/en/protractor.conf.js"
"devServerTarget": "cli-hello-world-ivy-i18n:serve:production",
"protractorConfig": "e2e/protractor.conf.js"
},
"translated-fr": {
"fr": {
"devServerTarget": "",
"protractorConfig": "e2e/fr/protractor.conf.js"
"specs": ["./fr/app.e2e-spec.ts"]
},
"translated-de": {
"de": {
"devServerTarget": "",
"protractorConfig": "e2e/de/protractor.conf.js"
"specs": ["./de/app.e2e-spec.ts"]
}
}
}
Expand Down
19 changes: 11 additions & 8 deletions integration/cli-hello-world-ivy-i18n/e2e/de/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {AppPage} from '../app.po';
import {browser, logging} from 'protractor';

describe('cli-hello-world-ivy App', () => {
let page: AppPage;
Expand All @@ -8,19 +9,21 @@ describe('cli-hello-world-ivy App', () => {
});

it('should display title', () => {
expect(page.getHeading()).toEqual('Guten Tag, cli-hello-world-ivy-compat! (inline)');
});

it('should display welcome message', () => {
expect(page.getParagraph('message')).toEqual('Willkommen in der i18n App. (inline)');
expect(page.getHeading()).toEqual('Hallo cli-hello-world-ivy-i18n!');
});

it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('de'); });

// TODO : Re-enable when CLI translation inlining supports locale inlining (and so we can use it
// to load the correct locale data)
xit('the date pipe should show the localized month', () => {
it('the date pipe should show the localized month', () => {
page.navigateTo();
expect(page.getParagraph('date')).toEqual('Januar');
});

afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
14 changes: 10 additions & 4 deletions integration/cli-hello-world-ivy-i18n/e2e/en/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {AppPage} from '../app.po';
import {browser, logging} from 'protractor';

describe('cli-hello-world-ivy App', () => {
let page: AppPage;
Expand All @@ -8,15 +9,20 @@ describe('cli-hello-world-ivy App', () => {
});

it('should display title',
() => { expect(page.getHeading()).toEqual('Hello cli-hello-world-ivy-compat!'); });

it('should display welcome message',
() => { expect(page.getParagraph('message')).toEqual('Welcome to the i18n app.'); });
() => { expect(page.getHeading()).toEqual('Hello cli-hello-world-ivy-i18n!'); });

it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('en-US'); });

it('the date pipe should show the localized month', () => {
page.navigateTo();
expect(page.getParagraph('date')).toEqual('January');
});

afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
15 changes: 10 additions & 5 deletions integration/cli-hello-world-ivy-i18n/e2e/fr/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {AppPage} from '../app.po';
import {browser, logging} from 'protractor';

describe('cli-hello-world-ivy App', () => {
let page: AppPage;
Expand All @@ -8,16 +9,20 @@ describe('cli-hello-world-ivy App', () => {
});

it('should display title',
() => { expect(page.getHeading()).toEqual('Bonjour, cli-hello-world-ivy-compat! (inline)'); });

it('should display welcome message', () => {
expect(page.getParagraph('message')).toEqual('Bienvenue sur l\'application i18n. (inline)');
});
() => { expect(page.getHeading()).toEqual('Bonjour cli-hello-world-ivy-i18n!'); });

it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('fr'); });

it('the date pipe should show the localized month', () => {
page.navigateTo();
expect(page.getParagraph('date')).toEqual('janvier');
});

afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
25 changes: 5 additions & 20 deletions integration/cli-hello-world-ivy-i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "cli-hello-world-ivy-compat",
"name": "cli-hello-world-ivy-i18n",
"version": "0.0.0",
"license": "MIT",
"scripts": {
Expand All @@ -11,24 +11,9 @@
"update-webdriver": "webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG",
"start": "ng serve",
"pretest": "ng version",
"test": "ng test && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production && yarn translated:test && yarn translated:legacy-xlf:test && yarn translated:legacy-xmb:test",
"translate": "localize-translate -r \"dist/\" -s \"**/*\" -l \"en-US\" -t \"src/locales/messages.de.json\" \"src/locales/messages.fr.json\" -o \"../tmp/translations/{{LOCALE}}\"",
"runtime:test": "yarn e2e --configuration=runtime-translations",
"translated:test": "yarn build && yarn translate && yarn translated:fr:e2e && yarn translated:de:e2e && yarn translated:en:e2e",
"translated:fr:serve": "serve ../tmp/translations/fr --listen 4200",
"translated:fr:e2e": "npm-run-all -p -r translated:fr:serve \"ng e2e --configuration=translated-fr\"",
"translated:de:serve": "serve ../tmp/translations/de --listen 4200",
"translated:de:e2e": "npm-run-all -p -r translated:de:serve \"ng e2e --configuration=translated-de\"",
"translated:en:serve": "serve ../tmp/translations/en-US --listen 4200",
"translated:en:e2e": "npm-run-all -p -r translated:en:serve \"ng e2e --configuration=translated-en\"",
"translated:legacy:serve": "serve ../tmp/translations/legacy --listen 4200",
"translated:legacy:e2e": "npm-run-all -p -r translated:legacy:serve \"ng e2e --configuration=translated-legacy\"",
"translated:legacy:translate": "localize-translate -r \"dist/\" -s \"**/*\" -o \"../tmp/translations/{{LOCALE}}\"",

"translated:legacy-xlf:test": "yarn ng xi18n && yarn translated:legacy-xlf:update-translations && yarn ng build --configuration=translated-legacy && yarn translated:legacy:translate -t \"../tmp/legacy-locales/messages.legacy.xlf\" && yarn translated:legacy:e2e",
"translated:legacy-xlf:update-translations": "sed -i.bak -e 's/source>/target>'/ -e 's/Hello/Bonjour/' -e 's/source-language=\"en-US\"/source-language=\"en-US\" target-language=\"legacy\"/' ../tmp/legacy-locales/messages.legacy.xlf",
"translated:legacy-xmb:test": "yarn ng xi18n --format=xmb --outFile=messages.legacy.xmb && yarn translated:legacy-xmb:update-translations && yarn ng build --configuration=translated-legacy-xmb && yarn translated:legacy:translate -t \"../tmp/legacy-locales/messages.legacy.xtb\" && yarn translated:legacy:e2e",
"translated:legacy-xmb:update-translations": "sed -e 's/messagebundle/translationbundle/' -e 's/<translationbundle>/<translationbundle lang=\"legacy\">/' -e 's/msg/translation/' -e 's/Hello/Bonjour/' -e 's/<source>.*<\\/source>//' ../tmp/legacy-locales/messages.legacy.xmb > ../tmp/legacy-locales/messages.legacy.xtb"
"test": "ng e2e --prod && ng xi18n && yarn translate && ng build --configuration production,fr && ng build --configuration production,de && run-p -r \"serve dist/fr\" \"ng e2e --configuration=fr\" && run-p -r \"serve dist/de\" \"ng e2e --configuration=de\"",
"translate": "cp src/locale/messages.xlf src/locale/messages.fr.xlf && cp src/locale/messages.xlf src/locale/messages.de.xlf && sed -i.bak -e 's/source>/target>/g' -e 's/Hello/Bonjour/' src/locale/messages.fr.xlf && sed -i.bak -e 's/source>/target>/g' -e 's/Hello/Hallo/' src/locale/messages.de.xlf",
"serve": "serve --listen 4200"
},
"private": true,
"dependencies": {
Expand All @@ -49,7 +34,7 @@
"zone.js": "file:../../node_modules/zone.js"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.900.0-next.15",
"@angular-devkit/build-angular": "^0.900.0-rc.0",
"@angular/cli": "file:../../node_modules/@angular/cli",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/language-service": "file:../../dist/packages-dist/language-service",
Expand Down
23 changes: 1 addition & 22 deletions integration/cli-hello-world-ivy-i18n/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1 i18n>
Hello {{ title }}!
</h1>

<p id="message">{{ message }}</p>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h1 i18n> Hello {{ title }}! </h1>
<p id="locale">{{ locale }}</p>
<p id="pipe">{{ 1 | percent }} awesome</p>
<p id="date">{{ jan | date : 'LLLL' }}</p>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>

Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ describe('AppComponent', () => {
expect(app).toBeTruthy();
});

it(`should have as title 'cli-hello-world-ivy-compat'`, () => {
it(`should have as title 'cli-hello-world-ivy-i18n'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('cli-hello-world-ivy-compat');
expect(app.title).toEqual('cli-hello-world-ivy-i18n');
});

it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent)
.toContain('Hello cli-hello-world-ivy-compat!');
.toContain('Hello cli-hello-world-ivy-i18n!');
});
});