mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(tooling): add q as generator dependency
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
"es6-shim": "^0.33.6",
|
||||
"inquirer": "^0.11.0",
|
||||
"lodash": "^3.10.1",
|
||||
"q": "^1.4.1",
|
||||
"reflect-metadata": "0.1.1",
|
||||
"shelljs": "^0.5.3",
|
||||
"zone.js": "0.5.8"
|
||||
@@ -57,7 +58,6 @@
|
||||
"minimist": "^1.1.3",
|
||||
"node-html-encoder": "0.0.2",
|
||||
"node-libs-browser": "^0.5.2",
|
||||
"q": "^1.4.1",
|
||||
"request": "2.53.0",
|
||||
"run-sequence": "^1.1.0",
|
||||
"semver": "^5.0.1",
|
||||
|
||||
@@ -10,7 +10,7 @@ Generate.__defineGetter__('generators', function() {
|
||||
if (!Generate._generators) {
|
||||
Generate._generators = Generate.loadGenerators();
|
||||
}
|
||||
|
||||
|
||||
return Generate._generators;
|
||||
});
|
||||
|
||||
@@ -24,21 +24,17 @@ Generate.generate = function generate(options) {
|
||||
if (!options) {
|
||||
throw new Error('No options passed to generator');
|
||||
}
|
||||
|
||||
|
||||
//add optional logger for CLI or other tools
|
||||
if (options.log) {
|
||||
Generate.log = options.log;
|
||||
}
|
||||
|
||||
if (options.q) {
|
||||
Generate.q = options.q;
|
||||
}
|
||||
|
||||
if (!options.generatorName) {
|
||||
options.generatorName = 'page';
|
||||
}
|
||||
|
||||
var generateOptions = {
|
||||
var generateOptions = {
|
||||
appDirectory: options.appDirectory,
|
||||
fileAndClassName: Generate.fileAndClassName(options.name),
|
||||
javascriptClassName: Generate.javascriptClassName(options.name),
|
||||
@@ -78,7 +74,7 @@ Generate.loadGenerator = function loadGenerator(file) {
|
||||
}
|
||||
return generateModule;
|
||||
};
|
||||
|
||||
|
||||
Generate.loadGenerators = function loadGenerators() {
|
||||
var generators = {};
|
||||
fs.readdirSync(path.join(__dirname, 'generators'))
|
||||
@@ -92,7 +88,7 @@ Generate.loadGenerators = function loadGenerators() {
|
||||
return generators;
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
Will take options to render an html, js, or scss template.
|
||||
options:
|
||||
they differ based on what is needed in template
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
inquirer = require('inquirer'),
|
||||
Q = require('q'),
|
||||
Generator = module.exports,
|
||||
Generate = require('../../generate');
|
||||
|
||||
@@ -16,7 +17,7 @@ Generator.validate = function(input) {
|
||||
Generator.numberNames = ['first', 'second', 'third', 'fourth', 'fifth'];
|
||||
|
||||
Generator.promptForTabCount = function promptForTabCount() {
|
||||
var q = Generate.q.defer();
|
||||
var q = Q.defer();
|
||||
|
||||
inquirer.prompt({choices: ['1', '2', '3', '4', '5'], message: 'How many tabs will you have?', name: 'count', type: 'list', validate: Generator.validate}, function(result) {
|
||||
q.resolve(result.count);
|
||||
@@ -26,7 +27,7 @@ Generator.promptForTabCount = function promptForTabCount() {
|
||||
};
|
||||
|
||||
Generator.promptForTabName = function promptForTabName(tabIndex, options) {
|
||||
var q = Generate.q.defer();
|
||||
var q = Q.defer();
|
||||
|
||||
inquirer.prompt({message: 'Enter the ' + Generator.numberNames[tabIndex] + ' tab name:', name: 'name', type: 'input'}, function(nameResult) {
|
||||
Generator.tabs.push({ appDirectory: options.appDirectory, fileAndClassName: Generate.fileAndClassName(nameResult.name), javascriptClassName: Generate.javascriptClassName(nameResult.name), name: nameResult.name });
|
||||
@@ -39,7 +40,6 @@ Generator.promptForTabName = function promptForTabName(tabIndex, options) {
|
||||
Generator.run = function run(options) {
|
||||
// console.log('got options!', options);
|
||||
|
||||
// Generator.q = Generate.q;
|
||||
//Need to query user for tabs:
|
||||
options.rootDirectory = options.rootDirectory || path.join('www', 'app');
|
||||
var savePath = path.join(options.appDirectory, options.rootDirectory, options.fileAndClassName);
|
||||
@@ -49,7 +49,7 @@ Generator.run = function run(options) {
|
||||
return Generator.promptForTabCount()
|
||||
.then(function(count) {
|
||||
console.log('count', count);
|
||||
var promise = Generate.q();
|
||||
var promise = Q();
|
||||
for(var i = 0, j = parseInt(count); i < j; i++) {
|
||||
(function(index) {
|
||||
promise = promise.then(function() {
|
||||
|
||||
Reference in New Issue
Block a user