Skip to content

Commit 3f87bfb

Browse files
committed
feat(start): remove javascript as an option for v2 projects because they should all be typescript.
1 parent 2379b41 commit 3f87bfb

File tree

3 files changed

+15
-91
lines changed

3 files changed

+15
-91
lines changed

lib/ionic/start.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ var settings = {
4848
boolean: true,
4949
title: 'Start a Ionic v2 project'
5050
},
51-
'--typescript|--ts': {
52-
boolean: true,
53-
title: '(with --v2 only) Use TypeScript in starter'
54-
},
5551
'--zip-file|-z': 'URL to download zipfile for starter template'
5652
},
5753
isProjectTask: false
@@ -62,11 +58,6 @@ function run(ionic, argv) {
6258
return templateUtils.listTemplates();
6359
}
6460

65-
// If we are starting a version 2 project then typescript should be set by default
66-
if ((argv.v2 || argv.v) && !argv.hasOwnProperty('ts') && !argv.hasOwnProperty('typescript')) {
67-
argv.ts = true;
68-
}
69-
7061
if (argv._.length < 2) {
7162
return appLibUtils.fail('Invalid command', 'start');
7263
}

spec/cli.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ describe('Cli', function() {
150150
var booleanOptions = IonicCli.getListOfBooleanOptions(task.options);
151151

152152
// We expect 6 total = 3 options, each with short hand notation.
153-
expect(booleanOptions.length).toBe(11);
153+
expect(booleanOptions.length).toBe(9);
154154
});
155155

156156
it('should track stats for cli', function(done) {

spec/tasks/start.spec.js

Lines changed: 14 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ describe('start command', function() {
4747
expect(start.options['--io-app-id']).toEqual(jasmine.any(String));
4848
expect(start.options['--template|-t']).toEqual(jasmine.any(String));
4949
expect(start.options['--v2|-v']).toEqual(jasmine.any(Object));
50-
expect(start.options['--typescript|--ts']).toEqual(jasmine.any(Object));
5150
expect(start.options['--zip-file|-z']).toEqual(jasmine.any(String));
5251
});
5352
});
@@ -134,74 +133,32 @@ describe('start command', function() {
134133
});
135134
});
136135

137-
it('should default to typescript if starting a v2 project with -v', function(done) {
138-
var processArguments = ['node', 'ionic', 'start', 'newDir', '-v'];
139-
var rawCliArguments = processArguments.slice(2);
140-
var argv = optimist(rawCliArguments).argv;
141-
142-
spyOn(fs, 'existsSync').andReturn(false);
143-
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
144-
spyOn(Start, 'promptForOverwrite');
145-
spyOn(Start, 'startApp').andReturn(Q(true));
146-
spyOn(Start, 'printQuickHelp').andReturn(Q(true));
147-
spyOn(Start, 'promptLogin').andReturn(Q(true));
148-
149-
start.run({}, argv).then(function() {
150-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].v).toEqual(true);
151-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].ts).toEqual(true);
152-
expect(log.info).toHaveBeenCalledWith(
153-
'\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
154-
);
155-
done();
156-
});
157-
});
158-
159-
it('should default to typescript if starting a v2 project with --v2', function(done) {
160-
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2'];
136+
it('should catch error if any process throws', function(done) {
137+
var processArguments = ['node', 'ionic', 'start', 'newDir'];
161138
var rawCliArguments = processArguments.slice(2);
162139
var argv = optimist(rawCliArguments).argv;
163140

164141
spyOn(fs, 'existsSync').andReturn(false);
142+
spyOn(log, 'error');
165143
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
166144
spyOn(Start, 'promptForOverwrite');
167-
spyOn(Start, 'startApp').andReturn(Q(true));
168-
spyOn(Start, 'printQuickHelp').andReturn(Q(true));
169-
spyOn(Start, 'promptLogin').andReturn(Q(true));
145+
spyOn(Start, 'startApp').andReturn(Q.reject(false));
146+
spyOn(Start, 'printQuickHelp');
147+
spyOn(Start, 'promptLogin');
170148

171-
start.run({}, argv).then(function() {
172-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].v2).toEqual(true);
173-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].ts).toEqual(true);
174-
expect(log.info).toHaveBeenCalledWith(
175-
'\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
176-
);
149+
start.run({}, argv).catch(function() {
150+
expect(appLibUtils.preprocessCliOptions).toHaveBeenCalled();
151+
expect(Start.promptForOverwrite).not.toHaveBeenCalled();
152+
expect(Start.startApp).toHaveBeenCalled();
153+
expect(Start.printQuickHelp).not.toHaveBeenCalled();
154+
expect(Start.promptLogin).not.toHaveBeenCalled();
177155
done();
178156
});
179157
});
180158

181-
it('should use javascript if starting a v2 project with --v2 and --no-ts', function(done) {
182-
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2', '--no-ts'];
183-
var rawCliArguments = processArguments.slice(2);
184-
var argv = optimist(rawCliArguments).argv;
185159

186-
spyOn(fs, 'existsSync').andReturn(false);
187-
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
188-
spyOn(Start, 'promptForOverwrite');
189-
spyOn(Start, 'startApp').andReturn(Q(true));
190-
spyOn(Start, 'printQuickHelp').andReturn(Q(true));
191-
spyOn(Start, 'promptLogin').andReturn(Q(true));
192-
193-
start.run({}, argv).then(function() {
194-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].v2).toEqual(true);
195-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].ts).toEqual(false);
196-
expect(log.info).toHaveBeenCalledWith(
197-
'\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
198-
);
199-
done();
200-
});
201-
});
202-
203-
it('should use javascript if starting a v2 project with --v2 and --no-typescript', function(done) {
204-
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2', '--no-typescript'];
160+
it('should print a getting started message with v2 projects', function(done) {
161+
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2'];
205162
var rawCliArguments = processArguments.slice(2);
206163
var argv = optimist(rawCliArguments).argv;
207164

@@ -214,35 +171,11 @@ describe('start command', function() {
214171

215172
start.run({}, argv).then(function() {
216173
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].v2).toEqual(true);
217-
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].typescript).toEqual(false);
218174
expect(log.info).toHaveBeenCalledWith(
219175
'\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
220176
);
221177
done();
222178
});
223179
});
224-
225-
it('should catch error if any process throws', function(done) {
226-
var processArguments = ['node', 'ionic', 'start', 'newDir'];
227-
var rawCliArguments = processArguments.slice(2);
228-
var argv = optimist(rawCliArguments).argv;
229-
230-
spyOn(fs, 'existsSync').andReturn(false);
231-
spyOn(log, 'error');
232-
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
233-
spyOn(Start, 'promptForOverwrite');
234-
spyOn(Start, 'startApp').andReturn(Q.reject(false));
235-
spyOn(Start, 'printQuickHelp');
236-
spyOn(Start, 'promptLogin');
237-
238-
start.run({}, argv).catch(function() {
239-
expect(appLibUtils.preprocessCliOptions).toHaveBeenCalled();
240-
expect(Start.promptForOverwrite).not.toHaveBeenCalled();
241-
expect(Start.startApp).toHaveBeenCalled();
242-
expect(Start.printQuickHelp).not.toHaveBeenCalled();
243-
expect(Start.promptLogin).not.toHaveBeenCalled();
244-
done();
245-
});
246-
});
247180
});
248181
});

0 commit comments

Comments
 (0)