Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
feat: Unicorn list, unicorn sync, add nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Lenzotti committed Jul 20, 2018
1 parent f6516fa commit c2fc1c6
Show file tree
Hide file tree
Showing 17 changed files with 2,955 additions and 2,772 deletions.
24 changes: 24 additions & 0 deletions bin/nsc-nuget.js
@@ -0,0 +1,24 @@
#!/usr/bin/env node
const path = require('path');
const nuget = require('../src/nuget');

const scriptName = path.basename(__filename);

const options = process.argv.reduce((obj, value) => {
if (path.basename(value) === scriptName) {
obj.script = true;
return obj;
}

if (obj.script) {
if (obj.command) {
obj.args.push(value.replace(/^--/, '-'));
} else {
obj.command = value;
}
}

return obj;
}, { command: null, args: [] });

nuget.exec(options.command, ...options.args);
4 changes: 2 additions & 2 deletions bin/nsc-restore.js
@@ -1,5 +1,5 @@
#!/usr/bin/env node
const config = require('@node-sitecore/config');
const nugetRestore = require('../src/nuget-restore');
const nuget = require('../src/nuget');

nugetRestore(config.solutionPath);
nuget.exec('restore', config.solutionPath);
7 changes: 3 additions & 4 deletions bin/nsc-unicorn.js
Expand Up @@ -41,22 +41,22 @@ switch (options.action) {
// config.checkPreconditions();

unicorn
.getConfigurations()
.getConfigurations(config)
.then((configs) => {
runInteractive(configs);
});
break;

case 'list':
unicorn
.getConfigurations()
.getConfigurations(config)
.then((configs) => {
const table = new Table({
head: [ 'Name', 'Descriptions', 'Dependencies' ],
colWidths: [ 40, 50, 50 ]
});

configs = configs.map((conf) => [ conf.name, conf.description || '', conf.dependencies.join(' > ') ]);
configs = configs.map((conf) => [ conf.name, conf.description || '', conf.dependencies.join('\n > ') ]);

table.push(...configs);

Expand All @@ -68,7 +68,6 @@ switch (options.action) {

case 'sync':
// config.checkPreconditions();

unicorn.sync({
siteUrl: config.siteUrl,
authConfigFile: config.authConfigFile,
Expand Down
1 change: 1 addition & 0 deletions bin/nsc.js
Expand Up @@ -10,6 +10,7 @@ commander
.version(pkg.version)
.command('init', 'Init a Sitecore Project')
.command('restore', 'Restore all NuGet Packages')
.command('nuget <action> [options]', 'Nuget commands')
.command('build', 'Build project solution')
.command('publish', 'Publish project solution')
.command('unicorn [action] [configs ...]', 'Perform a Unicorn synchronisation')
Expand Down

0 comments on commit c2fc1c6

Please sign in to comment.