New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

create-enpage

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-enpage - npm Package Compare versions

Comparing version 0.0.0-alpha.f61eaf3 to 0.0.0-snapshot-cd47f1d

10

dist/cli.js
#!/usr/bin/env node
import h from"degit";import{program as g}from"commander";import{resolve as i}from"path";import w from"path";import a from"chalk";import{existsSync as v,mkdirSync as b,lstatSync as k,readdirSync as S,readFileSync as x,writeFileSync as E,rmSync as $}from"fs";import{input as r,select as N}from"@inquirer/prompts";import{execSync as O}from"child_process";g.description("Create a new Enpage template").argument("[directory]","Directory to create the template in",".").action(async o=>{let e=i(process.cwd(),o);v(e)?k(e).isDirectory()?A(e)||(console.log(a.red(`Directory ${e} is not empty. Aborting.`)),process.exit(1)):(console.log(a.red(`${e} exists but is not a directory. Aborting.`)),process.exit(1)):(process.stdout.write(`Creating directory ${e}... `),b(e,{recursive:!0}),console.log(a.cyan("OK"))),process.stdout.write("Cloning template example... "),await h("enpage/enpage/packages/template-example",{cache:!1}).clone(e),$(i(e,"CHANGELOG.md")),console.log(a.cyan("OK")),console.log(""),console.log("Let's set up your new template:");let m=await r({message:"Name your template",validate(n){return n.length>0?!0:"Name cannot be empty"}}),u=await r({message:"Enter a template description",validate(n){return n.length>0?!0:"Description cannot be empty"}}),d=await r({message:"Enter the author's name",validate(n){return n.length>0?!0:"Author name cannot be empty"}}),s=await N({message:"Choose the visibility of the template",choices:[{name:"Private",value:"private",description:"For your eyes only"},{name:"Public",value:"public",description:"To be available on Enpage (paid or free users)"}]});s==="public"&&console.log(` > You will need to publish your template to make it available on Enpage.
`);let y=await r({message:"Enter tags for the template (optional, comma separated)"}),c=await r({message:"Enter a homepage URL (optional)",validate(n){if(n.length===0)return!0;try{return new URL(n),!0}catch{}return"Homepage URL must start with https://"}}),f=y.split(",").map(n=>n.trim()).filter(n=>n.length>0),l=i(e,"package.json"),t=JSON.parse(x(l,"utf-8"));t.name=`enpage-template-${w.basename(e)}`,t.author=d,t.keywords=[...new Set([...t.keywords,...f])],t.license="UNLICENSED",t.homepage=c.length>0?c:void 0,t.enpage={name:m,description:u},s==="private"&&(t.enpage.private=!0,t.private=!0),delete t.scripts.lint,delete t.scripts["ci:lint"],process.stdout.write("Writing package.json... "),E(l,JSON.stringify(t,null,2)),console.log(a.cyan("OK")),console.log("Installing dependencies... ");let p=C();O(`${p} install`,{cwd:e,stdio:"inherit"}),console.log(`
${a.cyan("All done!")}
import S from"degit";import{program as u}from"commander";import{resolve as s}from"path";import x from"path";import r from"chalk";import{existsSync as E,mkdirSync as D,lstatSync as $,readdirSync as C,readFileSync as O,writeFileSync as N,rmSync as P}from"fs";import{input as a,select as A}from"@inquirer/prompts";import{execSync as L}from"child_process";u.description("Create a new Enpage template").argument("[directory]","Directory to create the template in",".").action(async o=>{let e=s(process.cwd(),o);E(e)?$(e).isDirectory()?_(e)||(console.log(r.red(`Directory ${e} is not empty. Aborting.`)),process.exit(1)):(console.log(r.red(`${e} exists but is not a directory. Aborting.`)),process.exit(1)):(process.stdout.write(`Creating directory ${e}... `),D(e,{recursive:!0}),console.log(r.cyan("OK"))),process.stdout.write("Cloning template example... "),await S("enpage/enpage/packages/template-example",{cache:!1}).clone(e),P(s(e,"CHANGELOG.md")),console.log(r.cyan("OK")),console.log(""),console.log("Let's set up your new template:");let y=await a({message:"Name your template",validate(n){return n.length>0?!0:"Name cannot be empty"}}),f=await a({message:"Enter a template description",validate(n){return n.length>0?!0:"Description cannot be empty"}}),h=await a({message:"Enter the author's name",validate(n){return n.length>0?!0:"Author name cannot be empty"}}),i=await A({message:"Choose the visibility of the template",choices:[{name:"Private",value:"private",description:"For your eyes only"},{name:"Public",value:"public",description:"To be available on Enpage (paid or free users)"}]});i==="public"&&console.log(` > You will need to publish your template to make it available on Enpage.
`);let v=await a({message:"Enter tags for the template (optional, comma separated)"}),c=await a({message:"Enter a homepage URL (optional)",validate(n){if(n.length===0)return!0;try{return new URL(n),!0}catch{}return"Homepage URL must start with https://"}}),w=v.split(",").map(n=>n.trim()).filter(n=>n.length>0),l=s(e,"package.json"),t=JSON.parse(O(l,"utf-8")),b=t.version.includes("-");for(let n of["dependencies","devDependencies","peerDependencies","optionalDependencies"])if(t[n])for(let[g,m]of Object.entries(t[n]))m.startsWith("workspace:")&&(t[n][g]=b?m:"latest");t.name=`enpage-template-${x.basename(e)}`,t.author=h,t.keywords=[...new Set([...t.keywords,...w])],t.license="UNLICENSED",t.homepage=c.length>0?c:void 0,t.enpage={name:y,description:f},i==="private"&&(t.enpage.private=!0,t.private=!0),delete t.scripts.lint,delete t.scripts["ci:lint"],process.stdout.write("Writing package.json... "),N(l,JSON.stringify(t,null,2)),console.log(r.cyan("OK")),console.log("Installing dependencies... ");let p=d(),k=M(p);L(`${p} install`,{cwd:e,stdio:"inherit"}),console.log(`
${r.cyan("All done!")}
`),console.log(`You can now develop your template:
`),console.log(a.cyan(` cd ${o}`)),console.log(a.cyan(` ${p} start
`)),process.exit(0)});g.parse();function A(o){return S(o).length===0}function C(){let o;if(process.env.npm_config_user_agent){let e=process.env.npm_config_user_agent.split(" ")[0];o=e.slice(0,e.lastIndexOf("/"))}return o||(console.log("Warning: could not detect package manager"),o="npm"),o}
`),console.log(r.cyan(` cd ${o}`)),console.log(r.cyan(` ${k} dev
`)),process.exit(0)});u.parse();function _(o){return C(o).length===0}function d(){let o;if(process.env.npm_config_user_agent){let e=process.env.npm_config_user_agent.split(" ")[0];o=e.slice(0,e.lastIndexOf("/"))}return o||(o="npm"),o}function M(o){let e=o??d();return e==="npm"?`${e} run`:e}
{
"name": "create-enpage",
"version": "0.0.0-alpha.f61eaf3",
"version": "0.0.0-snapshot-cd47f1d",
"description": "A CLI for creating Enpage templates.",

@@ -5,0 +5,0 @@ "type": "module",

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