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

create-ab

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-ab - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

my-app/index.js

47

index.js
#!/usr/bin/env node
console.log('this is a mini create cli');
const minimist = require('minimist');
const fse = require('fs-extra');
const path = require('path');
const prompts = require('prompts');
const argv = minimist(process.argv.slice(2));
async function init() {
const { template, name } = argv;
const result = await prompts([
{
type: name ? null : 'text',
name: 'name',
message: 'please input your project name',
},
{
type: template ? null : 'select',
name: 'template',
message: 'please select a template',
choices: [
{
title: 'templateA',
value: 'a',
},
{
title: 'templateB',
value: 'b',
},
],
},
]);
const templateName = template || result.template;
const projectName = name || result.name;
const targetDir = path.resolve(process.cwd(), projectName);
const templateDir = path.resolve(__dirname, `template-${templateName}`);
fse.copySync(templateDir, targetDir);
let pkg = JSON.parse(fse.readFileSync(path.resolve(targetDir, 'package.json'), 'utf-8'));
pkg.name = projectName;
fse.writeFileSync(path.resolve(targetDir, 'package.json'), JSON.stringify(pkg, null, 2));
}
init();

9

package.json
{
"name": "create-ab",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -14,3 +14,8 @@ "main": "index.js",

"author": "xiaoyao",
"license": "ISC"
"license": "ISC",
"dependencies": {
"fs-extra": "^11.1.1",
"minimist": "^1.2.8",
"prompts": "^2.4.2"
}
}
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