-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(serve): Persist serve options in angular-cli.json
- Loading branch information
Showing
5 changed files
with
126 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,84 @@ | ||
export interface CliConfig { | ||
/** | ||
* The global configuration of the project. | ||
*/ | ||
project?: { | ||
version?: string; | ||
name?: string; | ||
}; | ||
/** | ||
* Properties of the different applications in this project. | ||
*/ | ||
apps?: { | ||
root?: string; | ||
outDir?: string; | ||
assets?: string; | ||
deployUrl?: string; | ||
index?: string; | ||
main?: string; | ||
test?: string; | ||
tsconfig?: string; | ||
prefix?: string; | ||
mobile?: boolean; | ||
/** | ||
* The global configuration of the project. | ||
* Global styles to be included in the build. | ||
*/ | ||
project?: { | ||
version?: string; | ||
name?: string; | ||
}; | ||
/** | ||
* Properties of the different applications in this project. | ||
*/ | ||
apps?: { | ||
root?: string; | ||
outDir?: string; | ||
assets?: string; | ||
deployUrl?: string; | ||
index?: string; | ||
main?: string; | ||
test?: string; | ||
tsconfig?: string; | ||
prefix?: string; | ||
mobile?: boolean; | ||
/** | ||
* Global styles to be included in the build. | ||
*/ | ||
styles?: string[]; | ||
/** | ||
* Global scripts to be included in the build. | ||
*/ | ||
scripts?: string[]; | ||
/** | ||
* Name and corresponding file for environment config. | ||
*/ | ||
environments?: { | ||
[name: string]: any; | ||
}; | ||
}[]; | ||
styles?: string[]; | ||
/** | ||
* Configuration reserved for installed third party addons. | ||
* Global scripts to be included in the build. | ||
*/ | ||
addons?: { | ||
[name: string]: any; | ||
}[]; | ||
scripts?: string[]; | ||
/** | ||
* Configuration reserved for installed third party packages. | ||
* Name and corresponding file for environment config. | ||
*/ | ||
packages?: { | ||
[name: string]: any; | ||
}[]; | ||
e2e?: { | ||
protractor?: { | ||
config?: string; | ||
}; | ||
environments?: { | ||
[name: string]: any; | ||
}; | ||
}[]; | ||
/** | ||
* Configuration reserved for installed third party addons. | ||
*/ | ||
addons?: { | ||
[name: string]: any; | ||
}[]; | ||
/** | ||
* Configuration reserved for installed third party packages. | ||
*/ | ||
packages?: { | ||
[name: string]: any; | ||
}[]; | ||
e2e?: { | ||
protractor?: { | ||
config?: string; | ||
}; | ||
}; | ||
test?: { | ||
karma?: { | ||
config?: string; | ||
}; | ||
test?: { | ||
karma?: { | ||
config?: string; | ||
}; | ||
}; | ||
defaults?: { | ||
styleExt?: string; | ||
prefixInterfaces?: boolean; | ||
poll?: number; | ||
viewEncapsulation?: string; | ||
changeDetection?: string; | ||
inline?: { | ||
style?: boolean; | ||
template?: boolean; | ||
}; | ||
defaults?: { | ||
styleExt?: string; | ||
prefixInterfaces?: boolean; | ||
poll?: number; | ||
viewEncapsulation?: string; | ||
changeDetection?: string; | ||
inline?: { | ||
style?: boolean; | ||
template?: boolean; | ||
}; | ||
spec?: { | ||
class?: boolean; | ||
component?: boolean; | ||
directive?: boolean; | ||
module?: boolean; | ||
pipe?: boolean; | ||
service?: boolean; | ||
}; | ||
spec?: { | ||
class?: boolean; | ||
component?: boolean; | ||
directive?: boolean; | ||
module?: boolean; | ||
pipe?: boolean; | ||
service?: boolean; | ||
}; | ||
serve?: { | ||
port: number; | ||
liveReloadPort: number; | ||
host: string; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { request } from '../../utils/http'; | ||
import { killAllProcesses } from '../../utils/process'; | ||
import { ngServe } from '../../utils/project'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => updateJsonFile('angular-cli.json', configJson => { | ||
const app = configJson['defaults']['serve']; | ||
app['port'] = 4201; | ||
})) | ||
.then(() => ngServe()) | ||
.then(() => request('http://localhost:4201/')) | ||
.then(body => { | ||
if (!body.match(/<app-root>Loading...<\/app-root>/)) { | ||
throw new Error('Response does not match expected value.'); | ||
} | ||
}) | ||
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }); | ||
} |