forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (46 loc) · 1.41 KB
/
index.js
File metadata and controls
56 lines (46 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict';
const isModuleUnificationProject = require('../module-unification').isModuleUnificationProject;
const normalizeEntityName = require('ember-cli-normalize-entity-name');
const path = require('path');
module.exports = {
description: 'Generates a helper function.',
filesPath() {
let rootPath = isModuleUnificationProject(this.project) ? 'mu-files' : 'files';
return path.join(this.path, rootPath);
},
fileMapTokens() {
if (isModuleUnificationProject(this.project)) {
return {
__root__(options) {
if (options.pod) {
throw new Error("Pods aren't supported within a module unification app");
}
if (options.inRepoAddon) {
return path.join('packages', options.inRepoAddon, 'src');
}
if (options.inDummy) {
return path.join('tests', 'dummy', 'src');
}
return 'src';
},
__collection__(options) {
if (options.pod) {
throw new Error("Pods aren't supported within a module unification app");
}
return path.join('ui', 'components');
},
};
} else {
return {
__collection__() {
return 'helpers';
},
};
}
},
normalizeEntityName: function(entityName) {
return normalizeEntityName(
entityName.replace(/\.js$/, '') //Prevent generation of ".js.js" files
);
},
};