File tree Expand file tree Collapse file tree 6 files changed +104
-1
lines changed
Expand file tree Collapse file tree 6 files changed +104
-1
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33module . exports = {
4- name : require ( './package' ) . name
4+ name : require ( './package' ) . name ,
5+
6+ includedCommands ( ) {
7+ return {
8+ 'ios:build' : require ( './lib/commands/ios-build' ) ,
9+ 'ios:serve' : require ( './lib/commands/ios-serve' )
10+ } ;
11+ } ,
12+
13+ isDevelopingAddon ( ) {
14+ return true ;
15+ }
516} ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const Command = require ( 'ember-cli/lib/models/command' ) ;
4+ const iOSBuildTask = require ( '../tasks/ios-build' ) ;
5+ const iOSServeTask = require ( '../tasks/ios-serve' ) ;
6+
7+ module . exports = Command . extend ( {
8+ init ( ) {
9+ this . _super ( ...arguments ) ;
10+
11+ Object . assign ( this . tasks , {
12+ 'ios:build' : iOSBuildTask ,
13+ 'ios:serve' : iOSServeTask
14+ } ) ;
15+ }
16+ } ) ;
Original file line number Diff line number Diff line change 1+
2+ 'use strict' ;
3+
4+ const BaseCommand = require ( './base' ) ;
5+
6+ module . exports = BaseCommand . extend ( {
7+ name : 'ios:build' ,
8+ description : 'Builds your app for iOS' ,
9+ async run ( commandOptions ) {
10+ return await this . runTask ( 'ios:build' , commandOptions ) ;
11+ }
12+ } ) ;
Original file line number Diff line number Diff line change 1+
2+ 'use strict' ;
3+
4+ const BaseCommand = require ( './base' ) ;
5+
6+ module . exports = BaseCommand . extend ( {
7+ name : 'ios:serve' ,
8+ description : 'Builds your app and launches iOS w/ live reload.' ,
9+ async run ( commandOptions ) {
10+ return await this . runTask ( 'ios:serve' , commandOptions ) ;
11+ }
12+ } ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const chalk = require ( 'chalk' ) ;
4+ const Task = require ( 'ember-cli/lib/models/task' ) ;
5+ // const Builder = require('ember-cli/lib/models/builder');
6+ const { execSync } = require ( 'child_process' ) ;
7+
8+ class iOSBuildTask extends Task {
9+ async run ( ) {
10+ let { ui } = this ;
11+
12+ ui . writeLine ( chalk . green ( 'iOS Build: Ember build' ) , chalk . green ( '.' ) ) ;
13+ execSync ( 'ember build --environment=production' ) ;
14+
15+ ui . writeLine ( chalk . green ( 'iOS Build: Sync' ) , chalk . green ( '.' ) ) ;
16+ execSync ( 'npx cap sync ios' ) ;
17+
18+ ui . writeLine ( chalk . green ( 'iOS Build: Opening Xcode' ) , chalk . green ( '.' ) ) ;
19+ execSync ( 'npx cap open ios' ) ;
20+ }
21+ }
22+
23+ module . exports = iOSBuildTask ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const chalk = require ( 'chalk' ) ;
4+ const Task = require ( 'ember-cli/lib/models/task' ) ;
5+ // const Builder = require('ember-cli/lib/models/builder');
6+ const { execSync } = require ( 'child_process' ) ;
7+
8+ class iOSServeTask extends Task {
9+ async run ( ) {
10+ let { ui } = this ;
11+
12+ ui . startProgress ( chalk . green ( 'iOS Serve: ember build' ) , chalk . green ( '.' ) ) ;
13+ execSync ( 'ember build --environment=development' ) ;
14+ ui . stopProgress ( ) ;
15+
16+ ui . startProgress ( chalk . green ( 'iOS Serve: npx cap sync ios' ) , chalk . green ( '.' ) ) ;
17+ execSync ( 'npx cap sync ios' ) ;
18+ ui . stopProgress ( ) ;
19+
20+ ui . startProgress ( chalk . green ( 'iOS Serve: npx cap open ios' ) , chalk . green ( '.' ) ) ;
21+ execSync ( 'npx cap open ios' ) ;
22+ ui . stopProgress ( ) ;
23+
24+ ui . writeLine ( chalk . green ( 'iOS Serve: Serving Ember app in Xcode' ) ) ;
25+ execSync ( 'ember serve' ) ;
26+ }
27+ }
28+
29+ module . exports = iOSServeTask ;
You can’t perform that action at this time.
0 commit comments