mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 06:41:45 +08:00
feat(@angular/cli): add trailing slash to deployUrl when missing
Closes #7295
This commit is contained in:
parent
b1558f2512
commit
d53f45896b
@ -239,6 +239,11 @@ const BuildCommand = Command.extend({
|
|||||||
commandOptions.forceTsCommonjs = true;
|
commandOptions.forceTsCommonjs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add trailing slash if missing to prevent https://github.com/angular/angular-cli/issues/7295
|
||||||
|
if (commandOptions.deployUrl && commandOptions.deployUrl.substr(-1) !== '/') {
|
||||||
|
commandOptions.deployUrl += '/';
|
||||||
|
}
|
||||||
|
|
||||||
const BuildTask = require('../tasks/build').default;
|
const BuildTask = require('../tasks/build').default;
|
||||||
|
|
||||||
const buildTask = new BuildTask({
|
const buildTask = new BuildTask({
|
||||||
|
@ -2,6 +2,7 @@ import { ng } from '../../utils/process';
|
|||||||
import { copyProjectAsset } from '../../utils/assets';
|
import { copyProjectAsset } from '../../utils/assets';
|
||||||
import { expectFileToMatch, writeMultipleFiles } from '../../utils/fs';
|
import { expectFileToMatch, writeMultipleFiles } from '../../utils/fs';
|
||||||
import { updateJsonFile } from '../../utils/project';
|
import { updateJsonFile } from '../../utils/project';
|
||||||
|
import { getGlobalVariable } from '../../utils/env';
|
||||||
|
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
@ -27,5 +28,13 @@ export default function () {
|
|||||||
// verify --deploy-url is applied to non-extracted css urls
|
// verify --deploy-url is applied to non-extracted css urls
|
||||||
.then(() => ng('build', '--deploy-url=deployUrl/', '--extract-css=false'))
|
.then(() => ng('build', '--deploy-url=deployUrl/', '--extract-css=false'))
|
||||||
.then(() => expectFileToMatch('dist/styles.bundle.js',
|
.then(() => expectFileToMatch('dist/styles.bundle.js',
|
||||||
/__webpack_require__.p \+ \"more\.[0-9a-f]{20}\.png\"/));
|
/__webpack_require__.p \+ \"more\.[0-9a-f]{20}\.png\"/))
|
||||||
|
.then(() => expectFileToMatch('dist/inline.bundle.js',
|
||||||
|
/__webpack_require__\.p = "deployUrl\/";/))
|
||||||
|
// verify slash is appended to the end of --deploy-url if missing
|
||||||
|
.then(() => ng('build', '--deploy-url=deployUrl', '--extract-css=false'))
|
||||||
|
// skip this in ejected tests
|
||||||
|
.then(() => getGlobalVariable('argv').eject
|
||||||
|
? Promise.resolve()
|
||||||
|
: expectFileToMatch('dist/inline.bundle.js', /__webpack_require__\.p = "deployUrl\/";/));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user