Skip to content

Commit 74ad1ea

Browse files
committed
fix(generators): allow configurable directory to be passed in
1 parent 3b7dd96 commit 74ad1ea

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

lib/ionic/generate.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,45 @@ function run(ionic, argv) {
6060
includeSass: includeSass
6161
};
6262

63+
var componentsDir = path.join(process.cwd(), 'src', 'components');
64+
var directivesDir = path.join(process.cwd(), 'src', 'components');
65+
var pagesDir = path.join(process.cwd(), 'src', 'pages');
66+
var pipesDir = path.join(process.cwd(), 'src', 'pipes');
67+
var providersDir = path.join(process.cwd(), 'src', 'providers');
68+
var templateDir = path.join(process.cwd(), 'node_modules', 'ionic-angular', 'templates');
69+
70+
if (argv.componentsDir && argv.componentsDir.length > 0) {
71+
componentsDir = path.resolve(argv.componentsDir);
72+
}
73+
74+
if (argv.directivesDir && argv.directivesDir.length > 0) {
75+
directivesDir = path.resolve(argv.directivesDir);
76+
}
77+
78+
if (argv.pagesDir && argv.pagesDir.length > 0) {
79+
pagesDir = path.resolve(argv.pagesDir);
80+
}
81+
82+
if (argv.pipesDir && argv.pipesDir.length > 0) {
83+
pipesDir = path.resolve(argv.pipesDir);
84+
}
85+
86+
if (argv.providersDir && argv.providersDir.length > 0) {
87+
providersDir = path.resolve(argv.providersDir);
88+
}
89+
90+
if (argv.templateDir && argv.templateDir.length > 0) {
91+
templateDir = path.resolve(argv.templateDir);
92+
}
93+
94+
6395
var projectStructureOptions = {
64-
absoluteComponentDirPath: process.cwd() + '/src/components',
65-
absoluteDirectiveDirPath: process.cwd() + '/src/components',
66-
absolutePagesDirPath: process.cwd() + '/src/pages',
67-
absolutePipeDirPath: process.cwd() + '/src/pipes',
68-
absoluteProviderDirPath: process.cwd() + '/src/providers',
69-
absolutePathTemplateBaseDir: process.cwd() + '/node_modules/ionic-angular/templates'
96+
absoluteComponentDirPath: componentsDir,
97+
absoluteDirectiveDirPath: directivesDir,
98+
absolutePagesDirPath: pagesDir,
99+
absolutePipeDirPath: pipesDir,
100+
absoluteProviderDirPath: providersDir,
101+
absolutePathTemplateBaseDir: templateDir
70102
};
71103

72104
return appGenerator.generate(generatorOptions, projectStructureOptions).catch(function(err) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic",
3-
"version": "2.1.0-beta.2",
3+
"version": "2.1.0-beta.3",
44
"preferGlobal": true,
55
"description": "A tool for creating and developing Ionic Framework mobile apps.",
66
"homepage": "http://ionicframework.com/",

0 commit comments

Comments
 (0)