Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

insj

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insj - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

7

index.js

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

const { initialPrompt } = require('./lib/initial-prompt');
const { addTemplate } = require('./lib/add-template.js');
const { addTemplate, addTemplateAfter } = require('./lib/add-template.js');

@@ -68,3 +68,3 @@ opts

try {
const { pathToDestination, pathToRepo } = await initialPrompt(opts, choices);
const { pathToDestination, pathToRepo, isNewRepo } = await initialPrompt(opts, choices);
throwIfNotClean(ROOT_PATH, pathToDestination, opts);

@@ -78,2 +78,5 @@ await deleteTemp(TEMP_PATH);

await runPostInstall(templateCfg, path.resolve(ROOT_PATH, pathToDestination));
if (isNewRepo) {
await addTemplateAfter(pathToRepo, config, path.resolve(__dirname, 'config.json'));
}
console.log('\nGo to your project by running');

@@ -80,0 +83,0 @@ console.log(chalk.cyan(`\n\tcd ${pathToDestination}\t`));

@@ -86,4 +86,58 @@ const inquirer = require('inquirer');

async function addTemplateAfter(repo, config, path) {
const shouldAdd = await inquirer
.prompt([
{
name: 'shouldAdd',
message: 'Do you want to add this repo as a template for later use?',
type: 'confirm',
},
])
.then(res => res.shouldAdd);
if (!shouldAdd) {
return;
}
const newRepo = {
value: repo,
};
newRepo.name = await retryablePrompt(
[
{
name: 'value',
message: 'Enter a name for the template:',
type: 'input',
},
],
'\n',
chalk.yellow('Warning:'),
'Name cannot be empty.',
);
newRepo.isDefault = await inquirer
.prompt([
{
name: 'isDefault',
message: 'Set as default template?',
type: 'confirm',
},
])
.then(res => res.isDefault);
if (newRepo.isDefault) {
const newTemplates = config.templates
.slice()
.map(template => Object.assign(template, { isDefault: false }));
newTemplates.push(newRepo);
await writeNewTemplates(newRepo.name, newTemplates, config, path);
} else {
const newTemplates = config.templates.slice();
newTemplates.push(newRepo);
await writeNewTemplates(newRepo.name, newTemplates, config, path);
}
}
module.exports = {
addTemplate,
addTemplateAfter,
};

@@ -8,2 +8,3 @@ const inquirer = require('inquirer');

let pathToDestination = opts.dest;
let isNewRepo = false;
const templates = choices.filter(choice => choice.value !== 'custom');

@@ -27,2 +28,3 @@

if (pathToRepo === 'custom') {
isNewRepo = true;
console.log();

@@ -71,3 +73,3 @@ pathToRepo = await retryablePrompt(

}
return { pathToRepo, pathToDestination };
return { pathToRepo, pathToDestination, isNewRepo };
}

@@ -74,0 +76,0 @@

{
"name": "insj",
"version": "0.1.4",
"version": "0.1.5",
"description": "A no excuses project scaffolding tool",

@@ -5,0 +5,0 @@ "main": "index.js",

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