build(common): specify explicit locales dir in package.json (#21016)
PR Close #21016
This commit is contained in:
parent
170885c51b
commit
fac4d8d42a
|
@ -24,7 +24,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG",
|
"postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG",
|
||||||
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
|
"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",
|
"serve": "lite-server -c e2e/browser.config.json",
|
||||||
"preprotractor": "tsc -p e2e",
|
"preprotractor": "tsc -p e2e",
|
||||||
"protractor": "protractor e2e/protractor.config.js"
|
"protractor": "protractor e2e/protractor.config.js"
|
||||||
|
|
|
@ -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}.`)
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^1.7.1"
|
"tslib": "^1.7.1"
|
||||||
},
|
},
|
||||||
|
"locales": "locales",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"rxjs": "^5.5.0",
|
"rxjs": "^5.5.0",
|
||||||
"@angular/core": "0.0.0-PLACEHOLDER"
|
"@angular/core": "0.0.0-PLACEHOLDER"
|
||||||
|
|
Loading…
Reference in New Issue