@tochii/build 1.0.11 → 1.1.1

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +7 -7
  2. package/package.json +3 -2
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import"./chunk-2WO5THKI.mjs";import s from"chalk";import f from"fs";import m from"path";import{Command as h}from"commander";import{spawn as b}from"child_process";var a={name:"@tochii/build",version:"1.0.7",description:"Tools for bundling your projects in Node.js",repository:"https://github.com/tochiResources/project/packages/build.git",license:"MIT",bin:{tochibuild:"./dist/cli.mjs"},scripts:{build:"tsup-node",dev:"tsx cli.ts"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0"},devDependencies:{"@types/node":"^22.15.17",tsup:"^8.4.0",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var u={node:"tsup --target=node18.17"},d=s.cyan("tochibuild"),p=new h("tochibuild").name("tochibuild <command>").description("Tools for bundling your projects in Node.js").allowUnknownOption(!0).version(a.version);p.command("node").description("bundle a Node.js project using tsup (https://tsup.egoist.dev)").allowUnknownOption(!0).argument("[args...]","arguments to pass to tsup").action(async e=>y("node",e));p.command("config").description("generate config files for the selected bundler").argument("<bundler>","bundler to generate config for").option("--ext <string>","the file extension to use excluding the file extension (defaults to the common one for the bundler)","").option("-f, --file <string>","the file name to use (defaults to the common one for the bundler)","").option("-o, --overwrite","whether to overwrite the config file if it already exists (defaults to false)",!1).action((e,n)=>x(e,n));p.parseAsync(process.argv);async function y(e,n){return new Promise((r,i)=>{try{console.log(d,`running ${s.magenta(e)}...`),setTimeout(()=>{let o=b("npx",["-y",`${u[e]}`,...n],{stdio:"inherit",shell:!0,cwd:process.cwd(),env:process.env});o.on("exit",c=>{process.exit(c??1)}),process.on("SIGINT",()=>{i(),o.kill("SIGINT")}),process.on("SIGTERM",()=>{i(),o.kill("SIGTERM")}),r()},3e3)}catch(o){i(o)}})}function x(e,n){switch(u[e]){case"tsup --target=node18.17":w(n);break}}function w(e){let n=process.cwd(),r=e.ext||".ts",i=e.file||"tsup.config",o=m.join(n,`${i}${r}`),c=f.existsSync(o);!e?.overwrite&&c&&(console.warn(d,s.yellow("the tsup config file already exists for this project.")),process.exit(1));let l=" ",t="";t+=`import build from '@tochii/build';
2
+ import"./chunk-2WO5THKI.mjs";import s from"chalk";import u from"fs";import m from"path";import{Command as h}from"commander";import{spawn as y}from"child_process";var p={name:"@tochii/build",version:"1.1.0",description:"CLI and utilities for bundling your projects optionally with no config in Node.js with extended features like configuration file generation",repository:"https://github.com/tochiResources/project/packages/build.git",license:"MIT",bin:{tochibuild:"./dist/cli.mjs"},scripts:{dev:"tsx cli.ts"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0"},devDependencies:{"@types/node":"^22.15.17",tsup:"^8.4.0",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var f={node:"tsup --target=node18.17"},b={node:"tsup"},l=s.cyan("tochibuild"),d=new h("tochibuild").name("tochibuild <command>").description("Tools for bundling your projects in Node.js").allowUnknownOption(!0).version(p.version);d.command("node").description("bundle a Node.js project using tsup (https://tsup.egoist.dev)").allowUnknownOption(!0).argument("[args...]","arguments to pass to tsup").action(async e=>w("node",e));d.command("config").description("generate config files for the selected bundler").argument("<bundler>","bundler to generate config for").option("--ext <string>","the file extension to use excluding the file extension (defaults to the common one for the bundler)","").option("-f, --file <string>","the file name to use (defaults to the common one for the bundler)","").option("-o, --overwrite","whether to overwrite the config file if it already exists (defaults to false)",!1).action((e,n)=>x(e,n));d.parseAsync(process.argv);async function w(e,n){return new Promise((r,i)=>{try{console.log(l,`bundling with ${s.magenta(e)}...`),setTimeout(()=>{let t=y("npx",["--yes",`--package=${b[e]}`,"--package=typescript",`${f[e]}`,...n],{stdio:"inherit",shell:!0,cwd:process.cwd(),env:process.env});t.on("exit",c=>{process.exit(c??1)}),process.on("SIGINT",()=>{i(),t.kill("SIGINT")}),process.on("SIGTERM",()=>{i(),t.kill("SIGTERM")}),r()},3e3)}catch(t){i(t)}})}function x(e,n){switch(f[e]){case"tsup --target=node18.17":k(n);break}}function k(e){let n=process.cwd(),r=e.ext||".ts",i=e.file||"tsup.config",t=m.join(n,`${i}${r}`),c=u.existsSync(t);!e?.overwrite&&c&&(console.warn(l,s.yellow("the tsup config file already exists for this project.")),process.exit(1));let a=" ",o="";o+=`import build from '@tochii/build';
3
3
 
4
- `,t+=`export default build.node.defineConfig({
5
- `,t+=`${l}entry: ['index.ts'],
6
- `,t+=`${l}clean: false,
7
- `,t+=`${l}splitting: false,
8
- `,t+=`});
9
- `,f.writeFileSync(o,t),console.log(s.green(d,"the tsup config file has been created at:"),s.gray(o))}
4
+ `,o+=`export default build.node.defineConfig({
5
+ `,o+=`${a}entry: ['index.ts'],
6
+ `,o+=`${a}clean: false,
7
+ `,o+=`${a}splitting: false,
8
+ `,o+=`});
9
+ `,u.writeFileSync(t,o),console.log(s.green(l,"the tsup config file has been created at:"),s.gray(t))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tochii/build",
3
- "version": "1.0.11",
3
+ "version": "1.1.1",
4
4
  "description": "CLI and utilities for bundling your projects optionally with no config in Node.js with extended features like configuration file generation",
5
5
  "repository": "https://github.com/tochiResources/project/packages/build.git",
6
6
  "license": "MIT",
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "chalk": "^5.4.1",
15
- "commander": "^13.1.0"
15
+ "commander": "^13.1.0",
16
+ "tsup": "^8.4.0"
16
17
  },
17
18
  "devDependencies": {
18
19
  "@types/node": "^22.15.17",