From 7f3b3779c06da74883372489a28b4ee8f83830dd Mon Sep 17 00:00:00 2001 From: lcxfs1991 Date: Thu, 23 Jun 2016 20:12:37 +0800 Subject: [PATCH] add customized project repo --- README.md | 18 +++++++++++++++++- libs/SteamerGet.js | 11 +++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd86b0c..c6b1a9e 100755 --- a/README.md +++ b/README.md @@ -69,7 +69,19 @@ var steamerConfig = { } }, - } + }, + repos: { // 自己想加入steamer管理的boilerplate + "react-cdk": { + git: "react-cdk", + config: { + src: "./react-cdk/", + cmds: { + dev: "npm run dev", + pub: "npm run pub", + }, + }, + } + } }; module.exports = steamerConfig; @@ -102,3 +114,7 @@ steamer --install 进行项目的node_modules包安装和package.json配置 steamer --get [steamer-react|steamer-gulp|steamer-koa] --name [localname] 安装steamer体系内的构建 + +暂时不提供对个别项目的特殊命令,以及单独项目的dev或pub,因为你可以随时到项目里面单独通过命令行去实现 + + diff --git a/libs/SteamerGet.js b/libs/SteamerGet.js index e1960b5..29f2e48 100644 --- a/libs/SteamerGet.js +++ b/libs/SteamerGet.js @@ -8,13 +8,14 @@ const fs = require('fs'), argv = require('yargs').argv, exec = require('child_process').exec, - execSync = require('child_process').execSync, + _ = require('lodash'), Logger = require('./SteamerLogger'), Warning = require('./SteamerErrWarning'), path = require('path'), - repos = require('./SteamerRepos'), Install = require('./SteamerInstall'); +var repos = require('./SteamerRepos'); + function updateConfig(repo, localName) { let config = require(path.resolve('steamer.config.js')), @@ -35,6 +36,12 @@ module.exports = function(steamerConfig) { localName = argv.name || argv.get; localName = localName.replace('\\', '').replace('./', '').replace('.', ''); + console.log(steamerConfig.hasOwnProperty('repos')); + + if (steamerConfig.hasOwnProperty('repos')) { + repos = _.merge(repos, steamerConfig.repos); + } + if (!repos.hasOwnProperty(repo)) { throw new Warning.HasNoRepo(repo); }