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.29 to 0.0.30

10

dist/cli.js
#!/usr/bin/env node
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!")}
import x from"tiged";import{program as p}from"commander";import{resolve as f}from"path";import E from"path";import i from"chalk";import{existsSync as C,mkdirSync as D,lstatSync as O,readdirSync as N,readFileSync as P,writeFileSync as _}from"fs";import{input as a,select as A}from"@inquirer/prompts";import{execSync as L}from"child_process";p.description("Create a new Enpage template").argument("[directory]","Directory to create the template in",".").option("-t, --template <template>","Template to clone","enpage/enpage/packages/template-example").option("--ref","Specific ref to clone. It can be a branch, tag or commit hash").action(async e=>{let t=p.opts(),o=f(process.cwd(),e);C(o)?O(o).isDirectory()?R(o)||(console.log(i.red(`Directory ${o} is not empty. Aborting.`)),process.exit(1)):(console.log(i.red(`${o} exists but is not a directory. Aborting.`)),process.exit(1)):(process.stdout.write(`Creating directory ${o}... `),D(o,{recursive:!0}),console.log(i.cyan("OK"))),process.stdout.write("Cloning template example... ");let l=U(t.template,t.ref);await x(l,{verbose:!0,mode:"git",disableCache:!0}).clone(o),console.log(i.cyan("OK")),console.log(""),console.log("Let's set up your new template:");let h=await a({message:"Name your template",validate(n){return n.length>0?!0:"Name cannot be empty"}}),g=await a({message:"Enter a template description",validate(n){return n.length>0?!0:"Description cannot be empty"}}),v=await a({message:"Enter the author's name",validate(n){return n.length>0?!0:"Author name cannot be empty"}}),c=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)"}]});c==="public"&&console.log(` > You will need to publish your template to make it available on Enpage.
`);let b=await a({message:"Enter tags for the template (optional, comma separated)"}),m=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=b.split(",").map(n=>n.trim()).filter(n=>n.length>0),u=f(o,"package.json"),r=JSON.parse(P(u,"utf-8"));if(j(l)){let n=t.ref&&I(t.ref)?`0.0.0-snapshot-${t.ref}`:void 0;for(let s of["dependencies","devDependencies","peerDependencies","optionalDependencies"])if(r[s])for(let[S,$]of Object.entries(r[s]))$.startsWith("workspace:")&&(r[s][S]=n??"latest");delete r.scripts.lint,delete r.scripts["ci:lint"]}Object.assign(r,{name:`enpage-template-${E.basename(o)}`,author:v,description:g,keywords:[...new Set([...r.keywords,...w])],license:"UNLICENSED",homepage:m.length>0?m:void 0,private:c==="private",enpage:{name:h,description:g,private:c==="private"}}),process.stdout.write("Writing package.json... "),_(u,JSON.stringify(r,null,2)),console.log(i.cyan("OK")),console.log("Installing dependencies... ");let d=y(),k=T(d);L(`${d} install`,{cwd:o,stdio:"inherit"}),console.log(`
${i.cyan("All done!")}
`),console.log(`You can now develop your template:
`),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}
`),console.log(i.cyan(` cd ${e}`)),console.log(i.cyan(` ${k} dev
`)),process.exit(0)});p.parse();function R(e){return N(e).length===0}function y(){let e;if(process.env.npm_config_user_agent){let t=process.env.npm_config_user_agent.split(" ")[0];e=t.slice(0,t.lastIndexOf("/"))}return e||(e="npm"),e}function T(e){let t=e??y();return t==="npm"?`${t} run`:t}function U(e,t){return e.includes("/")===!1&&(e=`enpage/template-${e}`),t?`${e}#${t}`:e}function j(e){return e.startsWith("enpage/")}function I(e){return/^[0-9a-f]{40}$/.test(e)}
{
"name": "create-enpage",
"version": "0.0.29",
"version": "0.0.30",
"description": "A CLI for creating Enpage templates.",

@@ -20,3 +20,3 @@ "type": "module",

"commander": "12.1.0",
"degit": "2.8.4"
"tiged": "3.0.0-rc.0"
},

@@ -30,5 +30,5 @@ "devDependencies": {

"build": "tsup",
"lint": "biome check .",
"ci:lint": "biome check ."
"lint": "biome check --write . && tsc --noEmit",
"ci:lint": "tsc --noEmit"
}
}
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