Skip to content

Commit 59589e3

Browse files
committed
Add a .editorconfig file to the init task that specifies the new indentation size of 4. Modify the existing jshint to follow the same size.
1 parent 22d8674 commit 59589e3

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

tasks/init.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ var cliArgs;
2323
var config = defaults.getInstance('init')
2424
.file(platform.userHomeDirectory(), '.angularity')
2525
.defaults({
26-
name : 'my-project',
27-
version : '0.0.0',
28-
description: '',
29-
tag : [ ],
30-
port : 'random',
31-
npm : true,
32-
bower : true,
33-
karma : true,
34-
jshint : true,
35-
gitignore : true,
36-
ide : 'none'
26+
name : 'my-project',
27+
version : '0.0.0',
28+
description : '',
29+
tag : [],
30+
port : 'random',
31+
npm : true,
32+
bower : true,
33+
karma : true,
34+
jshint : true,
35+
gitignore : true,
36+
editorconfig: true,
37+
ide : 'none'
3738
});
3839

3940
var check = yargs.createCheck()
@@ -133,6 +134,7 @@ yargs.getInstance('init')
133134
'* karma.conf.js exists, else create --karma',
134135
'* .jshintrc exists, else create --jshint',
135136
'* .gitignore exists, else create --gitignore',
137+
'* .editorconfig exists, else create --editorconfig',
136138
'* run IDE task --ide',
137139
'',
138140
'If a package.json is present initialisation will occur in the current directory. Otherwise a sub-directory is' +
@@ -215,6 +217,11 @@ yargs.getInstance('init')
215217
boolean : true,
216218
default : config.get('gitignore')
217219
})
220+
.options('editorconfig', {
221+
describe: 'Create .editorconfig',
222+
boolean : true,
223+
default : config.get('editorconfig')
224+
})
218225
.options('ide', {
219226
describe: 'Run an IDE initialisation task',
220227
string : true,
@@ -256,7 +263,8 @@ gulp.task('init', function (done) {
256263
cliArgs.bower && 'init:bower',
257264
cliArgs.karma && 'init:karma',
258265
cliArgs.jshint && 'init:jshint',
259-
cliArgs.gitignore && 'init:gitignore'
266+
cliArgs.gitignore && 'init:gitignore',
267+
cliArgs.editorconfig && 'init:editorconfig'
260268
]
261269
.concat(ideList)
262270
.filter(Boolean)
@@ -307,6 +315,10 @@ gulp.task('init:gitignore', function () {
307315
copyTemplateSync('.gitignore');
308316
});
309317

318+
gulp.task('init:editorconfig', function () {
319+
copyTemplateSync('.editorconfig');
320+
});
321+
310322
function padded(length) {
311323
return function(text) {
312324
return (text + (new Array(length)).join(' ')).slice(0, length);

templates/angularity/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.js]
2+
indent_style = space
3+
indent_size = 4

templates/angularity/.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"forin": false,
77
"freeze": false,
88
"immed": true,
9-
"indent": 2,
9+
"indent": 4,
1010
"latedef": "nofunc",
1111
"newcap": true,
1212
"noarg": true,

0 commit comments

Comments
 (0)