File tree 5 files changed +47
-4
lines changed
packages/@angular/cli/tasks
tests/e2e/tests/commands/eject
5 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,14 @@ export default Task.extend({
14
14
run : function ( runTaskOptions : BuildTaskOptions ) {
15
15
16
16
const project = this . cliProject ;
17
+ const config = CliConfig . fromProject ( ) . config ;
17
18
18
- const outputPath = runTaskOptions . outputPath || CliConfig . fromProject ( ) . config . apps [ 0 ] . outDir ;
19
+ const outputPath = runTaskOptions . outputPath || config . apps [ 0 ] . outDir ;
19
20
if ( project . root === outputPath ) {
20
- throw new SilentError ( 'Output path MUST not be project root directory!' ) ;
21
+ throw new SilentError ( 'Output path MUST not be project root directory!' ) ;
22
+ }
23
+ if ( config . project && config . project . ejected ) {
24
+ throw new SilentError ( 'An ejected project cannot use the build command anymore.' ) ;
21
25
}
22
26
rimraf . sync ( path . resolve ( project . root , outputPath ) ) ;
23
27
Original file line number Diff line number Diff line change 1
1
import * as url from 'url' ;
2
2
3
3
import { E2eTaskOptions } from '../commands/e2e' ;
4
+ import { CliConfig } from '../models/config' ;
4
5
import { requireProjectModule } from '../utilities/require-project-module' ;
6
+
5
7
const Task = require ( '../ember-cli/lib/models/task' ) ;
8
+ const SilentError = require ( 'silent-error' ) ;
6
9
7
10
8
11
export const E2eTask = Task . extend ( {
9
12
run : function ( e2eTaskOptions : E2eTaskOptions ) {
13
+ const projectConfig = CliConfig . fromProject ( ) . config ;
10
14
const projectRoot = this . project . root ;
11
15
const protractorLauncher = requireProjectModule ( projectRoot , 'protractor/built/launcher' ) ;
12
16
17
+ if ( projectConfig . project && projectConfig . project . ejected ) {
18
+ throw new SilentError ( 'An ejected project cannot use the build command anymore.' ) ;
19
+ }
20
+
13
21
return new Promise ( function ( ) {
14
22
let promise = Promise . resolve ( ) ;
15
23
let additionalProtractorConfig : any = {
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ export default Task.extend({
27
27
if ( this . project . root === outputPath ) {
28
28
throw new SilentError ( 'Output path MUST not be project root directory!' ) ;
29
29
}
30
+ if ( projectConfig . project && projectConfig . project . ejected ) {
31
+ throw new SilentError ( 'An ejected project cannot use the build command anymore.' ) ;
32
+ }
30
33
rimraf . sync ( path . resolve ( this . project . root , outputPath ) ) ;
31
34
32
35
const serveDefaults = {
Original file line number Diff line number Diff line change 1
- const Task = require ( '../ember-cli/lib/models/task' ) ;
2
- import { TestOptions } from '../commands/test' ;
3
1
import * as path from 'path' ;
2
+
3
+ import { TestOptions } from '../commands/test' ;
4
+ import { CliConfig } from '../models/config' ;
4
5
import { requireProjectModule } from '../utilities/require-project-module' ;
5
6
7
+ const Task = require ( '../ember-cli/lib/models/task' ) ;
8
+ const SilentError = require ( 'silent-error' ) ;
9
+
10
+
6
11
export default Task . extend ( {
7
12
run : function ( options : TestOptions ) {
13
+ const projectConfig = CliConfig . fromProject ( ) . config ;
8
14
const projectRoot = this . project . root ;
15
+
16
+ if ( projectConfig . project && projectConfig . project . ejected ) {
17
+ throw new SilentError ( 'An ejected project cannot use the build command anymore.' ) ;
18
+ }
19
+
9
20
return new Promise ( ( resolve ) => {
10
21
const karma = requireProjectModule ( projectRoot , 'karma' ) ;
11
22
const karmaConfig = path . join ( projectRoot , options . config ||
Original file line number Diff line number Diff line change
1
+ import * as path from 'path' ;
2
+
3
+ import { ng , silentNpm , exec } from '../../../utils/process' ;
4
+ import { expectToFail } from '../../../utils/utils' ;
5
+ import { expectGitToBeClean } from '../../../utils/git' ;
6
+
7
+
8
+ export default function ( ) {
9
+ return ng ( 'eject' )
10
+ . then ( ( ) => expectToFail ( ( ) => ng ( 'build' ) ) )
11
+ . then ( ( ) => expectToFail ( ( ) => ng ( 'test' ) ) )
12
+ . then ( ( ) => expectToFail ( ( ) => ng ( 'e2e' ) ) )
13
+ . then ( ( ) => expectToFail ( ( ) => ng ( 'serve' ) ) )
14
+ . then ( ( ) => expectToFail ( ( ) => expectGitToBeClean ( ) ) )
15
+ . then ( ( ) => silentNpm ( 'install' ) )
16
+ . then ( ( ) => exec ( path . join ( 'node_modules' , '.bin' , 'webpack' ) ) ) ;
17
+ }
You can’t perform that action at this time.
0 commit comments