From fac4d8d42af0df1471e9003026b0c793aab1b13e Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 29 Sep 2017 10:08:12 +0100 Subject: [PATCH] build(common): specify explicit locales dir in package.json (#21016) PR Close #21016 --- integration/i18n/package.json | 3 ++- integration/i18n/test-locale-folder.js | 14 ++++++++++++++ packages/common/package.json | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 integration/i18n/test-locale-folder.js diff --git a/integration/i18n/package.json b/integration/i18n/package.json index 616e5cb025..a607ff4ef9 100644 --- a/integration/i18n/package.json +++ b/integration/i18n/package.json @@ -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" diff --git a/integration/i18n/test-locale-folder.js b/integration/i18n/test-locale-folder.js new file mode 100644 index 0000000000..13eef35f12 --- /dev/null +++ b/integration/i18n/test-locale-folder.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}.`) +} diff --git a/packages/common/package.json b/packages/common/package.json index 3c136fa4dc..bac145971e 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -11,6 +11,7 @@ "dependencies": { "tslib": "^1.7.1" }, + "locales": "locales", "peerDependencies": { "rxjs": "^5.5.0", "@angular/core": "0.0.0-PLACEHOLDER"