build(common): specify explicit locales dir in package.json (#21016)

PR Close #21016
This commit is contained in:
Filipe Silva 2017-09-29 10:08:12 +01:00 committed by Misko Hevery
parent 170885c51b
commit fac4d8d42a
3 changed files with 17 additions and 1 deletions

View File

@ -24,7 +24,8 @@
"scripts": {
"postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG",
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first && npm run test-locale-folder",
"test-locale-folder": "node test-locale-folder.js",
"serve": "lite-server -c e2e/browser.config.json",
"preprotractor": "tsc -p e2e",
"protractor": "protractor e2e/protractor.config.js"

View File

@ -0,0 +1,14 @@
const fs = require('fs');
const path = require('path');
const packageJson = require('@angular/common/package.json');
const localesFolder = packageJson['locales'];
if (!localesFolder) {
throw new Error(`@angular/common/package.json does not contain 'locales' entry.`)
}
const enLocalePath = `@angular/common/${localesFolder}/en`;
try {
require.resolve(enLocalePath);
} catch (err) {
throw new Error(`@angular/common does not contain 'en' locale in ${enLocalePath}.`)
}

View File

@ -11,6 +11,7 @@
"dependencies": {
"tslib": "^1.7.1"
},
"locales": "locales",
"peerDependencies": {
"rxjs": "^5.5.0",
"@angular/core": "0.0.0-PLACEHOLDER"