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.17 to 0.0.18

10

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

2

package.json
{
"name": "create-enpage",
"version": "0.0.17",
"version": "0.0.18",
"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