@funish/basis 0.2.8 → 0.2.9-edge.0
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 +1 -70
- package/dist/_chunks/audit-oeZItYVw.mjs +1 -0
- package/dist/_chunks/git-CsvFrMBz.mjs +7 -0
- package/dist/_chunks/init-oQhqxdPm.mjs +4 -0
- package/dist/_chunks/publish-X1rdYmns.mjs +1 -0
- package/dist/_chunks/run-huXNTaib.mjs +1 -0
- package/dist/_chunks/utils-C__9zeRd.mjs +1 -0
- package/dist/_chunks/version-NE9KAeIW.mjs +1 -0
- package/dist/cli/basis.mjs +1 -10
- package/dist/cli/oxfmt.mjs +1 -1
- package/dist/cli/oxlint.mjs +1 -1
- package/dist/cli/tsgolint.mjs +1 -1
- package/dist/commands/add.d.mts +6 -2
- package/dist/commands/add.mjs +1 -1
- package/dist/commands/audit.d.mts +6 -2
- package/dist/commands/audit.mjs +1 -1
- package/dist/commands/build.d.mts +225 -2
- package/dist/commands/build.mjs +1 -1
- package/dist/commands/dlx.d.mts +6 -2
- package/dist/commands/dlx.mjs +1 -1
- package/dist/commands/fmt.d.mts +6 -2
- package/dist/commands/fmt.mjs +1 -1
- package/dist/commands/git.d.mts +6 -2
- package/dist/commands/git.mjs +1 -1
- package/dist/commands/init.d.mts +6 -2
- package/dist/commands/init.mjs +1 -1
- package/dist/commands/lint.d.mts +6 -2
- package/dist/commands/lint.mjs +1 -1
- package/dist/commands/publish.d.mts +6 -2
- package/dist/commands/publish.mjs +1 -1
- package/dist/commands/remove.d.mts +6 -2
- package/dist/commands/remove.mjs +1 -1
- package/dist/commands/run.d.mts +6 -2
- package/dist/commands/run.mjs +1 -1
- package/dist/commands/version.d.mts +6 -2
- package/dist/commands/version.mjs +1 -1
- package/dist/config.d.mts +2 -17
- package/dist/config.mjs +1 -1
- package/dist/index.d.mts +109 -2
- package/dist/index.mjs +1 -1
- package/package.json +6 -2
- package/dist/_chunks/config-lvw40IpZ.mjs +0 -1
- package/dist/_chunks/fmt-BluqTWgC.mjs +0 -1
- package/dist/_chunks/lint-D675ojvh.mjs +0 -1
- package/dist/_chunks/run-D8ZiNeaU.mjs +0 -1
- /package/dist/_chunks/{types-C-71QzwD.d.mts → types-BEJ3zuUY.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ basis fmt
|
|
|
76
76
|
|
|
77
77
|
# Build project
|
|
78
78
|
basis build # Build with default config
|
|
79
|
-
basis build --
|
|
79
|
+
basis build --cwd ./packages # Build specific directory
|
|
80
80
|
basis build --stub # Generate stub files
|
|
81
81
|
|
|
82
82
|
# Audit code quality
|
|
@@ -167,96 +167,27 @@ basis git branch -a
|
|
|
167
167
|
|
|
168
168
|
## Configuration
|
|
169
169
|
|
|
170
|
-
Basis uses a single configuration file for all features:
|
|
171
|
-
|
|
172
170
|
```ts
|
|
173
171
|
// basis.config.ts
|
|
174
172
|
import { defineBasisConfig } from "@funish/basis/config";
|
|
175
173
|
|
|
176
174
|
export default defineBasisConfig({
|
|
177
|
-
// Linting configuration (oxlint arguments)
|
|
178
|
-
lint: {
|
|
179
|
-
config: ["--fix", "--fix-suggestions", "--type-aware", "--type-check"],
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
// Formatting configuration (oxfmt arguments)
|
|
183
|
-
fmt: {
|
|
184
|
-
config: ["--write", "."],
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
// Git configuration
|
|
188
175
|
git: {
|
|
189
|
-
// Git hooks
|
|
190
176
|
hooks: {
|
|
191
177
|
"pre-commit": "basis git staged",
|
|
192
178
|
"commit-msg": "basis git lint-commit",
|
|
193
179
|
},
|
|
194
|
-
|
|
195
|
-
// Staged files check (lint-staged style)
|
|
196
180
|
staged: {
|
|
197
181
|
rules: {
|
|
198
182
|
"*.{ts,tsx,js,jsx}": "basis lint --fix",
|
|
199
183
|
"*.{json,md,yml,yaml}": "basis fmt --write",
|
|
200
184
|
},
|
|
201
185
|
},
|
|
202
|
-
|
|
203
|
-
// Commit message validation
|
|
204
|
-
commitMsg: {
|
|
205
|
-
types: ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore"],
|
|
206
|
-
maxLength: 72,
|
|
207
|
-
minLength: 10,
|
|
208
|
-
},
|
|
209
186
|
},
|
|
210
|
-
|
|
211
|
-
// Run configuration (jiti)
|
|
212
|
-
run: {},
|
|
213
|
-
|
|
214
|
-
// Audit configuration
|
|
215
187
|
audit: {
|
|
216
188
|
dependencies: {
|
|
217
189
|
outdated: true,
|
|
218
190
|
security: true,
|
|
219
|
-
licenses: {
|
|
220
|
-
allowed: ["MIT", "Apache-2.0", "BSD-3-Clause"],
|
|
221
|
-
blocked: ["GPL"],
|
|
222
|
-
},
|
|
223
|
-
blocked: ["bad-package"],
|
|
224
|
-
},
|
|
225
|
-
structure: {
|
|
226
|
-
required: ["README.md", "LICENSE"],
|
|
227
|
-
files: [
|
|
228
|
-
{
|
|
229
|
-
pattern: "src/**/*.ts",
|
|
230
|
-
rule: "^[a-z][a-z0-9-]*\\.ts$",
|
|
231
|
-
message: "Files should use kebab-case",
|
|
232
|
-
},
|
|
233
|
-
],
|
|
234
|
-
dirs: [
|
|
235
|
-
{
|
|
236
|
-
pattern: "src/*/",
|
|
237
|
-
rule: "^[a-z][a-z0-9-]*$",
|
|
238
|
-
message: "Directories should use kebab-case",
|
|
239
|
-
},
|
|
240
|
-
],
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
// Version configuration
|
|
245
|
-
version: {
|
|
246
|
-
preid: "edge",
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
// Publishing configuration
|
|
250
|
-
publish: {
|
|
251
|
-
npm: {
|
|
252
|
-
tag: "latest",
|
|
253
|
-
additionalTag: "edge",
|
|
254
|
-
},
|
|
255
|
-
git: {
|
|
256
|
-
tagPrefix: "v",
|
|
257
|
-
message: (version) => `chore: release v${version}`,
|
|
258
|
-
push: true,
|
|
259
|
-
signTag: false,
|
|
260
191
|
},
|
|
261
192
|
},
|
|
262
193
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./utils-C__9zeRd.mjs";import{readPackageJSON as t,resolvePackageJSON as n}from"pkg-types";import{resolve as r}from"pathe";import{stat as i}from"node:fs/promises";import{spawnSync as a}from"node:child_process";import{consola as o}from"consola";import{detectPackageManager as s}from"nypm";import{glob as c}from"tinyglobby";const l={npm:{outdated:[`outdated`],audit:[`audit`]},yarn:{outdated:[`outdated`,`-c`],audit:[`audit`]},pnpm:{outdated:[`outdated`],audit:[`audit`]},bun:{outdated:[`outdated`],audit:[`audit`]},deno:{outdated:null,audit:null}};async function u(r=process.cwd(),i,c=!1){let{config:u}=await e({overrides:i?{audit:{dependencies:i}}:void 0}),f=u.audit?.dependencies||{};o.start(`Auditing dependencies...`);let p=!1;if(f.blocked&&f.blocked.length>0)try{let e=await t(r),n={...e.dependencies,...e.devDependencies},i=Object.keys(n).filter(e=>f.blocked?.includes(e));i.length>0&&(o.error(`Found ${i.length} blocked package(s): ${i.join(`, `)}`),p=!0)}catch(e){o.error(`Failed to check blocked packages:`,e),p=!0}if(f.outdated)try{let e=(await s(r))?.name||`npm`,t=l[e];t.outdated?a(e,t.outdated,{cwd:r,stdio:`inherit`,shell:!0}).status!==0&&o.warn(`Some dependencies are outdated`):o.info(`Skipping outdated check for ${e}`)}catch(e){o.error(`Failed to check outdated dependencies:`,e),p=!0}if(f.security)try{let e=(await s(r))?.name||`npm`,t=l[e];t.audit?a(e,t.audit,{cwd:r,stdio:`inherit`,shell:!0}).status!==0&&(p=!0):o.info(`Skipping security audit for ${e}`)}catch(e){o.error(`Failed to check security vulnerabilities:`,e),p=!0}if(f.licenses&&(f.licenses.allowed||f.licenses.blocked))try{let e=await n(r),i=await d(r),a=[];for(let n of i)try{let r=await t(n);if(!r.name||n===e)continue;if(r.license){let e=Array.isArray(r.license)?r.license.join(`, `):r.license;if(f.licenses.blocked&&f.licenses.blocked.some(t=>e.includes(t))){a.push(`${r.name}: ${e}`);continue}f.licenses.allowed&&f.licenses.allowed.length>0&&(f.licenses.allowed.some(t=>e.includes(t))||a.push(`${r.name}: ${e}`))}}catch{}a.length>0&&(o.error(`Packages with invalid licenses:`),a.forEach(e=>o.error(` ${e}`)),p=!0)}catch(e){o.error(`Failed to check licenses:`,e),p=!0}return p||o.success(`Dependencies audit passed`),!p}async function d(e){try{return await c([`node_modules/*/package.json`,`node_modules/@*/*/package.json`,`node_modules/@*/*/*/package.json`],{cwd:e,absolute:!0})}catch{return[]}}async function f(t=process.cwd(),n){let{config:a}=await e({overrides:n?{audit:{structure:n}}:void 0}),s=a.audit?.structure||{};o.start(`Auditing project structure...`);let l=!1;if(s.required&&s.required.length>0){let e=[];for(let n of s.required)try{await i(r(t,n))}catch{n.includes(`*`)||n.includes(`?`)?(await c([n],{cwd:t})).length===0&&e.push(n):e.push(n)}e.length>0&&(o.error(`Missing required file(s)/director(ies): ${e.join(`, `)}`),l=!0)}if(s.files&&s.files.length>0)for(let e of s.files)try{let n=await c([e.pattern],{cwd:t}),r=new RegExp(e.rule),i=n.filter(e=>!r.test(e));i.length>0&&(o.error(`${e.message}: ${i.slice(0,5).join(`, `)}${i.length>5?`...`:``}`),l=!0)}catch(t){o.error(`Failed to check file naming rule: ${e.pattern}`,t),l=!0}if(s.dirs&&s.dirs.length>0)for(let e of s.dirs)try{let n=await c([e.pattern],{cwd:t}),r=new RegExp(e.rule),i=n.filter(e=>!r.test(e));i.length>0&&(o.error(`${e.message}: ${i.slice(0,5).join(`, `)}${i.length>5?`...`:``}`),l=!0)}catch(t){o.error(`Failed to check directory naming rule: ${e.pattern}`,t),l=!0}return l||o.success(`Structure audit passed`),!l}async function p(t=process.cwd(),n=!1){let{config:r}=await e(),i=r.audit||{};o.start(`Running comprehensive project audit...`);let a=(await Promise.allSettled([u(t,i.dependencies,n),f(t,i.structure)])).filter(e=>e.status===`rejected`||e.status===`fulfilled`&&!e.value);return a.length===0?(o.success(`All audits passed`),!0):(o.error(`${a.length} audit(s) failed`),!1)}export{d as i,u as n,f as r,p as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{t as e}from"./utils-C__9zeRd.mjs";import{resolve as t}from"pathe";import{readFile as n,writeFile as r}from"node:fs/promises";import{execSync as i}from"node:child_process";import{exec as a,setupEnvironment as o}from"dugite";import{consola as s}from"consola";import c from"picomatch";async function l(){try{let e=i(`git --exec-path`,{encoding:`utf8`}).trim();if(e){let n=o({LOCAL_GIT_DIRECTORY:t(e,`..`,`..`,`..`)});Object.assign(process.env,n.env),s.debug(`Using system Git from: ${n.gitLocation}`)}}catch{s.debug(`System Git not found, dugite will use embedded Git`)}}l();async function u(e){try{let t=(await a([`diff`,`--cached`,`--name-only`],e)).stdout.trim().split(`
|
|
2
|
+
`).filter(Boolean),n=await a([`diff`,`--cached`,`--name-only`,`--diff-filter=D`],e),r=new Set(n.stdout.trim().split(`
|
|
3
|
+
`).filter(Boolean));return t.filter(e=>!r.has(e))}catch{return[]}}async function d(t=process.cwd()){let{config:n}=await e(),r=n.git?.staged?.rules||{};if(Object.keys(r).length===0)return s.warn(`No staged rules configured. Add git.staged.rules to your basis.config.ts`),!0;let o=await u(t);if(o.length===0)return s.info(`No staged files to check`),!0;s.start(`Checking ${o.length} staged file(s)`);let l=!1,d=new Set;for(let[e,n]of Object.entries(r)){let r=c(e),u=o.filter(e=>!d.has(e)&&r(e));if(u.length!==0){s.info(`Running ${n} for ${u.length} file(s) matching ${e}`);try{let e=await a([`status`,`--porcelain`],t),r=new Set;e.stdout.trim().split(`
|
|
4
|
+
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,n,i]=t;(n[1]===`M`||n===` M`)&&r.add(i)}),i(n,{cwd:t,stdio:`inherit`});let o=await a([`status`,`--porcelain`],t),c=new Set;o.stdout.trim().split(`
|
|
5
|
+
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,n,i]=t;(n[1]===`M`||n===` M`)&&(u.includes(i)?c.add(i):r.has(i)||c.add(i))}),c.size>0&&(await a([`add`,...Array.from(c)],t),s.info(`Re-staged ${c.size} file(s) after formatting`)),u.forEach(e=>d.add(e))}catch(t){l=!0,s.error(`Staged check failed for pattern '${e}':`,t)}}}return l?(s.error(`Some staged files checks failed`),!1):(s.success(`Staged files check passed`),!0)}const f=[`feat`,`fix`,`docs`,`style`,`refactor`,`perf`,`test`,`build`,`ci`,`chore`,`revert`];function p(e){let t=e.trim().split(`
|
|
6
|
+
`)[0],n=t.match(/^(\w+)(\(([^)]+)\))?(!)?:\s*(.+)$/);if(!n)return null;let[,r,,i,,a]=n;return{type:r,scope:i,subject:a,isBreaking:t.includes(`!`)||e.includes(`BREAKING CHANGE:`)}}async function m(r=process.cwd()){let{config:i}=await e(),o=i.git?.commitMsg,c=o?.types||f,l=o?.maxLength||72,u=o?.minLength||10,d=o?.scopeRequired||!1,m=o?.allowedScopes||[],h;try{let e=t(r,`.git/COMMIT_EDITMSG`);try{h=(await n(e)).toString(`utf8`)}catch{h=(await a([`log`,`-1`,`--pretty=%B`],r)).stdout.trim()}}catch(e){return s.error(`Failed to read commit message:`,e),!1}let g=[],_=p(h);if(!_)return s.error(`Invalid commit format. Expected: type(scope): subject`),!1;c.includes(_.type)||g.push(`Invalid type '${_.type}'. Allowed: ${c.join(`, `)}`);let v=h.split(`
|
|
7
|
+
`)[0];return v.length>l&&g.push(`Header too long (${v.length} chars). Max: ${l}`),v.length<u&&g.push(`Header too short (${v.length} chars). Min: ${u}`),d&&!_.scope&&g.push(`Scope is required`),_.scope&&m.length>0&&!m.includes(_.scope)&&g.push(`Invalid scope '${_.scope}'. Allowed: ${m.join(`, `)}`),g.length>0?(s.error(`Invalid commit message:`),g.forEach(e=>s.error(` ${e}`)),!1):(s.success(`Commit message validation passed`),!0)}async function h(n=process.cwd()){let{config:i}=await e(),a=i.git?.hooks;if(!a||Object.keys(a).length===0)return s.warn(`No Git hooks configured`),!0;let o=t(n,`.git/hooks`);try{for(let[e,n]of Object.entries(a))await r(t(o,e),`#!/bin/sh\n${n}\n`,{mode:493}),s.success(`Created ${e} hook`);return!0}catch(e){return s.error(`Failed to setup Git hooks:`,e),!1}}async function g(e=process.cwd()){return s.start(`Setting up Git configuration`),await h(e)?(s.success(`Git setup completed`),!0):!1}export{p as a,h as c,d as i,u as n,g as o,m as r,l as s,f as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{loadConfig as e}from"c12";import{writeFile as t}from"node:fs/promises";import{exec as n}from"dugite";import{consola as r}from"consola";import{detectPackageManager as i}from"nypm";async function a(a=process.cwd(),o={}){let{force:s=!1,skipGitCheck:c=!1}=o;r.start(`Initializing basis configuration`);let l=(await e({cwd:a,name:`basis`}))._configFile;if(l&&!s)return r.error(`Configuration file already exists: ${l}`),r.info(`Use --force to overwrite.`),!1;let u=(await i(a))?.name||`npm`,d=u===`npm`?`npx`:u,f={git:{hooks:{"pre-commit":`${d} basis git staged`,"commit-msg":`${d} basis git lint-commit`},staged:{rules:{"**/*.{ts,tsx,js,jsx}":`basis lint`,"**/*.{json,md,yml,yaml}":`basis fmt`}}}},p=`import { defineBasisConfig } from "@funish/basis/config";
|
|
2
|
+
|
|
3
|
+
export default defineBasisConfig(${JSON.stringify(f,null,2)});
|
|
4
|
+
`,m=`${a}/basis.config.ts`;if(await t(m,p,`utf8`),r.success(`Configuration created in ${m}`),!c)try{await n([`--version`],a),r.info(`Git detected`)}catch{r.info(`Git not found`)}return r.success(`Basis initialization completed!`),r.info(`Run 'basis git setup' to setup Git hooks`),!0}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readPackageJSON as e}from"pkg-types";import{spawnSync as t}from"node:child_process";import{exec as n}from"dugite";import{consola as r}from"consola";import{detectPackageManager as i}from"nypm";async function a(n,a){let o=process.cwd(),s=await e(o),c=s.version,l=s.name;if(!l)throw Error(`Package name is required in package.json`);if(!c)throw Error(`Package version is required in package.json`);let u=(await i(o))?.name||`npm`,d={tag:`latest`,access:`public`,...a.npm},f=n.tag;if(!f&&c&&c.includes(`-`)){let e=c.match(/-(\w+)\.\d+$/);e&&(f=e[1])}f=f||d.tag||`latest`;let p=t(u,[`publish`,...(e=>{let t=[];n.tarball&&t.push(n.tarball),t.push(`--tag`,e);let r=n.access||d.access;return r&&t.push(`--access`,r),n.dryRun&&t.push(`--dry-run`),n.otp&&t.push(`--otp`,n.otp),t})(f)],{stdio:`inherit`,shell:!0});if(p.status!==0){r.error(`Publish failed with exit code ${p.status}`);return}let m=d.additionalTag;if(!n.dryRun&&m&&m!==f){let e=t(`npm`,[`dist-tag`,`add`,`${l}@${c}`,m],{cwd:o,stdio:`inherit`,shell:!0});if(e.status!==0){r.error(`Failed to add dist-tag with exit code ${e.status}`);return}}else m&&r.info(`Skipping dist-tag ${m} (same as publish tag ${f})`)}async function o(e,t){let r=process.cwd(),i=t?.tagPrefix;if(!i)throw Error(`Git tagPrefix is required`);let a=`${i}${e}`,o=t?.message?t.message(e):`chore: release ${a}`;await n([`add`,`package.json`],r),await n([`commit`,`-m`,o],r),await n([`tag`,a,...t?.signTag?[`--sign`]:[]],r),t?.push&&(await n([`push`],r),await n([`push`,`--tags`],r))}export{a as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";import{dirname as t,resolve as n}from"pathe";import{spawnSync as r}from"node:child_process";import{consola as i}from"consola";function a(a){let{pkg:o,bin:s,args:c}=a,l=n(t(e(import.meta.url).resolve(o)),s),u=r(process.execPath,[l,...c],{stdio:`inherit`,shell:!1});return u.error&&i.error(u.error),u.status!==0&&i.error(`${o} failed with exit code ${u.status}`),u}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadConfig as e}from"c12";import{findWorkspaceDir as t}from"pkg-types";import{dirname as n}from"pathe";async function r(r={}){if(r.cwd)return await e({name:`basis`,cwd:r.cwd,...r,defaults:{...r.defaults}});let i=process.cwd(),a=await t(i);for(;;){let t=await e({name:`basis`,cwd:i,...r,defaults:{...r.defaults}});if(t._configFile||i===a)return t;i=n(i)}}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"semver";function t(t,n,r){if(n.version){if(e.valid(n.version))return n.version;throw Error(`Invalid version format: ${n.version}. Please use semantic versioning format (e.g., 1.0.0, 2.1.0-alpha.1)`)}if(!e.valid(t))throw Error(`Invalid current version format: ${t}. Please fix version in package.json to use semantic versioning format (e.g., 1.0.0)`);let i=e.prerelease(t),a=n.preid||(i&&typeof i[0]==`string`?i[0]:null)||r.preid||`edge`,o=`patch`;n.major?o=`major`:n.minor?o=`minor`:n.premajor?o=`premajor`:n.preminor?o=`preminor`:n.prepatch?o=`prepatch`:n.prerelease?o=i?`prerelease`:`prepatch`:n.fromGit&&(o=`patch`);let s=o===`prerelease`||o.startsWith(`pre`)?e.inc(t,o,a):e.inc(t,o);if(!s)throw Error(`Failed to calculate new version from ${t}. Please check your version increment options.`);return s}export{t};
|
package/dist/cli/basis.mjs
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export default defineBasisConfig(${JSON.stringify(c,null,2)});
|
|
5
|
-
`,d=`${e}/basis.config.ts`;if(await p(d,l,`utf8`),u.success(`Configuration created in ${d}`),!i)try{await m([`--version`],e),u.info(`Git detected`)}catch{u.info(`Git not found`)}return u.success(`Basis initialization completed!`),u.info(`Run 'basis git setup' to setup Git hooks`),!0}const A=c({meta:{name:`init`,description:`Initialize configuration`},args:{force:{type:`boolean`,description:`Overwrite existing configuration`},"skip-git-check":{type:`boolean`,description:`Skip git directory check`},"skip-install":{type:`boolean`,description:`Skip dependency installation`}},async run({args:e}){try{await k(process.cwd(),{force:e.force,skipGitCheck:e[`skip-git-check`],skipInstall:e[`skip-install`]})}catch(e){u.error(`Init failed:`,e),process.exit(1)}}}),j=c({meta:{name:`build`,description:`Build project`},args:{dir:{type:`string`,description:`Project directory`,default:`.`},stub:{type:`boolean`,description:`Generate stub files`,default:!1}},async run({args:e}){let t=s(e.dir||`.`);try{let{config:n={}}=await r({name:`isbuild`,configFile:`build.config`,cwd:t}),i=(n.entries||[]).map(t=>{if(typeof t==`string`){let[n,r]=t.split(`:`);return n.endsWith(`/`)?{type:`transform`,input:n,outDir:r,stub:e.stub}:{type:`bundle`,input:n.split(`,`),outDir:r,stub:e.stub}}return{...t,stub:e.stub}});(!i||i.length===0)&&(u.error(`No build entries specified in build.config.`),process.exit(1)),await w({cwd:t,...n,entries:i}),u.success(`Build completed`)}catch(e){u.error(`Build failed:`,e),process.exit(1)}}});async function M(){try{let e=S(`git --exec-path`,{encoding:`utf8`}).trim();if(e){let t=h({LOCAL_GIT_DIRECTORY:s(e,`..`,`..`,`..`)});Object.assign(process.env,t.env),u.debug(`Using system Git from: ${t.gitLocation}`)}}catch{u.debug(`System Git not found, dugite will use embedded Git`)}}M();async function N(e){try{let t=(await m([`diff`,`--cached`,`--name-only`],e)).stdout.trim().split(`
|
|
6
|
-
`).filter(Boolean),n=await m([`diff`,`--cached`,`--name-only`,`--diff-filter=D`],e),r=new Set(n.stdout.trim().split(`
|
|
7
|
-
`).filter(Boolean));return t.filter(e=>!r.has(e))}catch{return[]}}async function P(t=process.cwd()){let{config:n}=await e(),r=n.git?.staged?.rules||{};if(Object.keys(r).length===0)return u.warn(`No staged rules configured. Add git.staged.rules to your basis.config.ts`),!0;let i=await N(t);if(i.length===0)return u.info(`No staged files to check`),!0;u.start(`Checking ${i.length} staged file(s)`);let a=!1,o=new Set;for(let[e,n]of Object.entries(r)){let r=T(e),s=i.filter(e=>!o.has(e)&&r(e));if(s.length!==0){u.info(`Running ${n} for ${s.length} file(s) matching ${e}`);try{let e=await m([`status`,`--porcelain`],t),r=new Set;e.stdout.trim().split(`
|
|
8
|
-
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,n,i]=t;(n[1]===`M`||n===` M`)&&r.add(i)}),S(n,{cwd:t,stdio:`inherit`});let i=await m([`status`,`--porcelain`],t),a=new Set;i.stdout.trim().split(`
|
|
9
|
-
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,n,i]=t;(n[1]===`M`||n===` M`)&&(s.includes(i)?a.add(i):r.has(i)||a.add(i))}),a.size>0&&(await m([`add`,...Array.from(a)],t),u.info(`Re-staged ${a.size} file(s) after formatting`)),s.forEach(e=>o.add(e))}catch(t){a=!0,u.error(`Staged check failed for pattern '${e}':`,t)}}}return a?(u.error(`Some staged files checks failed`),!1):(u.success(`Staged files check passed`),!0)}const F=[`feat`,`fix`,`docs`,`style`,`refactor`,`perf`,`test`,`build`,`ci`,`chore`,`revert`];function I(e){let t=e.trim().split(`
|
|
10
|
-
`)[0],n=t.match(/^(\w+)(\(([^)]+)\))?(!)?:\s*(.+)$/);if(!n)return null;let[,r,,i,,a]=n;return{type:r,scope:i,subject:a,isBreaking:t.includes(`!`)||e.includes(`BREAKING CHANGE:`)}}async function L(t=process.cwd()){let{config:n}=await e(),r=n.git?.commitMsg,i=r?.types||F,a=r?.maxLength||72,o=r?.minLength||10,c=r?.scopeRequired||!1,l=r?.allowedScopes||[],f;try{let e=s(t,`.git/COMMIT_EDITMSG`);try{f=(await d(e)).toString(`utf8`)}catch{f=(await m([`log`,`-1`,`--pretty=%B`],t)).stdout.trim()}}catch(e){return u.error(`Failed to read commit message:`,e),!1}let p=[],h=I(f);if(!h)return u.error(`Invalid commit format. Expected: type(scope): subject`),!1;i.includes(h.type)||p.push(`Invalid type '${h.type}'. Allowed: ${i.join(`, `)}`);let g=f.split(`
|
|
11
|
-
`)[0];return g.length>a&&p.push(`Header too long (${g.length} chars). Max: ${a}`),g.length<o&&p.push(`Header too short (${g.length} chars). Min: ${o}`),c&&!h.scope&&p.push(`Scope is required`),h.scope&&l.length>0&&!l.includes(h.scope)&&p.push(`Invalid scope '${h.scope}'. Allowed: ${l.join(`, `)}`),p.length>0?(u.error(`Invalid commit message:`),p.forEach(e=>u.error(` ${e}`)),!1):(u.success(`Commit message validation passed`),!0)}async function R(t=process.cwd()){let{config:n}=await e(),r=n.git?.hooks;if(!r||Object.keys(r).length===0)return u.warn(`No Git hooks configured`),!0;let i=s(t,`.git/hooks`);try{for(let[e,t]of Object.entries(r))await p(s(i,e),`#!/bin/sh\n${t}\n`,{mode:493}),u.success(`Created ${e} hook`);return!0}catch(e){return u.error(`Failed to setup Git hooks:`,e),!1}}async function z(e=process.cwd()){return u.start(`Setting up Git configuration`),await R(e)?(u.success(`Git setup completed`),!0):!1}const B=c({meta:{name:`git`,description:`Git operations`},async run({rawArgs:e}){let t=e[0];if(!t){u.info(`Available subcommands: staged, lint-commit, setup`),u.info(`Git passthrough mode: basis git <git-command>`);return}switch(t){case`staged`:await P()||process.exit(1);return;case`lint-commit`:await L()||process.exit(1);return;case`setup`:await z()||process.exit(1);return;default:try{let t=await m(e,process.cwd(),{processCallback:e=>{e.stdout?.on(`data`,e=>{process.stdout.write(e)}),e.stderr?.on(`data`,e=>{process.stderr.write(e)})}});if(t.exitCode!==0)throw Error(`git exited with code ${t.exitCode}`)}catch(e){u.error(`Git operation failed:`,e),process.exit(1)}}}}),V=c({meta:{name:`run`,description:`Run scripts or files`},async run({rawArgs:t}){t.length===0&&(u.error(`Please specify a script name or file path`),process.exit(1));let[n,...r]=t,i=process.cwd(),{config:a}=await e(),o=a.run?.config,c=s(i,n);if(E(c))try{let e=ee(i,o),n=e.esmResolve(c);process.argv=[process.argv[0],n,...t.slice(1)],await e.import(n);return}catch(e){u.error(`Failed to run file:`),u.error(` ${String(e)}`),process.exit(1)}try{await x(n,{cwd:i,args:r})}catch(e){u.error(`Failed to run script "${n}":`),u.error(` ${String(e)}`),process.exit(1)}}});function H(e,t,n){if(t.version){if(D.valid(t.version))return t.version;throw Error(`Invalid version format: ${t.version}. Please use semantic versioning format (e.g., 1.0.0, 2.1.0-alpha.1)`)}if(!D.valid(e))throw Error(`Invalid current version format: ${e}. Please fix version in package.json to use semantic versioning format (e.g., 1.0.0)`);let r=D.prerelease(e),i=t.preid||(r&&typeof r[0]==`string`?r[0]:null)||n.preid||`edge`,a=`patch`;t.major?a=`major`:t.minor?a=`minor`:t.premajor?a=`premajor`:t.preminor?a=`preminor`:t.prepatch?a=`prepatch`:t.prerelease?a=r?`prerelease`:`prepatch`:t.fromGit&&(a=`patch`);let o=a===`prerelease`||a.startsWith(`pre`)?D.inc(e,a,i):D.inc(e,a);if(!o)throw Error(`Failed to calculate new version from ${e}. Please check your version increment options.`);return o}const U=c({meta:{name:`version`,description:`Update package version`},args:{version:{type:`positional`,description:`Version to set (patch, minor, major, prerelease, or specific version)`,required:!1},preid:{type:`string`,description:`Prerelease identifier (alpha, beta, rc)`},major:{type:`boolean`,description:`Bump major version`},minor:{type:`boolean`,description:`Bump minor version`},patch:{type:`boolean`,description:`Bump patch version`},premajor:{type:`boolean`,description:`Bump premajor version`},preminor:{type:`boolean`,description:`Bump preminor version`},prepatch:{type:`boolean`,description:`Bump prepatch version`},prerelease:{type:`boolean`,description:`Bump prerelease version`},"allow-same-version":{type:`boolean`,description:`Allow same version`}},async run({args:t}){try{let{config:n}=await e(),r={preid:t.preid,major:t.major,minor:t.minor,patch:t.patch||!t.major&&!t.minor&&!t.version,premajor:t.premajor,preminor:t.preminor,prepatch:t.prepatch,prerelease:t.prerelease,allowSameVersion:t[`allow-same-version`]};if(t.version){let e=t.version;[`patch`,`minor`,`major`,`prerelease`,`premajor`,`preminor`,`prepatch`].includes(e)?r[e]=!0:r.version=e}let s=process.cwd(),c=await i(s),l=c.version;if(!l)throw Error(`No version found in package.json`);let d=H(l,r,n.version||{});if(!r.allowSameVersion&&d===l)throw Error(`Version unchanged: ${l}. Use --allow-same-version to allow this.`);await o(await a(s),{...c,version:d}),u.success(`Version updated: ${l} → ${d}`)}catch(e){u.error(`Version update failed:`,e),process.exit(1)}}});async function W(e,t){let n=process.cwd(),r=await i(n),a=r.version,o=r.name;if(!o)throw Error(`Package name is required in package.json`);if(!a)throw Error(`Package version is required in package.json`);let s=(await v(n))?.name||`npm`,c={tag:`latest`,access:`public`,...t.npm},l=e.tag;if(!l&&a&&a.includes(`-`)){let e=a.match(/-(\w+)\.\d+$/);e&&(l=e[1])}l=l||c.tag||`latest`;let d=C(s,[`publish`,...(t=>{let n=[];e.tarball&&n.push(e.tarball),n.push(`--tag`,t);let r=e.access||c.access;return r&&n.push(`--access`,r),e.dryRun&&n.push(`--dry-run`),e.otp&&n.push(`--otp`,e.otp),n})(l)],{stdio:`inherit`,shell:!0});if(d.status!==0){u.error(`Publish failed with exit code ${d.status}`);return}let f=c.additionalTag;if(!e.dryRun&&f&&f!==l){let e=C(`npm`,[`dist-tag`,`add`,`${o}@${a}`,f],{cwd:n,stdio:`inherit`,shell:!0});if(e.status!==0){u.error(`Failed to add dist-tag with exit code ${e.status}`);return}}else f&&u.info(`Skipping dist-tag ${f} (same as publish tag ${l})`)}async function G(e,t){let n=process.cwd(),r=t?.tagPrefix;if(!r)throw Error(`Git tagPrefix is required`);let i=`${r}${e}`,a=t?.message?t.message(e):`chore: release ${i}`;await m([`add`,`package.json`],n),await m([`commit`,`-m`,a],n),await m([`tag`,i,...t?.signTag?[`--sign`]:[]],n),t?.push&&(await m([`push`],n),await m([`push`,`--tags`],n))}const K=c({meta:{name:`publish`,description:`Publish to registry`},args:{tag:{type:`string`,description:`Publish tag`},git:{type:`boolean`,description:`Also create git tag and commit`},access:{type:`string`,description:`Package access level (public, restricted)`},"dry-run":{type:`boolean`,description:`Dry run mode`},otp:{type:`string`,description:`One-time password for 2FA`}},async run({args:t}){try{let{config:n}=await e();if(await W({tag:t.tag,git:t.git,access:t.access||void 0,dryRun:t[`dry-run`],otp:t.otp},n.publish||{}),u.success(`Package published successfully`),t.git&&n.publish?.git){u.info(`Creating git tag and commit...`);let e=(await i(process.cwd())).version;e&&(await G(e,n.publish.git),u.success(`Git operations completed`))}}catch(e){u.error(`Publish failed:`,e),process.exit(1)}}}),q={npm:{outdated:[`outdated`],audit:[`audit`]},yarn:{outdated:[`outdated`,`-c`],audit:[`audit`]},pnpm:{outdated:[`outdated`],audit:[`audit`]},bun:{outdated:[`outdated`],audit:[`audit`]},deno:{outdated:null,audit:null}};async function J(t=process.cwd(),n,r=!1){let{config:o}=await e({overrides:n?{audit:{dependencies:n}}:void 0}),s=o.audit?.dependencies||{};u.start(`Auditing dependencies...`);let c=!1;if(s.blocked&&s.blocked.length>0)try{let e=await i(t),n={...e.dependencies,...e.devDependencies},r=Object.keys(n).filter(e=>s.blocked?.includes(e));r.length>0&&(u.error(`Found ${r.length} blocked package(s): ${r.join(`, `)}`),c=!0)}catch(e){u.error(`Failed to check blocked packages:`,e),c=!0}if(s.outdated)try{let e=(await v(t))?.name||`npm`,n=q[e];n.outdated?C(e,n.outdated,{cwd:t,stdio:`inherit`,shell:!0}).status!==0&&u.warn(`Some dependencies are outdated`):u.info(`Skipping outdated check for ${e}`)}catch(e){u.error(`Failed to check outdated dependencies:`,e),c=!0}if(s.security)try{let e=(await v(t))?.name||`npm`,n=q[e];n.audit?C(e,n.audit,{cwd:t,stdio:`inherit`,shell:!0}).status!==0&&(c=!0):u.info(`Skipping security audit for ${e}`)}catch(e){u.error(`Failed to check security vulnerabilities:`,e),c=!0}if(s.licenses&&(s.licenses.allowed||s.licenses.blocked))try{let e=await a(t),n=await Y(t),r=[];for(let t of n)try{let n=await i(t);if(!n.name||t===e)continue;if(n.license){let e=Array.isArray(n.license)?n.license.join(`, `):n.license;if(s.licenses.blocked&&s.licenses.blocked.some(t=>e.includes(t))){r.push(`${n.name}: ${e}`);continue}s.licenses.allowed&&s.licenses.allowed.length>0&&(s.licenses.allowed.some(t=>e.includes(t))||r.push(`${n.name}: ${e}`))}}catch{}r.length>0&&(u.error(`Packages with invalid licenses:`),r.forEach(e=>u.error(` ${e}`)),c=!0)}catch(e){u.error(`Failed to check licenses:`,e),c=!0}return c||u.success(`Dependencies audit passed`),!c}async function Y(e){try{return await O([`node_modules/*/package.json`,`node_modules/@*/*/package.json`,`node_modules/@*/*/*/package.json`],{cwd:e,absolute:!0})}catch{return[]}}async function X(t=process.cwd(),n){let{config:r}=await e({overrides:n?{audit:{structure:n}}:void 0}),i=r.audit?.structure||{};u.start(`Auditing project structure...`);let a=!1;if(i.required&&i.required.length>0){let e=[];for(let n of i.required)try{await f(s(t,n))}catch{n.includes(`*`)||n.includes(`?`)?(await O([n],{cwd:t})).length===0&&e.push(n):e.push(n)}e.length>0&&(u.error(`Missing required file(s)/director(ies): ${e.join(`, `)}`),a=!0)}if(i.files&&i.files.length>0)for(let e of i.files)try{let n=await O([e.pattern],{cwd:t}),r=new RegExp(e.rule),i=n.filter(e=>!r.test(e));i.length>0&&(u.error(`${e.message}: ${i.slice(0,5).join(`, `)}${i.length>5?`...`:``}`),a=!0)}catch(t){u.error(`Failed to check file naming rule: ${e.pattern}`,t),a=!0}if(i.dirs&&i.dirs.length>0)for(let e of i.dirs)try{let n=await O([e.pattern],{cwd:t}),r=new RegExp(e.rule),i=n.filter(e=>!r.test(e));i.length>0&&(u.error(`${e.message}: ${i.slice(0,5).join(`, `)}${i.length>5?`...`:``}`),a=!0)}catch(t){u.error(`Failed to check directory naming rule: ${e.pattern}`,t),a=!0}return a||u.success(`Structure audit passed`),!a}async function Z(t=process.cwd(),n=!1){let{config:r}=await e(),i=r.audit||{};u.start(`Running comprehensive project audit...`);let a=(await Promise.allSettled([J(t,i.dependencies,n),X(t,i.structure)])).filter(e=>e.status===`rejected`||e.status===`fulfilled`&&!e.value);return a.length===0?(u.success(`All audits passed`),!0):(u.error(`${a.length} audit(s) failed`),!1)}const Q=c({meta:{name:`audit`,description:`Audit code quality`},args:{dependencies:{type:`boolean`,description:`Dependencies audit`},structure:{type:`boolean`,description:`Project structure audit`},fix:{type:`boolean`,description:`Auto-fix issues`}},async run({args:e}){let t=process.cwd(),n=!0;if(!e.dependencies&&!e.structure)n=await Z(t,e.fix);else{let r=[];e.dependencies&&r.push(()=>J(t,void 0,e.fix)),e.structure&&r.push(()=>X(t));for(let e of r)await e()||(n=!1)}n||(u.error(`Some audits failed`),process.exit(1))}}),te=c({meta:{name:`add`,description:`Add dependencies`},args:{dev:{type:`boolean`,description:`Add as dev dependency`,alias:`D`}},async run({args:e,rawArgs:t}){t.length===0&&(u.error(`Please specify at least one package name`),u.info(`Example: basis add lodash`),process.exit(1));let n=t.filter(e=>!e.startsWith(`-`));n.length===0&&(u.error(`Please specify at least one package name`),process.exit(1));try{e.dev?(await _(n,{cwd:process.cwd()}),u.success(`Added ${n.join(`, `)} as dev dependencies`)):(await g(n,{cwd:process.cwd()}),u.success(`Added ${n.join(`, `)} as dependencies`))}catch(e){u.error(`Add packages failed:`,e),process.exit(1)}}}),ne=c({meta:{name:`remove`,description:`Remove dependencies`},async run({rawArgs:e}){e.length===0&&(u.error(`Please specify at least one package name`),u.info(`Example: basis remove lodash`),process.exit(1));let t=e.filter(e=>!e.startsWith(`-`));t.length===0&&(u.error(`Please specify at least one package name`),process.exit(1));try{await b(t,{cwd:process.cwd()}),u.success(`Removed ${t.join(`, `)}`)}catch(e){u.error(`Remove packages failed:`,e),process.exit(1)}}}),re=c({meta:{name:`dlx`,description:`Execute package without installation`},async run({rawArgs:e}){try{e.length===0&&(u.error(`Please specify a package to run`),process.exit(1));let[t,...n]=e;await y(t,{args:n,cwd:process.cwd()}),u.success(`Dlx completed`)}catch(e){u.error(`Dlx failed:`,e),process.exit(1)}}}),$=await i(import.meta.url);l(c({meta:{name:`basis`,description:$.description,version:$.version},subCommands:{init:A,lint:t,fmt:n,build:j,git:B,run:V,version:U,publish:K,audit:Q,add:te,remove:ne,dlx:re}}));export{};
|
|
2
|
+
import"../_chunks/utils-C__9zeRd.mjs";import"../_chunks/git-CsvFrMBz.mjs";import"../_chunks/version-NE9KAeIW.mjs";import"../_chunks/publish-X1rdYmns.mjs";import"../_chunks/audit-oeZItYVw.mjs";import"../_chunks/run-huXNTaib.mjs";import"../_chunks/init-oQhqxdPm.mjs";import{initCommand as e}from"../commands/init.mjs";import{lintCommand as t}from"../commands/lint.mjs";import{fmtCommand as n}from"../commands/fmt.mjs";import{buildCommand as r}from"../commands/build.mjs";import{gitCommand as i}from"../commands/git.mjs";import{runCommand as a}from"../commands/run.mjs";import{versionCommand as o}from"../commands/version.mjs";import{publishCommand as s}from"../commands/publish.mjs";import{auditCommand as c}from"../commands/audit.mjs";import{addCommand as l}from"../commands/add.mjs";import{removeCommand as u}from"../commands/remove.mjs";import{dlxCommand as d}from"../commands/dlx.mjs";import{readPackageJSON as f}from"pkg-types";import{defineCommand as p,runMain as m}from"citty";const h=await f(import.meta.url);m(p({meta:{name:`basis`,description:h.description,version:h.version},subCommands:{init:e,lint:t,fmt:n,build:r,git:i,run:a,version:o,publish:s,audit:c,add:l,remove:u,dlx:d}}));export{};
|
package/dist/cli/oxfmt.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"../_chunks/
|
|
2
|
+
import"../_chunks/utils-C__9zeRd.mjs";import"../_chunks/run-huXNTaib.mjs";import{fmtCommand as e}from"../commands/fmt.mjs";import{runCommand as t}from"citty";t(e,{rawArgs:process.argv.slice(2),showUsage:!1});export{};
|
package/dist/cli/oxlint.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"../_chunks/
|
|
2
|
+
import"../_chunks/utils-C__9zeRd.mjs";import"../_chunks/run-huXNTaib.mjs";import{lintCommand as e}from"../commands/lint.mjs";import{runCommand as t}from"citty";t(e,{rawArgs:process.argv.slice(2),showUsage:!1});export{};
|
package/dist/cli/tsgolint.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"../_chunks/run-
|
|
2
|
+
import{t as e}from"../_chunks/run-huXNTaib.mjs";import{defineCommand as t,runCommand as n}from"citty";n(t({meta:{name:`tsgolint`,description:`Lint TypeScript with tsgolint rules`},async run({rawArgs:t}){let n=e({pkg:`oxlint-tsgolint/bin/tsgolint.js`,bin:`tsgolint.js`,args:t});n.status!==0&&process.exit(n.status)}}),{rawArgs:process.argv.slice(2),showUsage:!1});export{};
|
package/dist/commands/add.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/add.d.ts
|
|
4
|
+
declare const addCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { addCommand };
|
package/dist/commands/add.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{consola as e}from"consola";import{addDependency as t,addDevDependency as n}from"nypm";import{defineCommand as r}from"citty";const i=r({meta:{name:`add`,description:`Add dependencies`},args:{dev:{type:`boolean`,description:`Add as dev dependency`,alias:`D`}},async run({args:r,rawArgs:i}){let a=i.filter(e=>!e.startsWith(`-`));a.length===0&&(e.error(`Package name required`),e.info(`Example: basis add lodash`),process.exit(1));try{r.dev?(await n(a,{cwd:process.cwd()}),e.success(`Added ${a.join(`, `)} as dev dependencies`)):(await t(a,{cwd:process.cwd()}),e.success(`Added ${a.join(`, `)}`))}catch(t){e.error(`Failed to add packages:`,t),process.exit(1)}}});export{i as addCommand};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/audit.d.ts
|
|
4
|
+
declare const auditCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { auditCommand };
|
package/dist/commands/audit.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import"../_chunks/utils-C__9zeRd.mjs";import{n as e,r as t,t as n}from"../_chunks/audit-oeZItYVw.mjs";import{consola as r}from"consola";import{defineCommand as i}from"citty";const a=i({meta:{name:`audit`,description:`Audit code quality`},args:{dependencies:{type:`boolean`,description:`Dependencies audit`},structure:{type:`boolean`,description:`Project structure audit`},fix:{type:`boolean`,description:`Auto-fix issues`}},async run({args:i}){let a=process.cwd(),o=!0;if(!i.dependencies&&!i.structure)o=await n(a,i.fix);else{let n=[];i.dependencies&&n.push(()=>e(a,void 0,i.fix)),i.structure&&n.push(()=>t(a));for(let e of n)await e()||(o=!1)}o||(r.error(`Some audits failed`),process.exit(1))}});export{a as auditCommand};
|
|
@@ -1,2 +1,225 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as citty from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/build.d.ts
|
|
4
|
+
declare const buildCommand: {
|
|
5
|
+
meta: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
args?: citty.Resolvable<{
|
|
11
|
+
readonly _: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Entry files";
|
|
14
|
+
readonly rest: true;
|
|
15
|
+
};
|
|
16
|
+
readonly cwd: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly description: "Project directory";
|
|
19
|
+
readonly default: ".";
|
|
20
|
+
};
|
|
21
|
+
readonly stub: {
|
|
22
|
+
readonly type: "boolean";
|
|
23
|
+
readonly description: "Generate stub files";
|
|
24
|
+
};
|
|
25
|
+
readonly format: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly description: "Output format: esm, cjs, iife, umd";
|
|
28
|
+
};
|
|
29
|
+
readonly minify: {
|
|
30
|
+
readonly type: "boolean";
|
|
31
|
+
readonly description: "Minify output";
|
|
32
|
+
};
|
|
33
|
+
readonly dts: {
|
|
34
|
+
readonly type: "boolean";
|
|
35
|
+
readonly description: "Generate type declarations";
|
|
36
|
+
};
|
|
37
|
+
readonly "out-dir": {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly description: "Output directory";
|
|
40
|
+
};
|
|
41
|
+
readonly clean: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
readonly description: "Clean output directory before build";
|
|
44
|
+
readonly default: true;
|
|
45
|
+
};
|
|
46
|
+
readonly external: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
readonly description: "External dependencies (comma-separated)";
|
|
49
|
+
};
|
|
50
|
+
readonly watch: {
|
|
51
|
+
readonly type: "boolean";
|
|
52
|
+
readonly description: "Watch mode";
|
|
53
|
+
};
|
|
54
|
+
readonly config: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly description: "Path to config file";
|
|
57
|
+
};
|
|
58
|
+
readonly "no-config": {
|
|
59
|
+
readonly type: "boolean";
|
|
60
|
+
readonly description: "Disable config file";
|
|
61
|
+
};
|
|
62
|
+
}> | undefined;
|
|
63
|
+
subCommands?: citty.Resolvable<citty.SubCommandsDef>;
|
|
64
|
+
setup?: ((context: citty.CommandContext<{
|
|
65
|
+
readonly _: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
readonly description: "Entry files";
|
|
68
|
+
readonly rest: true;
|
|
69
|
+
};
|
|
70
|
+
readonly cwd: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly description: "Project directory";
|
|
73
|
+
readonly default: ".";
|
|
74
|
+
};
|
|
75
|
+
readonly stub: {
|
|
76
|
+
readonly type: "boolean";
|
|
77
|
+
readonly description: "Generate stub files";
|
|
78
|
+
};
|
|
79
|
+
readonly format: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly description: "Output format: esm, cjs, iife, umd";
|
|
82
|
+
};
|
|
83
|
+
readonly minify: {
|
|
84
|
+
readonly type: "boolean";
|
|
85
|
+
readonly description: "Minify output";
|
|
86
|
+
};
|
|
87
|
+
readonly dts: {
|
|
88
|
+
readonly type: "boolean";
|
|
89
|
+
readonly description: "Generate type declarations";
|
|
90
|
+
};
|
|
91
|
+
readonly "out-dir": {
|
|
92
|
+
readonly type: "string";
|
|
93
|
+
readonly description: "Output directory";
|
|
94
|
+
};
|
|
95
|
+
readonly clean: {
|
|
96
|
+
readonly type: "boolean";
|
|
97
|
+
readonly description: "Clean output directory before build";
|
|
98
|
+
readonly default: true;
|
|
99
|
+
};
|
|
100
|
+
readonly external: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
readonly description: "External dependencies (comma-separated)";
|
|
103
|
+
};
|
|
104
|
+
readonly watch: {
|
|
105
|
+
readonly type: "boolean";
|
|
106
|
+
readonly description: "Watch mode";
|
|
107
|
+
};
|
|
108
|
+
readonly config: {
|
|
109
|
+
readonly type: "string";
|
|
110
|
+
readonly description: "Path to config file";
|
|
111
|
+
};
|
|
112
|
+
readonly "no-config": {
|
|
113
|
+
readonly type: "boolean";
|
|
114
|
+
readonly description: "Disable config file";
|
|
115
|
+
};
|
|
116
|
+
}>) => any | Promise<any>) | undefined;
|
|
117
|
+
cleanup?: ((context: citty.CommandContext<{
|
|
118
|
+
readonly _: {
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
readonly description: "Entry files";
|
|
121
|
+
readonly rest: true;
|
|
122
|
+
};
|
|
123
|
+
readonly cwd: {
|
|
124
|
+
readonly type: "string";
|
|
125
|
+
readonly description: "Project directory";
|
|
126
|
+
readonly default: ".";
|
|
127
|
+
};
|
|
128
|
+
readonly stub: {
|
|
129
|
+
readonly type: "boolean";
|
|
130
|
+
readonly description: "Generate stub files";
|
|
131
|
+
};
|
|
132
|
+
readonly format: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly description: "Output format: esm, cjs, iife, umd";
|
|
135
|
+
};
|
|
136
|
+
readonly minify: {
|
|
137
|
+
readonly type: "boolean";
|
|
138
|
+
readonly description: "Minify output";
|
|
139
|
+
};
|
|
140
|
+
readonly dts: {
|
|
141
|
+
readonly type: "boolean";
|
|
142
|
+
readonly description: "Generate type declarations";
|
|
143
|
+
};
|
|
144
|
+
readonly "out-dir": {
|
|
145
|
+
readonly type: "string";
|
|
146
|
+
readonly description: "Output directory";
|
|
147
|
+
};
|
|
148
|
+
readonly clean: {
|
|
149
|
+
readonly type: "boolean";
|
|
150
|
+
readonly description: "Clean output directory before build";
|
|
151
|
+
readonly default: true;
|
|
152
|
+
};
|
|
153
|
+
readonly external: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
readonly description: "External dependencies (comma-separated)";
|
|
156
|
+
};
|
|
157
|
+
readonly watch: {
|
|
158
|
+
readonly type: "boolean";
|
|
159
|
+
readonly description: "Watch mode";
|
|
160
|
+
};
|
|
161
|
+
readonly config: {
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
readonly description: "Path to config file";
|
|
164
|
+
};
|
|
165
|
+
readonly "no-config": {
|
|
166
|
+
readonly type: "boolean";
|
|
167
|
+
readonly description: "Disable config file";
|
|
168
|
+
};
|
|
169
|
+
}>) => any | Promise<any>) | undefined;
|
|
170
|
+
run?: ((context: citty.CommandContext<{
|
|
171
|
+
readonly _: {
|
|
172
|
+
readonly type: "string";
|
|
173
|
+
readonly description: "Entry files";
|
|
174
|
+
readonly rest: true;
|
|
175
|
+
};
|
|
176
|
+
readonly cwd: {
|
|
177
|
+
readonly type: "string";
|
|
178
|
+
readonly description: "Project directory";
|
|
179
|
+
readonly default: ".";
|
|
180
|
+
};
|
|
181
|
+
readonly stub: {
|
|
182
|
+
readonly type: "boolean";
|
|
183
|
+
readonly description: "Generate stub files";
|
|
184
|
+
};
|
|
185
|
+
readonly format: {
|
|
186
|
+
readonly type: "string";
|
|
187
|
+
readonly description: "Output format: esm, cjs, iife, umd";
|
|
188
|
+
};
|
|
189
|
+
readonly minify: {
|
|
190
|
+
readonly type: "boolean";
|
|
191
|
+
readonly description: "Minify output";
|
|
192
|
+
};
|
|
193
|
+
readonly dts: {
|
|
194
|
+
readonly type: "boolean";
|
|
195
|
+
readonly description: "Generate type declarations";
|
|
196
|
+
};
|
|
197
|
+
readonly "out-dir": {
|
|
198
|
+
readonly type: "string";
|
|
199
|
+
readonly description: "Output directory";
|
|
200
|
+
};
|
|
201
|
+
readonly clean: {
|
|
202
|
+
readonly type: "boolean";
|
|
203
|
+
readonly description: "Clean output directory before build";
|
|
204
|
+
readonly default: true;
|
|
205
|
+
};
|
|
206
|
+
readonly external: {
|
|
207
|
+
readonly type: "string";
|
|
208
|
+
readonly description: "External dependencies (comma-separated)";
|
|
209
|
+
};
|
|
210
|
+
readonly watch: {
|
|
211
|
+
readonly type: "boolean";
|
|
212
|
+
readonly description: "Watch mode";
|
|
213
|
+
};
|
|
214
|
+
readonly config: {
|
|
215
|
+
readonly type: "string";
|
|
216
|
+
readonly description: "Path to config file";
|
|
217
|
+
};
|
|
218
|
+
readonly "no-config": {
|
|
219
|
+
readonly type: "boolean";
|
|
220
|
+
readonly description: "Disable config file";
|
|
221
|
+
};
|
|
222
|
+
}>) => any | Promise<any>) | undefined;
|
|
223
|
+
};
|
|
224
|
+
//#endregion
|
|
225
|
+
export { buildCommand };
|
package/dist/commands/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{buildCommand as e}from"@funish/build/command";const t={...e,meta:{name:`build`,description:`Build project using @funish/build`,version:``}};export{t as buildCommand};
|
package/dist/commands/dlx.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/dlx.d.ts
|
|
4
|
+
declare const dlxCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { dlxCommand };
|
package/dist/commands/dlx.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{consola as e}from"consola";import{dlx as t}from"nypm";import{defineCommand as n}from"citty";const r=n({meta:{name:`dlx`,description:`Execute package without installation`},async run({rawArgs:n}){try{n.length===0&&(e.error(`Please specify a package to run`),process.exit(1));let[r,...i]=n;await t(r,{args:i,cwd:process.cwd()}),e.success(`Dlx completed`)}catch(t){e.error(`Dlx failed:`,t),process.exit(1)}}});export{r as dlxCommand};
|
package/dist/commands/fmt.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/fmt.d.ts
|
|
4
|
+
declare const fmtCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { fmtCommand };
|
package/dist/commands/fmt.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"../_chunks/utils-C__9zeRd.mjs";import{t}from"../_chunks/run-huXNTaib.mjs";import{defineCommand as n}from"citty";const r=n({meta:{name:`fmt`,description:`Format code`},async run({rawArgs:n}){let{config:r}=await e(),i=r.fmt?.config||[];t({pkg:`oxfmt`,bin:`cli.js`,args:n.length>0?n:i}).status!==0&&process.exit(1)}});export{r as fmtCommand};
|
package/dist/commands/git.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/git.d.ts
|
|
4
|
+
declare const gitCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { gitCommand };
|
package/dist/commands/git.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import"../_chunks/utils-C__9zeRd.mjs";import{i as e,o as t,r as n}from"../_chunks/git-CsvFrMBz.mjs";import{exec as r}from"dugite";import{consola as i}from"consola";import{defineCommand as a}from"citty";const o=a({meta:{name:`git`,description:`Git operations`},async run({rawArgs:a}){let o=a[0];if(!o){i.info(`Available subcommands: staged, lint-commit, setup`),i.info(`Git passthrough mode: basis git <git-command>`);return}switch(o){case`staged`:await e()||process.exit(1);return;case`lint-commit`:await n()||process.exit(1);return;case`setup`:await t()||process.exit(1);return;default:try{let e=await r(a,process.cwd(),{processCallback:e=>{e.stdout?.on(`data`,e=>{process.stdout.write(e)}),e.stderr?.on(`data`,e=>{process.stderr.write(e)})}});if(e.exitCode!==0)throw Error(`git exited with code ${e.exitCode}`)}catch(e){i.error(`Git operation failed:`,e),process.exit(1)}}}});export{o as gitCommand};
|
package/dist/commands/init.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/init.d.ts
|
|
4
|
+
declare const initCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { initCommand };
|
package/dist/commands/init.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"../_chunks/init-oQhqxdPm.mjs";import{consola as t}from"consola";import{defineCommand as n}from"citty";const r=n({meta:{name:`init`,description:`Initialize configuration`},args:{force:{type:`boolean`,description:`Overwrite existing configuration`},"skip-git-check":{type:`boolean`,description:`Skip git directory check`},"skip-install":{type:`boolean`,description:`Skip dependency installation`}},async run({args:n}){try{await e(process.cwd(),{force:n.force,skipGitCheck:n[`skip-git-check`],skipInstall:n[`skip-install`]})}catch(e){t.error(`Init failed:`,e),process.exit(1)}}});export{r as initCommand};
|
package/dist/commands/lint.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/lint.d.ts
|
|
4
|
+
declare const lintCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { lintCommand };
|
package/dist/commands/lint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"../_chunks/utils-C__9zeRd.mjs";import{t}from"../_chunks/run-huXNTaib.mjs";import{defineCommand as n}from"citty";const r=n({meta:{name:`lint`,description:`Lint code`},async run({rawArgs:n}){let{config:r}=await e(),i=r.lint?.config||[];t({pkg:`oxlint`,bin:`cli.js`,args:n.length>0?n:i}).status!==0&&process.exit(1)}});export{r as lintCommand};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/publish.d.ts
|
|
4
|
+
declare const publishCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { publishCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"../_chunks/utils-C__9zeRd.mjs";import{n as t,t as n}from"../_chunks/publish-X1rdYmns.mjs";import{readPackageJSON as r}from"pkg-types";import{consola as i}from"consola";import{defineCommand as a}from"citty";const o=a({meta:{name:`publish`,description:`Publish to registry`},args:{tag:{type:`string`,description:`Publish tag`},git:{type:`boolean`,description:`Also create git tag and commit`},access:{type:`string`,description:`Package access level (public, restricted)`},"dry-run":{type:`boolean`,description:`Dry run mode`},otp:{type:`string`,description:`One-time password for 2FA`}},async run({args:a}){try{let{config:o}=await e();if(await t({tag:a.tag,git:a.git,access:a.access||void 0,dryRun:a[`dry-run`],otp:a.otp},o.publish||{}),i.success(`Package published successfully`),a.git&&o.publish?.git){i.info(`Creating git tag and commit...`);let e=(await r(process.cwd())).version;e&&(await n(e,o.publish.git),i.success(`Git operations completed`))}}catch(e){i.error(`Publish failed:`,e),process.exit(1)}}});export{o as publishCommand};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/remove.d.ts
|
|
4
|
+
declare const removeCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { removeCommand };
|
package/dist/commands/remove.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{consola as e}from"consola";import{removeDependency as t}from"nypm";import{defineCommand as n}from"citty";const r=n({meta:{name:`remove`,description:`Remove dependencies`},async run({rawArgs:n}){let r=n.filter(e=>!e.startsWith(`-`));r.length===0&&(e.error(`Package name required`),e.info(`Example: basis remove lodash`),process.exit(1));try{await t(r,{cwd:process.cwd()}),e.success(`Removed ${r.join(`, `)}`)}catch(t){e.error(`Failed to remove packages:`,t),process.exit(1)}}});export{r as removeCommand};
|
package/dist/commands/run.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/run.d.ts
|
|
4
|
+
declare const runCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { runCommand };
|
package/dist/commands/run.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"../_chunks/utils-C__9zeRd.mjs";import{resolve as t}from"pathe";import{consola as n}from"consola";import{runScript as r}from"nypm";import{defineCommand as i}from"citty";import{createJiti as a}from"jiti";import{existsSync as o}from"node:fs";const s=i({meta:{name:`run`,description:`Run scripts or files`},async run({rawArgs:i}){i.length===0&&(n.error(`Script name or file path required`),process.exit(1));let[s,...c]=i,l=process.cwd(),{config:u}=await e(),d=u.run?.config,f=t(l,s);if(o(f))try{let e=a(l,d),t=e.esmResolve(f);process.argv=[process.argv[0],t,...i.slice(1)],await e.import(t);return}catch(e){n.error(`Failed to run file:`,e),process.exit(1)}try{await r(s,{cwd:l,args:c})}catch(e){n.error(`Failed to run script "${s}":`,e),process.exit(1)}}});export{s as runCommand};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ArgsDef, CommandDef } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/version.d.ts
|
|
4
|
+
declare const versionCommand: CommandDef<ArgsDef>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { versionCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"../_chunks/utils-C__9zeRd.mjs";import{t}from"../_chunks/version-NE9KAeIW.mjs";import{readPackageJSON as n,resolvePackageJSON as r,writePackageJSON as i}from"pkg-types";import{consola as a}from"consola";import{defineCommand as o}from"citty";const s=o({meta:{name:`version`,description:`Update package version`},args:{version:{type:`positional`,description:`Version to set (patch, minor, major, prerelease, or specific version)`,required:!1},preid:{type:`string`,description:`Prerelease identifier (alpha, beta, rc)`},major:{type:`boolean`,description:`Bump major version`},minor:{type:`boolean`,description:`Bump minor version`},patch:{type:`boolean`,description:`Bump patch version`},premajor:{type:`boolean`,description:`Bump premajor version`},preminor:{type:`boolean`,description:`Bump preminor version`},prepatch:{type:`boolean`,description:`Bump prepatch version`},prerelease:{type:`boolean`,description:`Bump prerelease version`},"allow-same-version":{type:`boolean`,description:`Allow same version`}},async run({args:o}){try{let{config:s}=await e(),c={preid:o.preid,major:o.major,minor:o.minor,patch:o.patch||!o.major&&!o.minor&&!o.version,premajor:o.premajor,preminor:o.preminor,prepatch:o.prepatch,prerelease:o.prerelease,allowSameVersion:o[`allow-same-version`]};if(o.version){let e=o.version;[`patch`,`minor`,`major`,`prerelease`,`premajor`,`preminor`,`prepatch`].includes(e)?c[e]=!0:c.version=e}let l=process.cwd(),u=await n(l),d=u.version;if(!d)throw Error(`No version found in package.json`);let f=t(d,c,s.version||{});if(!c.allowSameVersion&&f===d)throw Error(`Version unchanged: ${d}. Use --allow-same-version to allow this.`);await i(await r(l),{...u,version:f}),a.success(`Version updated: ${d} → ${f}`)}catch(e){a.error(`Version update failed:`,e),process.exit(1)}}});export{s as versionCommand};
|
package/dist/config.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as c12 from "c12";
|
|
3
|
-
import { LoadConfigOptions } from "c12";
|
|
1
|
+
import { n as BasisConfig } from "./_chunks/types-BEJ3zuUY.mjs";
|
|
4
2
|
import { defineBuildConfig } from "@funish/build/config";
|
|
5
3
|
|
|
6
4
|
//#region src/config.d.ts
|
|
@@ -8,18 +6,5 @@ import { defineBuildConfig } from "@funish/build/config";
|
|
|
8
6
|
* Define a Basis configuration
|
|
9
7
|
*/
|
|
10
8
|
declare function defineBasisConfig(config: BasisConfig): BasisConfig;
|
|
11
|
-
/**
|
|
12
|
-
* Load Basis configuration with intelligent upward search
|
|
13
|
-
*/
|
|
14
|
-
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<c12.ResolvedConfig<{
|
|
15
|
-
extends?: string | string[];
|
|
16
|
-
lint?: LintConfig;
|
|
17
|
-
fmt?: FmtConfig;
|
|
18
|
-
git?: GitConfig;
|
|
19
|
-
run?: RunConfig;
|
|
20
|
-
audit?: AuditConfig;
|
|
21
|
-
version?: VersionConfig;
|
|
22
|
-
publish?: PublishConfig;
|
|
23
|
-
}, c12.ConfigLayerMeta>>;
|
|
24
9
|
//#endregion
|
|
25
|
-
export { defineBasisConfig, defineBuildConfig
|
|
10
|
+
export { type BasisConfig, defineBasisConfig, defineBuildConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{defineBuildConfig as e}from"@funish/build/config";function t(e){return e}export{t as defineBasisConfig,e as defineBuildConfig};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,109 @@
|
|
|
1
|
-
import { a as FmtConfig, c as LintConfig, d as RunConfig, f as StagedConfig, g as VersionOptions, h as VersionConfig, i as CommitMsgConfig, l as PublishConfig, m as ValidGitHook, n as BasisConfig, o as GitConfig, p as VALID_GIT_HOOKS, r as CommitMessage, s as InitOptions, t as AuditConfig, u as PublishOptions } from "./_chunks/types-
|
|
2
|
-
|
|
1
|
+
import { a as FmtConfig, c as LintConfig, d as RunConfig, f as StagedConfig, g as VersionOptions, h as VersionConfig, i as CommitMsgConfig, l as PublishConfig, m as ValidGitHook, n as BasisConfig, o as GitConfig, p as VALID_GIT_HOOKS, r as CommitMessage, s as InitOptions, t as AuditConfig, u as PublishOptions } from "./_chunks/types-BEJ3zuUY.mjs";
|
|
2
|
+
import * as c12 from "c12";
|
|
3
|
+
import { LoadConfigOptions } from "c12";
|
|
4
|
+
import { SpawnSyncReturns } from "node:child_process";
|
|
5
|
+
|
|
6
|
+
//#region src/utils.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Load Basis configuration with intelligent upward search
|
|
9
|
+
*/
|
|
10
|
+
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<c12.ResolvedConfig<{
|
|
11
|
+
extends?: string | string[];
|
|
12
|
+
lint?: LintConfig;
|
|
13
|
+
fmt?: FmtConfig;
|
|
14
|
+
git?: GitConfig;
|
|
15
|
+
run?: RunConfig;
|
|
16
|
+
audit?: AuditConfig;
|
|
17
|
+
version?: VersionConfig;
|
|
18
|
+
publish?: PublishConfig;
|
|
19
|
+
}, c12.ConfigLayerMeta>>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/modules/git.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* Setup Git environment using dugite's setupEnvironment
|
|
24
|
+
* This ensures dugite can find the system Git or use embedded Git correctly
|
|
25
|
+
*/
|
|
26
|
+
declare function setupGitEnvironment(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get staged files (only existing files, not deleted ones)
|
|
29
|
+
*/
|
|
30
|
+
declare function getStagedFiles(cwd: string): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Lint staged files
|
|
33
|
+
*/
|
|
34
|
+
declare function lintStagedFiles(cwd?: string): Promise<boolean>;
|
|
35
|
+
declare const DEFAULT_TYPES: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Parse commit message into structured format
|
|
38
|
+
*/
|
|
39
|
+
declare function parseCommitMessage(message: string): {
|
|
40
|
+
type: string;
|
|
41
|
+
scope?: string;
|
|
42
|
+
subject?: string;
|
|
43
|
+
isBreaking: boolean;
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* Validate commit message
|
|
47
|
+
*/
|
|
48
|
+
declare function lintCommitMessage(cwd?: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Setup Git hooks
|
|
51
|
+
*/
|
|
52
|
+
declare function setupGitHooks(cwd?: string): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Setup complete Git configuration (hooks + config)
|
|
55
|
+
*/
|
|
56
|
+
declare function setupGit(cwd?: string): Promise<boolean>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/modules/version.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* Calculate new version based on options
|
|
61
|
+
*/
|
|
62
|
+
declare function calculateNewVersion(oldVersion: string, options: VersionOptions, config: VersionConfig): string;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/modules/publish.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* Publish package to npm registry
|
|
67
|
+
*/
|
|
68
|
+
declare function publishToNpm(options: PublishOptions, config: PublishConfig): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Git operations for publish
|
|
71
|
+
*/
|
|
72
|
+
declare function publishGitOperations(version: string, gitConfig?: PublishConfig["git"]): Promise<void>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/modules/audit.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* Audit dependencies
|
|
77
|
+
*/
|
|
78
|
+
declare function auditDependencies(cwd?: string, config?: AuditConfig["dependencies"], _fix?: boolean): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Find all package.json files in node_modules
|
|
81
|
+
*/
|
|
82
|
+
declare function findNodeModulesPackages(cwd: string): Promise<string[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Audit project structure
|
|
85
|
+
*/
|
|
86
|
+
declare function auditStructure(cwd?: string, config?: AuditConfig["structure"]): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Run all audits
|
|
89
|
+
*/
|
|
90
|
+
declare function auditAll(cwd?: string, fix?: boolean): Promise<boolean>;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/modules/run.d.ts
|
|
93
|
+
interface RunToolOptions {
|
|
94
|
+
pkg: string;
|
|
95
|
+
bin: string;
|
|
96
|
+
args: string[];
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Run Node.js CLI tool
|
|
100
|
+
*/
|
|
101
|
+
declare function runTool(opts: RunToolOptions): SpawnSyncReturns<Buffer>;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/modules/init.d.ts
|
|
104
|
+
/**
|
|
105
|
+
* Initialize basis configuration
|
|
106
|
+
*/
|
|
107
|
+
declare function initProject(cwd?: string, options?: InitOptions): Promise<boolean>;
|
|
108
|
+
//#endregion
|
|
109
|
+
export { AuditConfig, BasisConfig, CommitMessage, CommitMsgConfig, DEFAULT_TYPES, FmtConfig, GitConfig, InitOptions, LintConfig, PublishConfig, PublishOptions, RunConfig, RunToolOptions, StagedConfig, VALID_GIT_HOOKS, ValidGitHook, VersionConfig, VersionOptions, auditAll, auditDependencies, auditStructure, calculateNewVersion, findNodeModulesPackages, getStagedFiles, initProject, lintCommitMessage, lintStagedFiles, loadConfig, parseCommitMessage, publishGitOperations, publishToNpm, runTool, setupGit, setupGitEnvironment, setupGitHooks };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{t as e}from"./_chunks/utils-C__9zeRd.mjs";import{a as t,c as n,i as r,n as i,o as a,r as o,s,t as c}from"./_chunks/git-CsvFrMBz.mjs";import{t as l}from"./_chunks/version-NE9KAeIW.mjs";import{n as u,t as d}from"./_chunks/publish-X1rdYmns.mjs";import{i as f,n as p,r as m,t as h}from"./_chunks/audit-oeZItYVw.mjs";import{t as g}from"./_chunks/run-huXNTaib.mjs";import{t as _}from"./_chunks/init-oQhqxdPm.mjs";const v=`applypatch-msg.pre-applypatch.post-applypatch.pre-commit.pre-merge-commit.prepare-commit-msg.commit-msg.post-commit.pre-rebase.post-checkout.post-merge.pre-push.pre-receive.update.proc-receive.post-receive.post-update.reference-transaction.push-to-checkout.pre-auto-gc.post-rewrite.sendemail-validate.fsmonitor-watchman.p4-changelist.p4-prepare-changelist.p4-post-changelist.p4-pre-submit.post-index-change`.split(`.`);export{c as DEFAULT_TYPES,v as VALID_GIT_HOOKS,h as auditAll,p as auditDependencies,m as auditStructure,l as calculateNewVersion,f as findNodeModulesPackages,i as getStagedFiles,_ as initProject,o as lintCommitMessage,r as lintStagedFiles,e as loadConfig,t as parseCommitMessage,d as publishGitOperations,u as publishToNpm,g as runTool,a as setupGit,s as setupGitEnvironment,n as setupGitHooks};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funish/basis",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9-edge.0",
|
|
4
4
|
"description": "A modern development toolkit with unified CLI for package management, versioning, publishing, code quality, and Git workflow automation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"basis",
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
"types": "./dist/config.d.mts",
|
|
61
61
|
"import": "./dist/config.mjs"
|
|
62
62
|
},
|
|
63
|
+
"./cli/*": {
|
|
64
|
+
"types": "./dist/cli/*.d.mts",
|
|
65
|
+
"import": "./dist/cli/*.mjs"
|
|
66
|
+
},
|
|
63
67
|
"./commands/*": {
|
|
64
68
|
"types": "./dist/commands/*.d.mts",
|
|
65
69
|
"import": "./dist/commands/*.mjs"
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
"pkg-types": "2.3.0",
|
|
81
85
|
"semver": "7.7.4",
|
|
82
86
|
"tinyglobby": "0.2.15",
|
|
83
|
-
"@funish/build": "0.0.
|
|
87
|
+
"@funish/build": "0.1.0-edge.0"
|
|
84
88
|
},
|
|
85
89
|
"devDependencies": {
|
|
86
90
|
"@types/picomatch": "4.0.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{loadConfig as e}from"c12";import{findWorkspaceDir as t}from"pkg-types";import{dirname as n}from"pathe";import{defineBuildConfig as r}from"@funish/build/config";function i(e){return e}async function a(r={}){if(r.cwd)return await e({name:`basis`,cwd:r.cwd,...r,defaults:{...r.defaults}});let i=process.cwd(),a=await t(i);for(;;){let t=await e({name:`basis`,cwd:i,...r,defaults:{...r.defaults}});if(t._configFile||i===a)return t;i=n(i)}}export{r as n,a as r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./config-lvw40IpZ.mjs";import{t}from"./run-D8ZiNeaU.mjs";import{defineCommand as n}from"citty";const r=n({meta:{name:`fmt`,description:`Format code`},async run({rawArgs:n}){let{config:r}=await e(),i=r.fmt?.config||[];t({pkg:`oxfmt`,bin:`cli.js`,args:n.length>0?n:i}).status!==0&&process.exit(1)}});export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./config-lvw40IpZ.mjs";import{t}from"./run-D8ZiNeaU.mjs";import{defineCommand as n}from"citty";const r=n({meta:{name:`lint`,description:`Lint code`},async run({rawArgs:n}){let{config:r}=await e(),i=r.lint?.config||[];t({pkg:`oxlint`,bin:`cli.js`,args:n.length>0?n:i}).status!==0&&process.exit(1)}});export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import{dirname as t,resolve as n}from"pathe";import{consola as r}from"consola";import{spawnSync as i}from"node:child_process";function a(a){let{pkg:o,bin:s,args:c}=a,l=n(t(e(import.meta.url).resolve(o)),s),u=i(process.execPath,[l,...c],{stdio:`inherit`,shell:!1});return u.error&&r.error(u.error),u.status!==0&&r.error(`${o} failed with exit code ${u.status}`),u}export{a as t};
|
|
File without changes
|