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 +2 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
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
|
|
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
|
|
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
|
-
`,
|
|
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
|
|
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
|
|
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
|
|
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
|
-
`,
|
|
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
|
|
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
|
|
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);
|