@tochii/build 2.0.0 → 2.0.2

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 +1 -1
  2. package/package.json +16 -7
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as s,c as b}from"./chunk-LBH52VOU.mjs";import y from"chalk";import f from"fs";import u from"path";import{Command as V}from"commander";import{spawn as B}from"child_process";var P={name:"tochibuild",version:"1.2.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:"./dist/cli.mjs",scripts:{dev:"tsx cli.ts",build:"tsx cli.ts --config tochibuild.config.ts --entry index.ts --entry cli.ts --entry utils.ts",publish:"npm publish --access public --no-private"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0",tsup:"^8.4.0"},devDependencies:{"@types/node":"^22.15.17",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var J={node:"tsup --target=node18.17"},M={node:"tsup"},$=u.resolve(process.cwd(),"."),W=$.replace(/\\/g,"/").includes("packages/build"),d=W?void 0:u.join($,"package.json"),F=d?f.existsSync(d):!1,S=d&&F?f.readFileSync(d,"utf-8"):void 0,E=S?JSON.parse(S):void 0;async function N(l){let k=process.cwd(),A=[u.join(k,"tochibuild.config.ts"),...[".ts",".js",".cjs",".json"].map(e=>u.join(k,`tsup.config${e}`))],x=E?.tochibuild,w=E?.tsup,C=!!Object.keys(x||{}).length||!!Object.keys(w||{}).length,j=C||A.some(e=>f.existsSync(e)),v=new V("tochibuild").name("tochibuild <command>").description("bundle a Node.js project powered by tsup (https://tsup.egoist.dev)").allowUnknownOption(!0).version(P.version).argument("[args...]","arguments to pass to tsup").action(async e=>O(e));v.command("config").description("generate config files").option("--ext <string>","the file extension to use excluding the file extension (defaults to .ts)",".ts").option("-f, --filename <string>","the file name to use (defaults to tochibuild.config)","tochibuild.config").option("-o, --overwrite","whether to overwrite the config file if it already exists (defaults to false)",!1).option("--outDir <string...>","the absolute/relative output directory paths to create the config files in (defaults to the working directory)").action(e=>T("node",e)),v.parseAsync(process.argv);async function O(e){return new Promise((g,a)=>{try{let r="node",o=[],c=e.includes("--config"),p=e.includes("--no-config"),h=c?e.findIndex(t=>t==="--config")+1:void 0;if(!c&&!p&&!j)s.log("no config file found, generating default config..."),b.generateConfig(l,void 0,!1,!0),o.push(...e);else if(!c&&!p&&j){if(C){let t=x||w;e.filter(n=>n.startsWith("-")).forEach(n=>{let i=e.findIndex(R=>R===n),G=n.startsWith("--")?n.slice(2):n.slice(1);if(t[G]||(o.push(n),o[i+1]?.startsWith("-")))return;let I=o[i+1];I&&o.push(I)}),Object.entries(t).forEach(([n,i])=>{typeof i=="boolean"||i==="true"||i==="false"?i&&o.push(`--${n}`):typeof i=="string"&&o.push(`--${n}`,i)}),o.push("--no-config")}}else{if(h!=null&&h>=0){let t=e[h]||"unspecified";f.existsSync(t)||(s.error(void 0,`config file '${t}' does not exist`),s.info(`try running '${y.magenta(l)} ${y.blue("config")} ${y.gray("-h")}' to get help on how to generate a config file`),process.exit(1))}o.push(...e)}s.log("running build...");let m=B("npx",["--yes",`--package=${M[r]}`,"--package=typescript@5.8.3",`${J[r]}`,...!c&&!p?["--config","tochibuild.config.ts"]:[],...o],{stdio:"inherit",shell:!0,cwd:process.cwd(),env:process.env});m.on("exit",t=>{process.exit(t??1)}),process.on("SIGINT",()=>{a(),m.kill("SIGINT")}),process.on("SIGTERM",()=>{a(),m.kill("SIGTERM")}),g()}catch(r){a(r)}})}function T(e,g){switch(J[e]){case"tsup --target=node18.17":b.generateConfig(l,g,!1,!0);break}}}N("@tochii/build");
2
+ import{a as s,c as m}from"./chunk-LBH52VOU.mjs";import y from"chalk";import f from"fs";import u from"path";import{Command as V}from"commander";import{spawn as B}from"child_process";var I={name:"tochibuild",version:"2.0.2",description:"An extremely fast JavaScript/Typescript and CSS bundler with minimal configuration.",repository:"https://github.com/tochiResources/project/tree/main/packages/build/tochibuild.git",license:"MIT",bin:"./dist/cli.mjs",scripts:{dev:"tsx cli.ts",build:"tsx cli.ts --config tochibuild.config.ts --entry index.ts --entry cli.ts --entry utils.ts","build:publish":"bun run build && bun run publish",publish:"npm publish --access public --no-private"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0",tsup:"^8.4.0"},devDependencies:{"@types/node":"^22.15.17",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var J={node:"tsup --target=node18.17"},M={node:"tsup"},$=u.resolve(process.cwd(),"."),W=$.replace(/\\/g,"/").includes("packages/build"),d=W?void 0:u.join($,"package.json"),F=d?f.existsSync(d):!1,P=d&&F?f.readFileSync(d,"utf-8"):void 0,E=P?JSON.parse(P):void 0;async function A(l){let k=process.cwd(),T=[u.join(k,"tochibuild.config.ts"),...[".ts",".js",".cjs",".json"].map(e=>u.join(k,`tsup.config${e}`))],x=E?.tochibuild,w=E?.tsup,C=!!Object.keys(x||{}).length||!!Object.keys(w||{}).length,v=C||T.some(e=>f.existsSync(e)),S=new V("tochibuild").name("tochibuild <command>").description("bundle a Node.js project powered by tsup (https://tsup.egoist.dev)").allowUnknownOption(!0).version(I.version).argument("[args...]","arguments to pass to tsup").action(async e=>N(e));S.command("config").description("generate config files").option("--ext <string>","the file extension to use excluding the file extension (defaults to .ts)",".ts").option("-f, --filename <string>","the file name to use (defaults to tochibuild.config)","tochibuild.config").option("-o, --overwrite","whether to overwrite the config file if it already exists (defaults to false)",!1).option("--outDir <string...>","the absolute/relative output directory paths to create the config files in (defaults to the working directory)").action(e=>O("node",e)),S.parseAsync(process.argv);async function N(e){return new Promise((a,p)=>{try{let r="node",t=[],c=e.includes("--config"),g=e.includes("--no-config"),h=c?e.findIndex(i=>i==="--config")+1:void 0;if(!c&&!g&&!v)s.log("no config file found, generating default config..."),m.generateConfig(l,void 0,!1,!0),t.push(...e);else if(!c&&!g&&v){if(C){let i=x||w;e.filter(n=>n.startsWith("-")).forEach(n=>{let o=e.findIndex(R=>R===n),G=n.startsWith("--")?n.slice(2):n.slice(1);if(i[G]||(t.push(n),t[o+1]?.startsWith("-")))return;let j=t[o+1];j&&t.push(j)}),Object.entries(i).forEach(([n,o])=>{typeof o=="boolean"||o==="true"||o==="false"?o&&t.push(`--${n}`):typeof o=="string"&&t.push(`--${n}`,o)}),t.push("--no-config")}}else{if(h!=null&&h>=0){let i=e[h]||"unspecified";f.existsSync(i)||(s.error(void 0,`config file '${i}' does not exist`),s.info(`try running '${y.magenta(l)} ${y.blue("config")} ${y.gray("-h")}' to get help on how to generate a config file`),process.exit(1))}t.push(...e)}s.log("running build...");let b=B("npx",["--yes",`--package=${M[r]}`,"--package=typescript@5.8.3",`${J[r]}`,...!c&&!g?["--config","tochibuild.config.ts"]:[],...t],{stdio:"inherit",shell:!0,cwd:process.cwd(),env:process.env});b.on("exit",i=>{process.exit(i??1)}),process.on("SIGINT",()=>{p(),b.kill("SIGINT")}),process.on("SIGTERM",()=>{p(),b.kill("SIGTERM")}),a()}catch(r){p(r)}})}function O(e,a){switch(J[e]){case"tsup --target=node18.17":m.generateConfig(l,a,!1,!0);break}}}A("@tochii/build");
package/package.json CHANGED
@@ -1,19 +1,28 @@
1
1
  {
2
2
  "name": "@tochii/build",
3
- "version": "2.0.0",
4
- "description": "CLI and utilities for bundling your projects optionally with no config in Node.js with extended features like configuration file generation",
5
- "repository": "https://github.com/tochiResources/project/packages/build.git",
3
+ "version": "2.0.2",
4
+ "description": "An extremely fast JavaScript/Typescript and CSS bundler with minimal configuration.",
5
+ "repository": "https://github.com/tochiResources/project/tree/main/packages/build.git",
6
6
  "license": "MIT",
7
+ "keywords": [
8
+ "bundler",
9
+ "build",
10
+ "typescript",
11
+ "javascript",
12
+ "tsup",
13
+ "cli",
14
+ "node",
15
+ "tochi",
16
+ "tochiResources"
17
+ ],
7
18
  "bin": "./dist/cli.mjs",
8
19
  "scripts": {
9
20
  "dev": "tsx cli.ts",
10
21
  "build": "yarn build:tochibuild && yarn build:root",
11
22
  "build:root": "tsx cli.ts --config ./tochibuild/tochibuild.config.ts --entry index.ts --entry cli.ts --entry utils.ts",
12
23
  "build:tochibuild": "cd ./tochibuild && bun run build",
13
- "build:publish": "yarn build && yarn publish:root && yarn publish:tochibuild",
14
- "publish": "yarn publish:root && yarn publish:tochibuild",
15
- "publish:root": "npm publish --access public --no-private",
16
- "publish:tochibuild": "cd ./tochibuild && bun run publish"
24
+ "build:publish": "yarn build && yarn publish",
25
+ "publish": "npm publish --access public --no-private"
17
26
  },
18
27
  "dependencies": {
19
28
  "chalk": "^5.4.1",