You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

create-nucleus-app

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-nucleus-app - npm Package Compare versions

Comparing version

to
0.0.4-alpha.5

14

dist/index.js
#!/usr/bin/env node
import{Command as j}from"commander";import{Command as $}from"commander";import{z as v}from"zod";import s from"chalk";var t={error(...e){console.log(s.red(...e))},warn(...e){console.log(s.yellow(...e))},info(...e){console.log(s.cyan(...e))},success(...e){console.log(s.green(...e))},break(){console.log("")}};function d(e){typeof e=="string"&&(t.error(e),process.exit(1)),e instanceof Error&&(t.error(e.message),process.exit(1)),t.error("Something went wrong. Please try again."),process.exit(1)}import A from"path";import I from"fs-extra";import u from"path";import{fileURLToPath as P}from"url";var S=P(import.meta.url),_=u.dirname(S),c=u.join(_,"..");function p(){let e=A.join(c,"package.json");return I.readJSONSync(e)}var y=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var O=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,h=e=>{let o=y(e),n=o.split("/"),f=n.findIndex(a=>a.startsWith("@")),r=n[n.length-1];return n.findIndex(a=>a.startsWith("@"))!==-1&&(r=n.slice(f).join("/")),o==="."||O.test(r??"")};import w from"path";var b=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};import*as m from"@clack/prompts";import i from"chalk";import D from"ora";import l from"fs-extra";async function x(e){let o=b(),n=w.resolve(process.cwd(),e),f=w.join(c,"template/base");t.info(`
Using: ${i.cyan.bold(o)}
`);let r=D(`Scaffolding in: ${n}...
`).start();if(l.existsSync(n))if(l.readdirSync(n).length===0)e!=="."&&r.info(`${i.cyan.bold(e)} exists but is empty, continuing...
`);else{r.stopAndPersist();let g=await m.select({message:`${i.redBright.bold("Warning:")} ${i.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,options:[{label:"Abort installation (recommended)",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"}],initialValue:"abort"});g==="abort"&&(r.fail("Aborting installation..."),process.exit(1)),await m.confirm({message:"Are you sure you want to clear the directory?",initialValue:!1})||(r.fail("Aborting installation..."),process.exit(1)),g==="clear"&&(r.info(`Emptying ${i.cyan.bold(e)} and creating t3 app..
`),l.emptyDirSync(n))}r.start(),l.copySync(f,n);let a=e==="."?"App":i.cyan.bold(e);r.succeed(`${a} ${i.green("scaffolded successfully!")}
`)}var z=v.object({dir:v.string().refine(h,{message:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"})}),T="my-nucleus-app",k=new $().name("init").description("initialize a new project").argument("[dir]","directory to initialize the project").version(p().version,"-v, --version","Display the version number").action(async e=>{try{let o=z.parse({dir:e||T});t.info("Initializing a new project..."),await x(o.dir)}catch(o){d(o)}});process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function W(){let e=p(),o=new j().name("nucleus").description("cli to manage your scalable projects").version(e.version||"1.0.0","-v, --version","display the version number");o.addCommand(k),o.parse()}W();
import{Command as T}from"commander";import S from"path";import D from"fs-extra";import g from"path";import{fileURLToPath as P}from"url";var _=P(import.meta.url),A=g.dirname(_),c=g.join(A,".."),d="my-nucleus-app";function u(){let e=S.join(c,"package.json");return D.readJSONSync(e)}import{z as v}from"zod";var y=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var I=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,h=e=>{let a=y(e),o=a.split("/"),t=o.findIndex(s=>s.startsWith("@")),r=o[o.length-1];return o.findIndex(s=>s.startsWith("@"))!==-1&&(r=o.slice(t).join("/")),a==="."||I.test(r??"")};import p from"chalk";var n={error(...e){console.log(p.red(...e))},warn(...e){console.log(p.yellow(...e))},info(...e){console.log(p.cyan(...e))},success(...e){console.log(p.green(...e))},break(){console.log("")}};import x from"path";var b=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};import*as m from"@clack/prompts";import i from"chalk";import O from"ora";import l from"fs-extra";async function w(e){let a=b(),o=x.resolve(process.cwd(),e),t=x.join(c,"template/base");n.info(`
Using: ${i.cyan.bold(a)}
`);let r=O(`Scaffolding in: ${o}...
`).start();if(l.existsSync(o))if(l.readdirSync(o).length===0)e!=="."&&r.info(`${i.cyan.bold(e)} exists but is empty, continuing...
`);else{r.stopAndPersist();let f=await m.select({message:`${i.redBright.bold("Warning:")} ${i.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,options:[{label:"Abort installation (recommended)",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"}],initialValue:"abort"});f==="abort"&&(r.fail("Aborting installation..."),process.exit(1)),await m.confirm({message:"Are you sure you want to clear the directory?",initialValue:!1})||(r.fail("Aborting installation..."),process.exit(1)),f==="clear"&&(r.info(`Emptying ${i.cyan.bold(e)} and creating t3 app..
`),l.emptyDirSync(o))}r.start(),l.copySync(t,o);let s=e==="."?"App":i.cyan.bold(e);r.succeed(`${s} ${i.green("scaffolded successfully!")}
`)}function k(e){typeof e=="string"&&(n.error(e),process.exit(1)),e instanceof Error&&(n.error(e.message),process.exit(1)),n.error("Something went wrong. Please try again."),process.exit(1)}process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));var $=v.object({dir:v.string().refine(h,{message:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"})});async function E(){let e=u();new T().name("create-nucleus-app").description("cli to manage your scalable projects").version(e.version||"1.0.0","-v, --version","display the version number").argument("[dir]","directory to initialize the project").action(async o=>{try{let t=$.parse({dir:o||d});n.info("Initializing a new project..."),await w(t.dir)}catch(t){k(t)}}).parse()}E();
{
"name": "create-nucleus-app",
"version": "0.0.4-alpha.4",
"version": "0.0.4-alpha.5",
"description": "",

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