create-remax-app
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -51,2 +51,4 @@ "use strict"; | ||
var ask_1 = __importDefault(require("./ask")); | ||
var currentPlatformName = ''; | ||
var currentPlatform = ''; | ||
exports.default = (function (renderObj, macros) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -84,5 +86,30 @@ var templatePath, destPath, description, projectDirectory, newProjectDirectory, newDestPath, isExists; | ||
.use(removeFile()) | ||
.use(generatorOutputInfo(macros)) | ||
.build(function (err) { | ||
if (!err) { | ||
console.log(chalk_1.default.green('create project success!')); | ||
var cd = chalk_1.default.cyan(" cd " + newProjectDirectory + " && npm i"); | ||
var platformList = chalk_1.default.yellow('ali, wechat, toutiao, web'); | ||
var oneCommandArray = [ | ||
{ command: chalk_1.default.cyan('npm run dev <platform>'), description: "\u6839\u636E\u4F20\u5165\u5E73\u53F0\u8FDB\u884C\u8C03\u8BD5\uFF0C\u652F\u6301\u53C2\u6570\u4E3A: " + platformList }, | ||
{ command: chalk_1.default.cyan('npm run dev ali'), description: '调试阿里小程序' }, | ||
{ command: chalk_1.default.cyan('npm run build <platform>'), description: "\u6839\u636E\u4F20\u5165\u5E73\u53F0\u6784\u5EFA\u5C0F\u7A0B\u5E8F\uFF0C\u652F\u6301\u53C2\u6570\u4E3A: " + platformList }, | ||
{ command: chalk_1.default.cyan('npm run build ali'), description: '构建阿里小程序' }, | ||
]; | ||
var otherCommandArray = [ | ||
{ command: chalk_1.default.cyan('npm run dev'), description: "\u8C03\u8BD5" + currentPlatformName }, | ||
{ command: chalk_1.default.cyan('npm run build'), description: "\u6784\u5EFA" + currentPlatformName } | ||
]; | ||
var newCommandArray = oneCommandArray.map(function (item) { | ||
return " " + item.command + " \t\n\t\n " + item.description; | ||
}); | ||
var newOtherCommandArray = otherCommandArray.map(function (item) { | ||
return " " + item.command + " \t\n\t\n " + item.description; | ||
}); | ||
var oneCommandInfo = "\t\n\u4F60\u53EF\u4EE5\u8FDB\u5165 " + chalk_1.default.cyanBright(newProjectDirectory) + " \u6267\u884C\u4EE5\u4E0B\u547D\u4EE4: \t\n\t\n" + cd + "\t\n\t\n \u8FDB\u5165\u9879\u76EE\u76EE\u5F55\u5E76\u5B89\u88C5\u4F9D\u8D56\t\n\t\n" + newCommandArray.join('\t\n\t\n'); | ||
var otherCommandInfo = "\t\n\u4F60\u53EF\u4EE5\u8FDB\u5165 " + chalk_1.default.cyanBright(newProjectDirectory) + " \u6267\u884C\u4EE5\u4E0B\u547D\u4EE4: \t\n\t\n" + cd + "\t\n\t\n \u8FDB\u5165\u9879\u76EE\u76EE\u5F55\u5E76\u5B89\u88C5\u4F9D\u8D56\t\n\t\n" + newOtherCommandArray.join('\t\n\t\n'); | ||
var currentCommandInfo = currentPlatform === 'one' ? oneCommandInfo : otherCommandInfo; | ||
console.log('\t'); | ||
console.log("\u521B\u5EFA " + chalk_1.default.cyan(currentPlatformName) + " \u6210\u529F\uFF01"); | ||
console.log(currentCommandInfo); | ||
console.log('\t\n欲了解更多请查阅官方文档:https://remaxjs.org'); | ||
} | ||
@@ -93,2 +120,15 @@ }); | ||
}); }); | ||
var generatorOutputInfo = function (macros) { | ||
return function (_, metalsmith, done) { | ||
var platform = metalsmith._metadata.platform; | ||
macros.choices.some(function (item) { | ||
if (item.value === platform) { | ||
currentPlatformName = item.name; | ||
currentPlatform = item.value; | ||
return; | ||
} | ||
}); | ||
done(); | ||
}; | ||
}; | ||
var filterPlatform = function (macros) { | ||
@@ -95,0 +135,0 @@ return function (_, metalsmith, done) { |
{ | ||
"name": "create-remax-app", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Create Remax apps with no build configuration.", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -24,3 +24,3 @@ { | ||
{{/if}} | ||
"remax": "^2.0.2" | ||
"remax": "^2.0.3" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
@@ -24,3 +24,3 @@ { | ||
{{/if}} | ||
"remax": "^2.0.2" | ||
"remax": "^2.0.3" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
86156
1201