Skip to content

Commit 302a83b

Browse files
authored
Merge pull request #59 from andyhot/fix/keep-inplace
Keep js dotfiles in place
2 parents a853460 + 3154f87 commit 302a83b

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

lib/engines/classic/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ var ComponentTemplateFileInfo = require('./component-template-file-info');
99
var MainFileInfo = require('./main-file-info');
1010
var MixinFileInfo = require('./mixin-file-info');
1111
var ConfigFileInfo = require('./config-file-info');
12+
var MiscFileInfo = require('./misc-file-info');
1213

1314
module.exports = {
1415
buildFor: function(sourceRelativePath, options) {
1516
var ext = path.extname(sourceRelativePath);
1617
var pathParts = sourceRelativePath.split('/');
18+
var filename = pathParts.slice(-1)[0];
1719

18-
if (pathParts.slice(-1)[0] === '.gitkeep') {
20+
if (filename === '.gitkeep') {
1921
// ignore .gitkeep files
2022
return null;
2123
}
@@ -24,6 +26,11 @@ module.exports = {
2426
var sourceRoot = options.sourceRoot = pathParts[0];
2527
var topLevelDirectory;
2628

29+
if (filename[0] === '.' && ext === '.js') {
30+
// keep js dotfiles in their original location
31+
return new MiscFileInfo(options);
32+
}
33+
2734
if (sourceRoot === 'app') {
2835
options.base = 'src';
2936

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var ClassicFileInfo = require('./classic-file-info');
2+
3+
var MiscFileInfo = ClassicFileInfo.extend({
4+
fileInfoType: 'MiscFileInfo',
5+
6+
7+
init: function(options) {
8+
// sourceRoot needs to be set before the super call so that non js files stay in place
9+
options.sourceRoot = '.';
10+
this._super(options);
11+
12+
options.type = 'misc';
13+
},
14+
15+
populateCollection: function() {
16+
this.collection = '..';
17+
this.collectionGroup = '';
18+
}
19+
});
20+
21+
module.exports = MiscFileInfo;

test/fixtures/test-helpers/input.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
module.exports = {
22
app: {
33
'app.js': '// app',
4-
'resolver.js': '// resolver'
4+
'resolver.js': '// resolver',
5+
adapters: {
6+
'.eslint.js': '{}'
7+
}
58
},
69
config: {
710
'environment.js': '"ENV"'
811
},
912
tests: {
13+
'.eslintrc.js': 'module.exports = {};',
1014
'.eslint.js': '{}',
1115
'test-helper.js': '{}',
1216
helpers: {

test/fixtures/test-helpers/output.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
module.exports = {
2+
app: {
3+
adapters: {
4+
'.eslint.js': '{}'
5+
}
6+
},
27
src: {
38
'main.js': '// app',
49
'resolver.js': '// resolver'
@@ -7,6 +12,7 @@ module.exports = {
712
'environment.js': '"ENV"'
813
},
914
tests: {
15+
'.eslintrc.js': 'module.exports = {};',
1016
'.eslint.js': '{}',
1117
'test-helper.js': '{}',
1218
'helpers': {

0 commit comments

Comments
 (0)