From 1d6120f86a1915892a87d6f2f500a66b156f1e02 Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Mon, 14 Nov 2016 21:16:21 +0100 Subject: [PATCH 1/3] add publicPath to the config schema --- packages/angular-cli/lib/config/schema.d.ts | 3 ++- packages/angular-cli/lib/config/schema.json | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/angular-cli/lib/config/schema.d.ts b/packages/angular-cli/lib/config/schema.d.ts index 1f5ea0d0d526..d673bf64322a 100644 --- a/packages/angular-cli/lib/config/schema.d.ts +++ b/packages/angular-cli/lib/config/schema.d.ts @@ -12,7 +12,8 @@ export interface CliConfig { apps?: { root?: string; outDir?: string; - assets?: string; + publicPath?: string; + assets?: string[]; index?: string; main?: string; test?: string; diff --git a/packages/angular-cli/lib/config/schema.json b/packages/angular-cli/lib/config/schema.json index 37668441c0b0..0226743e7f3f 100644 --- a/packages/angular-cli/lib/config/schema.json +++ b/packages/angular-cli/lib/config/schema.json @@ -31,6 +31,9 @@ "type": "string", "default": "dist/" }, + "publicPath": { + "type": "string" + }, "assets": { "fixme": true, "type": "array", From fa882aa74a32b0b679f7ea7f02cfe06b1e57ec32 Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Mon, 14 Nov 2016 21:16:37 +0100 Subject: [PATCH 2/3] pass "publicPath" from the config to webpack --- packages/angular-cli/models/webpack-build-common.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index 6d1bbe01c76f..b85d461bcdfc 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -41,6 +41,7 @@ export function getWebpackCommonConfig( entry: entry, output: { path: path.resolve(projectRoot, appConfig.outDir), + publicPath: appConfig.publicPath, filename: '[name].bundle.js' }, module: { From 87b0b3e7ef5aaf0aec6e1616d4e795c7e7bfd95c Mon Sep 17 00:00:00 2001 From: Joerg Bellmann Date: Sat, 19 Nov 2016 00:01:27 +0100 Subject: [PATCH 3/3] test for 'publicPath' config --- .../tests/third-party/bootstrap_publicPath.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/e2e/tests/third-party/bootstrap_publicPath.ts diff --git a/tests/e2e/tests/third-party/bootstrap_publicPath.ts b/tests/e2e/tests/third-party/bootstrap_publicPath.ts new file mode 100644 index 000000000000..50765e3cdedc --- /dev/null +++ b/tests/e2e/tests/third-party/bootstrap_publicPath.ts @@ -0,0 +1,31 @@ +import {npm, ng} from '../../utils/process'; +import {updateJsonFile} from '../../utils/project'; +import {expectFileToMatch} from '../../utils/fs'; +import {oneLineTrim} from 'common-tags'; + + +export default function() { + return Promise.resolve() + .then(() => npm('install', 'bootstrap@next')) + .then(() => updateJsonFile('angular-cli.json', configJson => { + const app = configJson['apps'][0]; + app['styles'].push('../node_modules/bootstrap/dist/css/bootstrap.css'); + app['scripts'].push( + '../node_modules/jquery/dist/jquery.js', + '../node_modules/tether/dist/js/tether.js', + '../node_modules/bootstrap/dist/js/bootstrap.js' + ); + app['publicPath'] = '/publicPathValue/'; + })) + .then(() => ng('build')) + .then(() => expectFileToMatch('dist/scripts.bundle.js', '/*!\\n * jQuery JavaScript')) + .then(() => expectFileToMatch('dist/scripts.bundle.js', '/*! tether ')) + .then(() => expectFileToMatch('dist/scripts.bundle.js', '/*!\\n * Bootstrap')) + .then(() => expectFileToMatch('dist/styles.bundle.js', '/*!\\n * Bootstrap')) + .then(() => expectFileToMatch('dist/index.html', oneLineTrim` + + + + + `)); +}