Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2 from Caleydo/use-version-range
Browse files Browse the repository at this point in the history
Use version range
  • Loading branch information
Holger Stitz authored Aug 14, 2019
2 parents 6593be4 + 393763b commit 4717898
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,19 @@ function createQuietTerminalAdapter() {
* runs yo internally
* @param generator
* @param options
* @param cwd
* @param {string} cwd
* @param {string[]|string} args
*/
function yo(generator, options, cwd) {
function yo(generator, options, cwd, args) {
const yeoman = require('yeoman-environment');
// call yo internally
const yeomanEnv = yeoman.createEnv([], {cwd, env}, quiet ? createQuietTerminalAdapter() : undefined);
yeomanEnv.register(require.resolve('generator-phovea/generators/' + generator), 'phovea:' + generator);
const _args = Array.isArray(args) ? args.join(' ') : args || '';
return new Promise((resolve, reject) => {
try {
console.log(cwd, chalk.blue('running yo phovea:' + generator));
yeomanEnv.run('phovea:' + generator, options, resolve);
yeomanEnv.run(`phovea:${generator} ${_args}`, options, resolve);
} catch (e) {
console.error('error', e, e.stack);
reject(e);
Expand All @@ -213,8 +215,12 @@ function cloneRepo(p, cwd) {
p.name = p.name || fromRepoUrl(p.repo);
p.repo = p.repo || `phovea/${p.name}`;
p.branch = p.branch || 'master';
console.log(cwd, chalk.blue(`running git clone --depth 1 -b ${p.branch} ${toRepoUrl(p.repo)} ${p.name}`));
return spawn('git', ['clone', '--depth', '1', '-b', p.branch, toRepoUrlWithUser(p.repo), p.name], {cwd});
return yo('clone-repo', {
branch: p.branch,
extras: '--depth 1',
dir: p.name,
cwd
}, cwd, toRepoUrlWithUser(p.repo)); // pass repo url as argument
}

function resolvePluginType(p, dir) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"bluebird": "3.4.6",
"chalk": "1.1.3",
"fs-extra": "^1.0.0",
"generator-phovea": "github:phovea/generator-phovea",
"generator-phovea": "github:phovea/generator-phovea#develop",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"yamljs": "0.2.8",
Expand Down
2 changes: 1 addition & 1 deletion phovea_product.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"name": "phovea_clue",
"repo": "phovea/phovea_clue",
"branch": "v2.0.1"
"branch": "^v2.0.0"
}
],
"data": [
Expand Down

0 comments on commit 4717898

Please sign in to comment.