create-good-defaults
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -1,9 +0,5 @@ | ||
import v from"chalk";import{execSync as W}from"child_process";import m from"inquirer";import P from"ora";import f from"fs-extra";import d from"path";import C from"sort-package-json";var g=()=>{let t=process.env.npm_config_user_agent;return t!=null&&t.startsWith("yarn")?"yarn":t!=null&&t.startsWith("pnpm")?"pnpm":"npm"};import h from"path";import{fileURLToPath as x}from"url";var l=()=>{let t=x(import.meta.url),e=h.dirname(t);return h.join(e,"../")};var J={tsconfig:{files:[{origin:"tsconfig.json",dest:"tsconfig.json"}],scripts:{},deps:{typescript:"^4.8.0"}},"eslint+prettier":{files:[{origin:"eslint.config.json",dest:".eslintrc"},{origin:"prettier.config.json",dest:".prettierrc"}],scripts:{lint:"eslint . --cache --cache-strategy content --ignore-path .gitignore",format:"prettier --write '**/*.{ts,tsx,cjs,mjs,json,md,mdx}'"},deps:{eslint:"^8.23.0",prettier:"^2.7.1","@typescript-eslint/eslint-plugin":"^5.36.0","@typescript-eslint/parser":"^5.36.0","eslint-config-prettier":"^4.2.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^7.0.0"}},gitignore:{files:[{origin:"gitignore",dest:".gitignore"}],scripts:{},deps:{}},vscode:{files:[{origin:"vscode/settings.json",dest:".vscode/settings.json"},{origin:"vscode/extensions.json",dest:".vscode/extensions.json"}],scripts:{},deps:{}},"gh-actions":{files:[{origin:"github/workflows/ci-",dest:".github/workflows/ci.yml"}],scripts:{},deps:{}}},p=t=>{let{files:e,scripts:r,deps:c}=J[t],s=l(),a=d.join(s,"configs");return(k,w,b)=>{e.forEach(i=>{let n=d.resolve(a,i.origin),M=d.resolve(k,i.dest);if(i.origin==="github/workflows/ci-"){let R=g();n=`${n}${R}.yml`}f.copySync(n,M)});let u=d.resolve(k,"package.json"),o=f.readJsonSync(u);b&&(o.scripts||Object.assign(o,{scripts:{}}),Object.entries(r).forEach(([i,n])=>{o.scripts[i]=n})),w&&(o.devDependencies||Object.assign(o,{devDependencies:{}}),Object.entries(c).forEach(([i,n])=>{o.devDependencies[i]=n}));let S=C(o);f.writeJsonSync(u,S,{spaces:2})}},y={tsconfig:p("tsconfig"),"eslint+prettier":p("eslint+prettier"),gitignore:p("gitignore"),vscode:p("vscode"),"gh-actions":p("gh-actions")};import D from"fs-extra";import O from"path";var j=()=>{let t=l(),e=O.join(t,"package.json");return D.readJSONSync(e).version};var _=["tsconfig","eslint+prettier","gitignore","vscode","gh-actions"],$=()=>{console.log(v.cyanBright(` | ||
Good Defaults (v${j()}) | ||
import C from"chalk";import{execSync as D}from"child_process";import f from"inquirer";import j from"ora";import d from"fs-extra";import l from"path";import S from"sort-package-json";var g=()=>{let e=process.env.npm_config_user_agent;return e!=null&&e.startsWith("yarn")?"yarn":e!=null&&e.startsWith("pnpm")?"pnpm":"npm"};import u from"path";import{fileURLToPath as R}from"url";var h=()=>{let e=R(import.meta.url),t=u.dirname(e);return u.join(t,"../")};var x={tsconfig:{files:[{origin:"tsconfig.json",dest:"tsconfig.json"}],scripts:{},deps:{typescript:"^4.8.0"}},"eslint+prettier":{files:[{origin:"eslint.config.json",dest:".eslintrc"},{origin:"prettier.config.json",dest:".prettierrc"}],scripts:{lint:"eslint . --cache --cache-strategy content --ignore-path .gitignore",format:"prettier --write '**/*.{ts,tsx,cjs,mjs,json,md,mdx}'"},deps:{eslint:"^8.23.0",prettier:"^2.7.1","@typescript-eslint/eslint-plugin":"^5.36.0","@typescript-eslint/parser":"^5.36.0","eslint-config-prettier":"^4.2.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-simple-import-sort":"^7.0.0"}},gitignore:{files:[{origin:"gitignore",dest:".gitignore"}],scripts:{},deps:{}},vscode:{files:[{origin:"vscode/settings.json",dest:".vscode/settings.json"},{origin:"vscode/extensions.json",dest:".vscode/extensions.json"}],scripts:{},deps:{}},"gh-actions":{files:[{origin:"github/workflows/ci-",dest:".github/workflows/ci.yml"}],scripts:{},deps:{}}},p=e=>{let{files:t,scripts:c,deps:r}=x[e],s=h(),a=l.join(s,"configs");return(m,P,v)=>{t.forEach(o=>{let n=l.resolve(a,o.origin),w=l.resolve(m,o.dest);if(o.origin==="github/workflows/ci-"){let M=g();n=`${n}${M}.yml`}d.copySync(n,w)});let k=l.resolve(m,"package.json"),i=d.readJsonSync(k);v&&(i.scripts||Object.assign(i,{scripts:{}}),Object.entries(c).forEach(([o,n])=>{i.scripts[o]=n})),P&&(i.devDependencies||Object.assign(i,{devDependencies:{}}),Object.entries(r).forEach(([o,n])=>{i.devDependencies[o]=n}));let b=S(i);d.writeJsonSync(k,b,{spaces:2})}},y={tsconfig:p("tsconfig"),"eslint+prettier":p("eslint+prettier"),gitignore:p("gitignore"),vscode:p("vscode"),"gh-actions":p("gh-actions")};var O=["tsconfig","eslint+prettier","gitignore","vscode","gh-actions"],J=async()=>{let e=await f.prompt({name:"packages",type:"checkbox",message:"What configurations would you like me to setup?",choices:O.map(r=>({name:r,checked:!1}))}),t=await f.prompt({name:"installMode",type:"confirm",message:"Would you like me to install the necessary the dependencies too?",default:!0}),c=await f.prompt({name:"addScripts",type:"confirm",message:"Would you like me to add the necessary scripts too?",default:!0});return{packages:e.packages,installMode:t.installMode,addScripts:c.addScripts}},W=()=>{console.log(C.cyanBright(` | ||
------------- | ||
Let's setup your project with some good defaults. | ||
`))},E=async()=>{let t=await m.prompt({name:"packages",type:"checkbox",message:"What configurations would you like me to setup?",choices:_.map(c=>({name:c,checked:!1}))}),e=await m.prompt({name:"installMode",type:"confirm",message:"Would you like me to install the necessary the dependencies too?",default:!0}),r=await m.prompt({name:"addScripts",type:"confirm",message:"Would you like me to add the necessary scripts too?",default:!0});return{packages:t.packages,installMode:e.installMode,addScripts:r.addScripts}},F=()=>{console.log(v.cyanBright(` | ||
------------- | ||
Thank you for using Good Defaults! | ||
`))},I=async()=>{$();let{packages:t,installMode:e,addScripts:r}=await E(),c=process.cwd();if(console.log(""),t.forEach(s=>{let a=P("Setting up "+s).start();y[s](c,e,r),a.succeed("Setup successful for "+s)}),e){let s=g(),a=P(`Running "${s} install"...`).start();W(`${s} install`,{cwd:c}),a.succeed("Dependencies installed")}F()};I(); | ||
`))},_=async()=>{let{packages:e,installMode:t,addScripts:c}=await J(),r=process.cwd();if(console.log(""),e.forEach(s=>{let a=j("Setting up "+s).start();y[s](r,t,c),a.succeed("Setup successful for "+s)}),t){let s=g(),a=j(`Running "${s} install"...`).start();D(`${s} install`,{cwd:r}),a.succeed("Dependencies installed")}W()};_(); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
{"inputs":{"src/utils/getPkgManager.ts":{"bytes":505,"imports":[]},"src/utils/getRootPath.ts":{"bytes":333,"imports":[]},"src/installers.ts":{"bytes":3796,"imports":[{"path":"src/utils/getPkgManager.ts","kind":"import-statement"},{"path":"src/utils/getRootPath.ts","kind":"import-statement"}]},"src/utils/getVersion.ts":{"bytes":348,"imports":[{"path":"src/utils/getRootPath.ts","kind":"import-statement"}]},"src/index.ts":{"bytes":2328,"imports":[{"path":"src/installers.ts","kind":"import-statement"},{"path":"src/utils/getPkgManager.ts","kind":"import-statement"},{"path":"src/utils/getVersion.ts","kind":"import-statement"}]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":12120},"dist/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1243},"src/installers.ts":{"bytesInOutput":1735},"src/utils/getPkgManager.ts":{"bytesInOutput":139},"src/utils/getRootPath.ts":{"bytesInOutput":131},"src/utils/getVersion.ts":{"bytesInOutput":126}},"bytes":3375}}} | ||
{"inputs":{"src/utils/getPkgManager.ts":{"bytes":505,"imports":[]},"src/utils/getRootPath.ts":{"bytes":333,"imports":[]},"src/installers.ts":{"bytes":3796,"imports":[{"path":"src/utils/getPkgManager.ts","kind":"import-statement"},{"path":"src/utils/getRootPath.ts","kind":"import-statement"}]},"src/index.ts":{"bytes":2336,"imports":[{"path":"src/installers.ts","kind":"import-statement"},{"path":"src/utils/getPkgManager.ts","kind":"import-statement"}]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":11361},"dist/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1104},"src/installers.ts":{"bytesInOutput":1735},"src/utils/getPkgManager.ts":{"bytesInOutput":139},"src/utils/getRootPath.ts":{"bytesInOutput":131}},"bytes":3110}}} |
{ | ||
"name": "create-good-defaults", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "A CLI tool to generate good defaults for your project", | ||
@@ -5,0 +5,0 @@ "author": "Julius Marminge <julius0216@outlook.com> (https://jumr.dev)", |
@@ -8,3 +8,3 @@ import chalk from "chalk"; | ||
import { getUserPkgManager } from "./utils/getPkgManager.js"; | ||
import { getVersion } from "./utils/getVersion.js"; | ||
//import { getVersion } from "./utils/getVersion.js"; | ||
@@ -20,3 +20,3 @@ const packages = [ | ||
const title = () => { | ||
/*const title = () => { | ||
console.log( | ||
@@ -29,3 +29,3 @@ chalk.cyanBright(` | ||
); | ||
}; | ||
};*/ | ||
@@ -79,3 +79,3 @@ interface CliRes { | ||
const main = async () => { | ||
title(); | ||
//title(); | ||
const { packages, installMode, addScripts } = await cli(); | ||
@@ -82,0 +82,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
35012
350