etranzact-fe-cli 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,13 +3,12 @@
3
3
 
4
4
  ```bash
5
5
  pnpm add etranzact-fe-cli -g
6
+ npm add etranzact-fe-cli -g
6
7
  ```
7
8
 
8
9
  ## Usage
9
10
 
10
11
  ```bash
11
- npx etz-cli new [project-name]
12
+ npx etranzact new [project-name]
12
13
  ```
13
14
 
14
- <!-- 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 -->
15
- <!-- git remote set-url origin https://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@github.com/olayinkaa/etz-cli.git -->
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var O=Object.create;var g=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var R=(e,t,s,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of D(t))!U.call(e,n)&&n!==s&&g(e,n,{get:()=>t[n],enumerable:!(d=L(t,n))||d.enumerable});return e};var r=(e,t,s)=>(s=e!=null?O(_(e)):{},R(t||!e||!e.__esModule?g(s,"default",{value:e,enumerable:!0}):s,e));var A=require("commander");var k=require("commander"),o=r(require("chalk"),1),l=r(require("fs-extra"),1),E=r(require("path"),1),b=require("simple-git"),S=r(require("ora"),1),j=r(require("inquirer"),1),c=require("execa");var m="https://github.com/olayinkaa/nextjs-starter-template-etz.git",h="https://github.com/MUKE-coder/nodejs-typescript-starter-template.git";function x(e){switch(e){case"next":return{repoUrl:m,label:"Next.js"};case"ts-start":return{repoUrl:m,label:"Tanstack Start"};case"express":return{repoUrl:h,label:"Express"};default:throw new Error("Invalid template selected.")}}var i=r(require("fs-extra"),1),a=r(require("path"),1);var w=`
2
+ "use strict";var L=Object.create;var f=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var P=(e,t,s,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!R.call(e,n)&&n!==s&&f(e,n,{get:()=>t[n],enumerable:!(m=v(t,n))||m.enumerable});return e};var r=(e,t,s)=>(s=e!=null?L(U(e)):{},P(t||!e||!e.__esModule?f(s,"default",{value:e,enumerable:!0}):s,e));var I=require("commander");var y=require("commander"),o=r(require("chalk"),1),p=r(require("fs-extra"),1),k=r(require("path"),1),_=require("simple-git"),N=r(require("ora"),1),S=r(require("inquirer"),1),c=require("execa");var g="https://github.com/olayinkaa/nextjs-starter-template-etz.git",h="https://github.com/olayinkaa/next.js_marketing_website_starter_template.git",T="https://github.com/MUKE-coder/nodejs-typescript-starter-template.git",x="https://github.com/MUKE-coder/tanstack-start-admin-dashboard-template.git";function w(e){switch(e){case"next-admin":return{repoUrl:g,label:"Next.js Admin Dashboard"};case"next-website":return{repoUrl:h,label:"Next.js Marketing Website"};case"ts-start-admin":return{repoUrl:x,label:"Tanstack Start Admin Dashboard"};case"express":return{repoUrl:T,label:"Express"};default:throw new Error("Invalid template selected.")}}var i=r(require("fs-extra"),1),a=r(require("path"),1);var A=`
3
3
  import type { SessionOptions } from "iron-session";
4
4
  export interface IronSessionData {
5
5
  user?:
@@ -36,7 +36,7 @@ export const sessionOptions: SessionOptions = {
36
36
  maxAge: 7 * 24 * 60 * 60, // 7 days
37
37
  },
38
38
  };
39
- `,T=`
39
+ `,E=`
40
40
  import { jwtDecode } from "jwt-decode";
41
41
  export interface IDecodedToken {
42
42
  id: number;
@@ -100,6 +100,6 @@ export function formatLastLoginISO(lastLogin: string | undefined) {
100
100
  hour12: false,
101
101
  });
102
102
  }
103
- `;async function y(e,t){let s=a.default.join(e,"src","lib");switch(await i.default.ensureDir(s),t){case"iron-session":await i.default.writeFile(a.default.join(s,"session.ts"),w,"utf-8"),await i.default.writeFile(a.default.join(s,"auth-util.ts"),T,"utf-8");break;case"jose":await i.default.writeFile(a.default.join(s,"auth.ts"),"","utf-8");break;case"next-auth":await i.default.writeFile(a.default.join(s,"auth.ts"),"","utf-8");break;default:throw new Error("Unsupported auth library")}}var N=new k.Command("new");N.argument("<project-name>","name of the project").action(async e=>{let t=E.default.join(process.cwd(),e);try{l.default.existsSync(t)&&(console.error(o.default.red(`Directory ${e} already exists.`)),process.exit(1));let s=await j.default.prompt([{type:"rawlist",name:"template",message:"Which template would you like to use?",choices:[{name:"Next.js",value:"next"},{name:"Tanstack Start",value:"ts-start"},{name:"Node.js Express",value:"express"}],default:"next"},{type:"rawlist",name:"auth",message:"Select an authentication library:",choices:[{name:"iron-session",value:"iron-session"},{name:"jose",value:"jose"},{name:"next-auth",value:"next-auth"},{name:"none",value:"none"}],when:I=>!["express"].includes(I.template),default:"iron-session"}]),{template:d,auth:n}=s,{repoUrl:C,label:f}=x(d);l.default.mkdirSync(t);let p=(0,S.default)(`Downloading ${f} template...`).start();await(0,b.simpleGit)().clone(C,t),p.succeed(`${f} template downloaded!`),process.chdir(t),n&&n!=="none"&&(p.start(`Configuring ${n}...`),await y(t,n),p.succeed(`${n} configured!`)),p.start("Installing dependencies..."),n==="iron-session"?await(0,c.execa)("pnpm",["add","iron-session"],{stdio:"inherit"}):n==="jose"?await(0,c.execa)("pnpm",["add","jose"],{stdio:"inherit"}):n==="next-auth"&&await(0,c.execa)("pnpm",["add","next-auth"],{stdio:"inherit"}),await(0,c.execa)("pnpm",["add","jwt-decode"],{stdio:"inherit"}),await(0,c.execa)("pnpm",["install"],{stdio:"inherit"}),p.succeed("Dependencies installed!"),console.log(o.default.green(`
103
+ `;async function b(e,t){let s=a.default.join(e,"src","lib");switch(await i.default.ensureDir(s),t){case"iron-session":await i.default.writeFile(a.default.join(s,"session.ts"),A,"utf-8"),await i.default.writeFile(a.default.join(s,"auth-util.ts"),E,"utf-8");break;case"jose":await i.default.writeFile(a.default.join(s,"auth.ts"),"","utf-8");break;case"next-auth":await i.default.writeFile(a.default.join(s,"auth.ts"),"","utf-8");break;default:throw new Error("Unsupported auth library")}}var D=new y.Command("new");D.argument("<project-name>","name of the project").action(async e=>{let t=k.default.join(process.cwd(),e);try{p.default.existsSync(t)&&(console.error(o.default.red(`Directory ${e} already exists.`)),process.exit(1));let s=await S.default.prompt([{type:"rawlist",name:"template",message:"Which template would you like to use?",choices:[{name:"Next.js Admin Dashboard",value:"next-admin"},{name:"Next.js - Marketing Website",value:"next-website"},{name:"Tanstack Start Admin Dashboard",value:"ts-start-admin"},{name:"Node.js Express",value:"express"}],default:"next-admin"},{type:"rawlist",name:"auth",message:"Select an authentication library:",choices:[{name:"iron-session",value:"iron-session"},{name:"jose",value:"jose"},{name:"next-auth",value:"next-auth"},{name:"none",value:"none"}],when:C=>!["express","next-website"].includes(C.template),default:"iron-session"}]),{template:m,auth:n}=s,{repoUrl:O,label:u}=w(m);p.default.mkdirSync(t);let d=(0,N.default)(`Downloading ${u} template...`).start();await(0,_.simpleGit)().clone(O,t),d.succeed(`${u} template downloaded!`),process.chdir(t),n&&n!=="none"&&(d.start(`Configuring ${n}...`),await b(t,n),d.succeed(`${n} configured!`)),d.start("Installing dependencies..."),n==="iron-session"?await(0,c.execa)("pnpm",["add","iron-session"],{stdio:"inherit"}):n==="jose"?await(0,c.execa)("pnpm",["add","jose"],{stdio:"inherit"}):n==="next-auth"&&await(0,c.execa)("pnpm",["add","next-auth"],{stdio:"inherit"}),await(0,c.execa)("pnpm",["add","jwt-decode"],{stdio:"inherit"}),await(0,c.execa)("pnpm",["install"],{stdio:"inherit"}),d.succeed("Dependencies installed!"),console.log(o.default.green(`
104
104
  Project ${e} is ready! \u{1F680}`)),console.log(o.default.cyan(`cd ${e}`)),console.log(o.default.cyan("pnpm dev"))}catch(s){console.error(o.default.red(`
105
- An error occurred during project setup:`)),console.error(o.default.red(s.message||s)),process.exit(1)}});var v=N;var u=new A.Command;u.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");u.addCommand(v);u.parse(process.argv);
105
+ An error occurred during project setup:`)),console.error(o.default.red(s.message||s)),process.exit(1)}});var j=D;var l=new I.Command;l.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");l.addCommand(j);l.parse(process.argv);
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{Command as A}from"commander";import{Command as b}from"commander";import r from"chalk";import x from"fs-extra";import S from"path";import{simpleGit as j}from"simple-git";import N from"ora";import v from"inquirer";import{execa as c}from"execa";var p="https://github.com/olayinkaa/nextjs-starter-template-etz.git",l="https://github.com/MUKE-coder/nodejs-typescript-starter-template.git";function u(t){switch(t){case"next":return{repoUrl:p,label:"Next.js"};case"ts-start":return{repoUrl:p,label:"Tanstack Start"};case"express":return{repoUrl:l,label:"Express"};default:throw new Error("Invalid template selected.")}}import i from"fs-extra";import a from"path";var f=`
2
+ import{Command as I}from"commander";import{Command as _}from"commander";import r from"chalk";import w from"fs-extra";import N from"path";import{simpleGit as S}from"simple-git";import D from"ora";import j from"inquirer";import{execa as c}from"execa";var p="https://github.com/olayinkaa/nextjs-starter-template-etz.git",l="https://github.com/olayinkaa/next.js_marketing_website_starter_template.git",u="https://github.com/MUKE-coder/nodejs-typescript-starter-template.git",f="https://github.com/MUKE-coder/tanstack-start-admin-dashboard-template.git";function g(t){switch(t){case"next-admin":return{repoUrl:p,label:"Next.js Admin Dashboard"};case"next-website":return{repoUrl:l,label:"Next.js Marketing Website"};case"ts-start-admin":return{repoUrl:f,label:"Tanstack Start Admin Dashboard"};case"express":return{repoUrl:u,label:"Express"};default:throw new Error("Invalid template selected.")}}import i from"fs-extra";import a from"path";var h=`
3
3
  import type { SessionOptions } from "iron-session";
4
4
  export interface IronSessionData {
5
5
  user?:
@@ -36,7 +36,7 @@ export const sessionOptions: SessionOptions = {
36
36
  maxAge: 7 * 24 * 60 * 60, // 7 days
37
37
  },
38
38
  };
39
- `,g=`
39
+ `,T=`
40
40
  import { jwtDecode } from "jwt-decode";
41
41
  export interface IDecodedToken {
42
42
  id: number;
@@ -100,6 +100,6 @@ export function formatLastLoginISO(lastLogin: string | undefined) {
100
100
  hour12: false,
101
101
  });
102
102
  }
103
- `;async function h(t,n){let e=a.join(t,"src","lib");switch(await i.ensureDir(e),n){case"iron-session":await i.writeFile(a.join(e,"session.ts"),f,"utf-8"),await i.writeFile(a.join(e,"auth-util.ts"),g,"utf-8");break;case"jose":await i.writeFile(a.join(e,"auth.ts"),"","utf-8");break;case"next-auth":await i.writeFile(a.join(e,"auth.ts"),"","utf-8");break;default:throw new Error("Unsupported auth library")}}var w=new b("new");w.argument("<project-name>","name of the project").action(async t=>{let n=S.join(process.cwd(),t);try{x.existsSync(n)&&(console.error(r.red(`Directory ${t} already exists.`)),process.exit(1));let e=await v.prompt([{type:"rawlist",name:"template",message:"Which template would you like to use?",choices:[{name:"Next.js",value:"next"},{name:"Tanstack Start",value:"ts-start"},{name:"Node.js Express",value:"express"}],default:"next"},{type:"rawlist",name:"auth",message:"Select an authentication library:",choices:[{name:"iron-session",value:"iron-session"},{name:"jose",value:"jose"},{name:"next-auth",value:"next-auth"},{name:"none",value:"none"}],when:E=>!["express"].includes(E.template),default:"iron-session"}]),{template:y,auth:s}=e,{repoUrl:k,label:m}=u(y);x.mkdirSync(n);let o=N(`Downloading ${m} template...`).start();await j().clone(k,n),o.succeed(`${m} template downloaded!`),process.chdir(n),s&&s!=="none"&&(o.start(`Configuring ${s}...`),await h(n,s),o.succeed(`${s} configured!`)),o.start("Installing dependencies..."),s==="iron-session"?await c("pnpm",["add","iron-session"],{stdio:"inherit"}):s==="jose"?await c("pnpm",["add","jose"],{stdio:"inherit"}):s==="next-auth"&&await c("pnpm",["add","next-auth"],{stdio:"inherit"}),await c("pnpm",["add","jwt-decode"],{stdio:"inherit"}),await c("pnpm",["install"],{stdio:"inherit"}),o.succeed("Dependencies installed!"),console.log(r.green(`
103
+ `;async function x(t,n){let e=a.join(t,"src","lib");switch(await i.ensureDir(e),n){case"iron-session":await i.writeFile(a.join(e,"session.ts"),h,"utf-8"),await i.writeFile(a.join(e,"auth-util.ts"),T,"utf-8");break;case"jose":await i.writeFile(a.join(e,"auth.ts"),"","utf-8");break;case"next-auth":await i.writeFile(a.join(e,"auth.ts"),"","utf-8");break;default:throw new Error("Unsupported auth library")}}var A=new _("new");A.argument("<project-name>","name of the project").action(async t=>{let n=N.join(process.cwd(),t);try{w.existsSync(n)&&(console.error(r.red(`Directory ${t} already exists.`)),process.exit(1));let e=await j.prompt([{type:"rawlist",name:"template",message:"Which template would you like to use?",choices:[{name:"Next.js Admin Dashboard",value:"next-admin"},{name:"Next.js - Marketing Website",value:"next-website"},{name:"Tanstack Start Admin Dashboard",value:"ts-start-admin"},{name:"Node.js Express",value:"express"}],default:"next-admin"},{type:"rawlist",name:"auth",message:"Select an authentication library:",choices:[{name:"iron-session",value:"iron-session"},{name:"jose",value:"jose"},{name:"next-auth",value:"next-auth"},{name:"none",value:"none"}],when:k=>!["express","next-website"].includes(k.template),default:"iron-session"}]),{template:b,auth:s}=e,{repoUrl:y,label:m}=g(b);w.mkdirSync(n);let o=D(`Downloading ${m} template...`).start();await S().clone(y,n),o.succeed(`${m} template downloaded!`),process.chdir(n),s&&s!=="none"&&(o.start(`Configuring ${s}...`),await x(n,s),o.succeed(`${s} configured!`)),o.start("Installing dependencies..."),s==="iron-session"?await c("pnpm",["add","iron-session"],{stdio:"inherit"}):s==="jose"?await c("pnpm",["add","jose"],{stdio:"inherit"}):s==="next-auth"&&await c("pnpm",["add","next-auth"],{stdio:"inherit"}),await c("pnpm",["add","jwt-decode"],{stdio:"inherit"}),await c("pnpm",["install"],{stdio:"inherit"}),o.succeed("Dependencies installed!"),console.log(r.green(`
104
104
  Project ${t} is ready! \u{1F680}`)),console.log(r.cyan(`cd ${t}`)),console.log(r.cyan("pnpm dev"))}catch(e){console.error(r.red(`
105
- An error occurred during project setup:`)),console.error(r.red(e.message||e)),process.exit(1)}});var T=w;var d=new A;d.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");d.addCommand(T);d.parse(process.argv);
105
+ An error occurred during project setup:`)),console.error(r.red(e.message||e)),process.exit(1)}});var E=A;var d=new I;d.name("etranzact").description("A powerful cli to scaffold new etranzact project").version("1.0.0");d.addCommand(E);d.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etranzact-fe-cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "private": false,
5
5
  "description": "Etranzact Cli for scaffolding new frontend project",
6
6
  "type": "module",