Skip to content

Commit 9969509

Browse files
committed
feat: allow for configurable source diretory location and selector prefix at app creation
1 parent 5b08965 commit 9969509

30 files changed

+178
-169
lines changed

addon/ng2/blueprints/component/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ module.exports = {
8888
dir = dirParts.join(path.sep);
8989
}
9090
}
91-
this.appDir = dir.replace(`src${path.sep}client${path.sep}`, '');
91+
var srcDir = this.project.ngConfig.defaults.sourceDir;
92+
this.appDir = dir.substr(dir.indexOf(srcDir) + srcDir.length);
9293
this.generatePath = dir;
9394
return dir;
9495
},
@@ -100,8 +101,11 @@ module.exports = {
100101

101102
afterInstall: function(options) {
102103
if (!options.flat) {
103-
var filePath = path.join('src', 'client', 'system-config.ts');
104-
var barrelUrl = this.appDir.replace(path.sep, '/');
104+
var filePath = path.join(this.project.ngConfig.defaults.sourceDir, 'system-config.ts');
105+
var barrelUrl = this.appDir.replace(/\\/g, '/');
106+
if (barrelUrl[0] === '/') {
107+
barrelUrl = barrelUrl.substr(1);
108+
}
105109

106110
return addBarrelRegistration(this, this.generatePath)
107111
.then(() => {
@@ -110,7 +114,7 @@ module.exports = {
110114
` '${barrelUrl}',`,
111115
{ before: ' /** @cli-barrel */' }
112116
);
113-
})
117+
});
114118
} else {
115119
return addBarrelRegistration(
116120
this,

addon/ng2/blueprints/ng2/files/src/client/app/__name__.component.__styleext__ renamed to addon/ng2/blueprints/ng2/files/__path__/app/__name__.component.__styleext__

File renamed without changes.

addon/ng2/blueprints/ng2/files/src/client/app/__name__.component.html renamed to addon/ng2/blueprints/ng2/files/__path__/app/__name__.component.html

File renamed without changes.

addon/ng2/blueprints/ng2/files/src/client/app/__name__.component.spec.ts renamed to addon/ng2/blueprints/ng2/files/__path__/app/__name__.component.spec.ts

File renamed without changes.

addon/ng2/blueprints/ng2/files/src/client/app/__name__.component.ts renamed to addon/ng2/blueprints/ng2/files/__path__/app/__name__.component.ts

File renamed without changes.

addon/ng2/blueprints/ng2/files/src/client/app/environment.ts renamed to addon/ng2/blueprints/ng2/files/__path__/app/environment.ts

File renamed without changes.

addon/ng2/blueprints/ng2/files/src/client/app/shared/index.ts renamed to addon/ng2/blueprints/ng2/files/__path__/app/shared/index.ts

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)