Socket
Socket
Sign inDemoInstall

@stormid/scaffold-cli

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stormid/scaffold-cli - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

23

lib/commands/index.js

@@ -1,2 +0,2 @@

const { info, warn, error, isDir, install, initGit } = require('../utils');
const { info, warn, error, isDir, install, initGit, npmCheck } = require('../utils');
const { resolve } = require('path');

@@ -9,2 +9,3 @@ const figlet = require('figlet');

const REPO = 'stormid/scaffold';
const UMBRACO_LIBRARY = '@stormid/umbraco-library';

@@ -45,2 +46,13 @@ module.exports = async function(dest, argv) {

});
if (argv['umbraco']) {
if (argv['umbraco'] === true) info(`-> Adding Umbraco Library`);
else {
const packageExists = await npmCheck('@stormid/umbraco-library', argv['umbraco']);
if (packageExists) info(`-> Adding Umbraco Library version ${argv['umbraco']}`);
else {
return error(`-> Cannot find Umbraco Library version '${argv['umbraco']}'`);
}
}
}

@@ -65,2 +77,3 @@ info('-> Creating project');

pkgData.version = "0.1.0";
if (argv['umbraco']) pkgData.dependencies = Object.assign({}, pkgData.dependencies, { UMBRACO_LIBRARY: argv['umbraco'] === true ? "latest" : argv['umbraco'] });
await fs.writeFile(pkgFile, JSON.stringify(pkgData, null, 2));

@@ -75,2 +88,10 @@ } else {

}
if (argv['umbraco']) {
try {
fs.copySync(`${target}/node_modules/${UMBRACO_LIBRARY}/src/css/import-template/index.scss`, `${target}/src/css/index.scss`);
} catch(err){
warn(err);
}
}

@@ -77,0 +98,0 @@ // await initGit(target);

@@ -30,3 +30,4 @@ #!/usr/bin/env node

.option('-v, --verbose', 'Verbose output')
.option('--umbraco', 'Include the Umbraco library')
.action(require('./commands'))
.parse(process.argv);

@@ -5,2 +5,5 @@ const { blue, yellow, red } = require('kleur');

const spawn = require('cross-spawn-promise');
const npmName = require('npm-name');
const fetch = require('node-fetch');
const hasCommand = function(str) {

@@ -77,2 +80,18 @@ return !!which.sync(str, { nothrow: true });

}
};
};
exports.npmCheck = (module, version) =>
new Promise((resolve, reject) => {
return npmName(module)
.then(isNoValid => {
if (isNoValid)
throw new Error(`Error > Cannot find ${module} in the NPM registry`)
fetch(`http://registry.npmjs.org/${module}`)
.then(res => res.json())
.then(body => {
return resolve({}.hasOwnProperty.call(body.time, version))
})
})
.catch(err => reject(err.message))
})

7

package.json
{
"name": "@stormid/scaffold-cli",
"version": "0.1.2",
"version": "0.2.0",
"description": "Start a new project using the StormId scaffold",

@@ -26,5 +26,2 @@ "author": "stormid",

],
"devDependencies": {
"jest": "^24.8.0"
},
"dependencies": {

@@ -37,2 +34,4 @@ "cli-table": "^0.3.1",

"kleur": "^3.0.3",
"node-fetch": "^2.6.7",
"npm-name": "^6.0.1",
"ora": "^3.4.0",

@@ -39,0 +38,0 @@ "sade": "^1.6.1",

@@ -19,5 +19,6 @@ # Scaffold CLI

--name The application name.
--cwd A directory to use instead of $PWD.
--install Installs dependencies. [boolean] [default: true]
--name The application name.
--umbraco <version> Install the @stormid/umbraco-library [npm version] [default: latest]
--cwd A directory to use instead of $PWD.
--install Installs dependencies. [boolean] [default: true]
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc