@deltabox/toolchain 1.2.3 → 1.3.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/CHANGELOG.md +137 -2
- package/README.md +8 -0
- package/dist/changelog.d.ts +2 -2
- package/dist/changelog.js +1 -1
- package/dist/cli/commands/projects.js +1 -1
- package/dist/cli/commands/providers.js +1 -1
- package/dist/cli/commands/reset.js +1 -1
- package/dist/cli/commands/sync.js +1 -1
- package/dist/cli/commands/watch.js +1 -1
- package/dist/cli/index.d.ts +33 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/register.js +1 -1
- package/dist/cli/update-check.js +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +1 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/changelog/src/cli/index.js +1 -1
- package/dist/packages/changelog/src/index.d.ts +3 -3
- package/dist/packages/changelog/src/index.js +1 -1
- package/dist/packages/changelog/src/run.js +1 -1
- package/dist/packages/changelog/src/templates.d.ts +1 -1
- package/dist/packages/changelog/src/templates.js +3 -3
- package/dist/packages/changelog/src/utils/format.js +5 -5
- package/dist/packages/changelog/src/utils/git.js +1 -1
- package/dist/packages/changelog/src/utils/reformat.js +4 -4
- package/dist/packages/changelog/src/utils/repo.js +1 -1
- package/dist/packages/changelog/src/utils/summary.d.ts +7 -0
- package/dist/packages/changelog/src/utils/summary.js +1 -1
- package/dist/packages/changelog/src/utils/version.js +5 -5
- package/dist/packages/changelog/src/utils/write.js +1 -1
- package/dist/packages/config/src/cli/index.js +1 -1
- package/dist/packages/config/src/generated-format.d.ts +42 -0
- package/dist/packages/config/src/generated-format.js +3 -0
- package/dist/packages/config/src/generators/types.js +3 -1
- package/dist/packages/config/src/index.d.ts +3 -2
- package/dist/packages/config/src/index.js +1 -1
- package/dist/packages/core/src/gitignore.d.ts +19 -0
- package/dist/packages/core/src/gitignore.js +7 -0
- package/dist/packages/core/src/index.d.ts +3 -2
- package/dist/packages/core/src/index.js +1 -1
- package/dist/packages/core/src/loader.js +1 -1
- package/dist/packages/core/src/sync.d.ts +1 -1
- package/dist/packages/core/src/sync.js +1 -1
- package/dist/packages/core/src/watch.js +1 -1
- package/dist/packages/migrate/src/cli/index.js +1 -1
- package/dist/packages/migrate/src/oxfmt-map.js +1 -1
- package/dist/packages/project/src/cli/index.js +1 -1
- package/dist/packages/shared/src/config-schema.d.ts +100 -0
- package/dist/packages/shared/src/config-schema.js +1 -1
- package/dist/packages/shared/src/config-types.d.ts +68 -217
- package/dist/packages/shared/src/index.d.ts +5 -4
- package/dist/packages/shared/src/index.js +1 -1
- package/dist/packages/shared/src/logger.d.ts +68 -0
- package/dist/packages/shared/src/logger.js +1 -0
- package/dist/packages/shared/src/run.js +1 -1
- package/dist/packages/shared/src/toolchain.d.ts +9 -7
- package/dist/packages/shared/src/toolchain.js +1 -1
- package/dist/packages/template/src/cli/index.js +1 -1
- package/dist/packages/template/src/scaffold.js +1 -1
- package/dist/packages/tsconfig/src/cli/generate/index.js +1 -1
- package/dist/packages/tsconfig/src/cli/generate/utils.js +1 -1
- package/dist/packages/tsdown/src/cleanup.js +1 -1
- package/dist/packages/vite/src/cli/index.d.ts +5 -1
- package/dist/packages/vite/src/cli/index.js +1 -1
- package/dist/packages/vite/src/commands.d.ts +6 -0
- package/dist/packages/vite/src/commands.js +1 -1
- package/dist/packages/vite/src/index.d.ts +3 -3
- package/dist/packages/vite/src/index.js +1 -1
- package/dist/packages/vite/src/vp.d.ts +6 -0
- package/dist/packages/vite/src/vp.js +1 -1
- package/dist/shared.d.ts +4 -3
- package/dist/shared.js +1 -1
- package/dist/sync.js +1 -1
- package/dist/vite.d.ts +3 -3
- package/dist/vite.js +1 -1
- package/package.json +13 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import{fileURLToPath as t}from"node:url";import.meta.url;import{
|
|
1
|
+
import{resolve as e}from"node:path";import{fileURLToPath as t}from"node:url";import.meta.url;import{logger as n}from"../../shared/src/logger.js";import"../../shared/src/index.js";import{parseArgsCli as r}from"./utils/args.js";import{deriveBump as i,readCommits as a}from"./utils/git.js";import{changelogFiles as o,readRootVersion as s,repoRoot as c,writeVersion as l}from"./utils/repo.js";import{packageChangesForCurrent as u}from"./utils/packages.js";import"./utils/format.js";import{bumpVersion as d,insertNewEntry as f,renderChangelogEntry as p,retagChangelogs as m}from"./utils/version.js";import{formatExistingChangelogs as h,parseExistingChangelog as g,reformatRootChangelog as _}from"./utils/reformat.js";import{buildSummary as v}from"./utils/summary.js";import{writeChangelogs as y}from"./utils/write.js";import{existsSync as b,readFileSync as x,realpathSync as S,writeFileSync as C}from"node:fs";function w(t=process.argv.slice(2)){let S=r(t);if(S.formatOnly){n.info(`[format-only] Reformatting ${o().length} changelog file(s)${S.dryRun?` (dry run)`:``}.`),h(S.dryRun,S.packageChanges);return}let w=s();if(S.version){let e=S.version.trim();if(!/^\d+\.\d+\.\d+$/.test(e))throw Error(`Invalid version: ${e}`);if(e===w){n.info(`Version is already ${e}; nothing to do.`);return}l(e),m(w,e),n.info(`Retagged versions ${w} -> ${e}.`);return}let T=w;if(S.baseVersion){if(!/^\d+\.\d+\.\d+$/.test(S.baseVersion.trim()))throw Error(`Invalid base version: ${S.baseVersion}`);T=S.baseVersion.trim()}let E=S.processingMethod,D=E===`all`,O=E!==`latest`&&E!==`all`?E:S.range,k=a(O),A=i(k),j=v(k),M=d(T,A);if(S.dryRun){let t=c(),r=e(t,`CHANGELOG.md`),i=b(r)?x(r,`utf8`):``,a=g(i)[0]?.version,o=S.packageChanges&&a?u(a):``,s=p(M,j,/* @__PURE__ */ new Date,!0,o);n.info(`[DRY-RUN] Range: ${O}`),n.info(`[DRY-RUN] Processing method: ${E}${D?` (backward reformat)`:``}`),n.info(`[DRY-RUN] Bump: ${A} (\`${T}\` -> \`${M}\`)`),n.info(`[DRY-RUN] ${k.length} commit(s) scanned. Project files untouched.`),n.info(``),n.info(`Proposed new CHANGELOG.md entry (new version only):`),n.info(``),n.raw(s),n.info(`--- end of proposed entry ---`);let l=D?_(S.packageChanges):i,d=f(l,s),m=e(t,`CHANGELOG.proposed.md`);C(m,d,`utf8`),n.info(`Wrote ${m}`)}else l(M),y(M,O,k,j,D,S.packageChanges),n.info(`Bumped ${T} -> ${M} (${A}) from ${k.length} commit(s).`)}const T=w,E=t(import.meta.url);process.argv[1]&&/[\\/]run\.[cm]?[jt]s$/.test(E)&&D(process.argv[1])===E&&w();function D(e){try{return S(e)}catch{return e}}export{T as main,w as runChangelog};
|
|
@@ -12,7 +12,7 @@ export interface CommitlintOptions {
|
|
|
12
12
|
/** Allowed scopes (only enforced when a scope is present). */
|
|
13
13
|
scopes?: string[];
|
|
14
14
|
}
|
|
15
|
-
/** Render a `commitlint.config.mjs` module string (Oxfmt-
|
|
15
|
+
/** Render a `commitlint.config.mjs` module string (Oxfmt-idempotent). */
|
|
16
16
|
export declare function renderCommitlintConfig(options?: CommitlintOptions): string;
|
|
17
17
|
/** The recommended VS Code settings for Conventional Commits. */
|
|
18
18
|
export declare const conventionalCommitsVscodeSettings: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;const e=[`feat`,`fix`,`docs`,`codegen`,`style`,`refactor`,`perf`,`test`,`build`,`ci`,`chore`,`revert`,`release`],t=[`server`,`frontend`,`cli`,`sdk`,`scripts`,`shared`,`types`,`ci`,`docker`,`security`,`release`,`deps`];function n(n={}){let r=n.types??e,i=n.scopes??t,a=e=>e.map(e=>` '${e}',`).join(`
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;const e=[`feat`,`fix`,`docs`,`codegen`,`style`,`refactor`,`perf`,`test`,`build`,`ci`,`chore`,`revert`,`release`],t=[`server`,`frontend`,`cli`,`sdk`,`scripts`,`shared`,`types`,`ci`,`docker`,`security`,`release`,`deps`];function n(n={}){let r=n.types??e,i=n.scopes??t,a=(e,t)=>[` // ${t}`,...e.map(e=>` '${e}',`)].join(`
|
|
2
2
|
`);return`/**
|
|
3
3
|
* Conventional Commits enforcement (https://www.conventionalcommits.org/en/v1.0.0/).
|
|
4
4
|
* Generated by @deltabox/toolchain-changelog.
|
|
@@ -10,14 +10,14 @@ export default {
|
|
|
10
10
|
2,
|
|
11
11
|
'always',
|
|
12
12
|
[
|
|
13
|
-
${a(r)}
|
|
13
|
+
${a(r,`allowed commit types`)}
|
|
14
14
|
],
|
|
15
15
|
],
|
|
16
16
|
'scope-enum': [
|
|
17
17
|
2,
|
|
18
18
|
'always',
|
|
19
19
|
[
|
|
20
|
-
${a(i)}
|
|
20
|
+
${a(i,`allowed commit scopes`)}
|
|
21
21
|
],
|
|
22
22
|
],
|
|
23
23
|
'body-max-line-length': [0],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{readFileSync as
|
|
2
|
-
`)}function
|
|
3
|
-
`)){let e=r.trim();if(!e){n.length>0&&(t.push(n),n=[]);continue}if(e.startsWith(`-`)||e.startsWith(`*`)||/^[0-9]+[.)]/.test(e)||!e.replace(/(?:close[sd]?|fixe?s|fixed|resolves?|resolved)\b\s*:?\s*#\d+\s*[,;]?\s*/gi,``).trim())continue;let i=/^(BREAKING CHANGE|Reviewed-by|Signed-off-by|Co-authored-by|Acked-by|Co-developed-by|Helped-by|Reported-by|Suggested-by|Tested-by|Cc):\s+(.+)$/i.exec(e);i&&!/^(http|https)\b/.test(e)?(n.length>0&&(t.push(n),n=[]),t.push([`**${(i[1]??``).trim()}:** ${(i[2]??``).trim()}`])):n.push(e)}return n.length>0&&t.push(n),t}function
|
|
4
|
-
`).map(e=>
|
|
5
|
-
`);a
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{logger as e}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{readFileSync as t,writeFileSync as n}from"node:fs";const r={feat:`New features`,fix:`Bug fixes`,refactor:`Refactors`,docs:`Documentation`,style:`Styles`,chore:`Chores`,test:`Tests`,perf:`Performance`,build:`Build system`,ci:`CI`,revert:`Reverts`,breaking:`Breaking changes`},i=[`breaking`,`feat`,`fix`,`perf`,`refactor`,`docs`,`style`,`test`,`build`,`ci`,`chore`,`revert`];function a(e){return r[e]??r[e.toLowerCase()]??`Other changes`}function o(e){let t=/^([a-zA-Z][a-zA-Z0-9]*)(\(([^)]*)\))?(!)?:\s*(.*)$/.exec(e);return t?{type:t[1].toLowerCase(),scope:t[3]?.trim()||void 0,breaking:!!t[4],rest:t[5]??``}:{type:`chore`,breaking:!1,rest:e}}function s(e){let t=/* @__PURE__ */ new Map;for(let n of e){let{parsed:e}=n,r=t.get(e.type)??{title:a(e.type),ungrouped:[],scopes:/* @__PURE__ */ new Map};if(e.scope){let t=r.scopes.get(e.scope)??[];t.push(n),r.scopes.set(e.scope,t)}else r.ungrouped.push(n);t.set(e.type,r)}return[...t.entries()].sort((e,t)=>{let n=i.indexOf(e[0]),r=i.indexOf(t[0]);return(n===-1?i.length:n)-(r===-1?i.length:r)}).map(([,e])=>e)}function c(e){if(e.length===0)return`- No description provided.`;let t=[];for(let n of e){t.push(`### ${n.title}`);for(let e of n.ungrouped)t.push(e.text),t.push(...l(e.bodyParagraphs));for(let[e,r]of n.scopes){t.push(`#### ${u(e)}`);for(let e of r)t.push(e.text),t.push(...l(e.bodyParagraphs))}}return t.join(`
|
|
2
|
+
`)}function l(e){let t=[];for(let n of e){let[e,...r]=n;e&&(t.push(` - ${e}`),t.push(...r.map(e=>` ${e}`)))}return t}function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e){return e.length>0?e.charAt(0).toUpperCase()+e.slice(1):e}function f(e){let t=e.lastIndexOf(`([#`);if(t===-1)return{main:e,inline:``};let n=e.slice(t),r=/^(\(\[#[^\]]+\]\([^)]*\) by [^)]*\)\)?)(?:\(fixes [^)]*\)\)?)?/.exec(n);if(!r)return{main:e,inline:``};let i=r[0]??``;return{main:e.slice(0,t)+i,inline:e.slice(t+i.length).trim()}}function p(e){let t=[],n=[];for(let r of e.split(`
|
|
3
|
+
`)){let e=r.trim();if(!e){n.length>0&&(t.push(n),n=[]);continue}if(e.startsWith(`-`)||e.startsWith(`*`)||/^[0-9]+[.)]/.test(e)||!e.replace(/(?:close[sd]?|fixe?s|fixed|resolves?|resolved)\b\s*:?\s*#\d+\s*[,;]?\s*/gi,``).trim())continue;let i=/^(BREAKING CHANGE|Reviewed-by|Signed-off-by|Co-authored-by|Acked-by|Co-developed-by|Helped-by|Reported-by|Suggested-by|Tested-by|Cc):\s+(.+)$/i.exec(e);i&&!/^(http|https)\b/.test(e)?(n.length>0&&(t.push(n),n=[]),t.push([`**${(i[1]??``).trim()}:** ${(i[2]??``).trim()}`])):n.push(e)}return n.length>0&&t.push(n),t}function m(e,t){return`https://github.com/${e}/commit/${t}`}function h(e,t){return`https://github.com/${e}/issues/${t}`}function g(e,t){return e.replace(/\[(#[0-9a-fA-F]{6,40})\]\(([^)]*)\)/g,(e,n)=>{let r=n.replace(`#`,``).slice(0,7);return`[#${r}](${m(t,r)})`}).replace(/(^|[^\w[])#([0-9a-fA-F]{7,40})(?![0-9a-fA-F])(?=[)\].,;:\s]|$)/g,(e,n,r)=>{let i=r.slice(0,7);return`${n}[#${i}](${m(t,i)})`})}function _(e,t){return e.replace(/\[#(\d+)(?=[ \]])(?:[^\]]*)\]\([^)]*\)/g,(e,n)=>`[#${n}](${h(t,n)})`).replace(/(^|[^\w[])#(\d+)(?=[)\].,;:\s]|$)/g,(e,n,r)=>`${n}[#${r}](${h(t,r)})`)}function v(e,t){if(!t)return e;let n=g(e,t);return n=_(n,t),n}function y(r,i){if(!i)return;let a=t(r,`utf8`),o=a.split(`
|
|
4
|
+
`).map(e=>v(e,i)).join(`
|
|
5
|
+
`);o!==a&&(n(r,o,`utf8`),e.info(` formatted ${r}`))}export{d as capitalize,p as formatBody,y as formatChangelogFile,v as formatLine,s as groupItems,o as parseCcSubject,c as renderGroups,a as ruleTitle,f as splitInlineDescription};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{execFileSync as
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import t from"node:fs";import{execFileSync as n}from"node:child_process";function r(e,t){let r=[`log`,`--no-merges`,`--pretty=format:%H%x1f%s%x1f%b%x1f%an%x1f%ae%x1e`,e];return t&&r.push(`--`,t),n(`git`,r,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]}).split(``).filter(e=>e.length>0).map(e=>{let[t,n,r,i,a]=e.split(``);return{hash:t.trim(),subject:(n??``).trim(),body:(r??``).trim(),author:(i??``).trim(),authorEmail:(a??``).trim()}}).filter(e=>e.subject.length>0)}function i(e){let t=e.match(/(?:github\.com[/:])([^/]+)\/([^/.]+?)(?:\.git)?$/);if(t?.[1]&&t[2])return`${t[1]}/${t[2]}`}function a(){try{let e=i(n(`git`,[`remote`,`get-url`,`origin`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim());if(e)return e}catch{}try{let n=t.readFileSync(e.join(process.cwd(),`package.json`),`utf8`),r=JSON.parse(n),a=typeof r.repository==`string`?r.repository:r.repository?.url;if(a)return i(a)}catch{}}let o;function s(){if(o!==void 0)return o;try{n(`gh`,[`auth`,`status`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]}),o=!0}catch{o=!1}return o}const c=/* @__PURE__ */ new Map;function l(e,t,r){if(!s())return;let i=`repos/${e}${t}::${r}`;if(c.has(i))return c.get(i);let a;try{let i=n(`gh`,[`api`,`repos/${e}${t}`,`--jq`,r],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]}).trim();a=i&&i!==`null`?i:void 0}catch{a=void 0}return c.set(i,a),a}function u(e){return/^(\d+)\+([^@]+)@users\.noreply\.github\.com$/.exec(e.trim())?.[2]}function d(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function f(e,t){let n;t&&(n=l(t,`/commits/${e.hash}/pulls`,`.[0].user.login`),n||=l(t,`/commits/${e.hash}`,`.author.login`)),n||=u(e.authorEmail);let r=n??e.author;return d(r)&&(r=u(r)??r.split(`@`)[0]??r),{name:r,url:n?`https://github.com/${n}`:void 0}}function p(e){return e.url?`[${e.name}](${e.url})`:e.name}function m(e){let t=/* @__PURE__ */ new Set;for(let n of e.matchAll(/\b(?:close[sd]?|fixe?s|fixed|resolves?|resolved)\b\s*:?\s*#(\d+)/gi)){let e=Number(n[1]);Number.isInteger(e)&&t.add(e)}return[...t]}function h(e,t){let n={number:t},r=l(e,`/issues/${t}`,`[.title,.html_url]`);if(r)try{let e=JSON.parse(r);n.title=e[0]||void 0,n.url=e[1]||void 0}catch{}return n}function g(e,t){let n=m(`${e.subject}\n${e.body}`);return n.length===0?[]:t?n.map(e=>h(t,e)):n.map(e=>({number:e}))}function _(e){return e.length===0?``:` (fixes ${e.map(e=>e.url&&e.title?`[#${e.number} ${e.title}](${e.url})`:e.url?`[#${e.number}](${e.url})`:`#${e.number}`).join(`, `)})`}function v(e){return/\[(#[0-9a-fA-F]{6,40})\]\([^)]*\)/.exec(e)?.[1]?.replace(`#`,``)}function y(e){try{return n(`git`,[`log`,`-1`,`--format=%aI`,e],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{return}}function b(e){for(let t of[`v${e}`,e])try{let e=n(`git`,[`log`,`-1`,`--format=%aI`,t],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();if(e)return e}catch{}}function x(e,t){let n=b(e);if(n)return new Date(n);for(let e of t){let t=v(e);if(t){let e=y(t);if(e)return new Date(e)}}}let S;function C(){if(S)return S;let e=/* @__PURE__ */ new Map;try{let t=n(`git`,[`log`,`--no-merges`,`--all`,`--format=%H%x1f%s%x1f%b%x1e`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`],maxBuffer:134217728});for(let n of t.split(``)){if(!n.trim())continue;let[t=``,r=``,i=``]=n.split(``);if(!t)continue;let a={subject:r.trim(),body:i.trim()};e.set(t.trim(),a),e.set(t.trim().slice(0,7),a)}}catch{}return S=e,e}function w(e){return C().get(e)}function T(e){let t=`patch`;for(let n of e){let e=`${n.subject}\n${n.body}`;/\bBREAKING CHANGE\b/.test(e)||/^[a-zA-Z]+(\([^)]*\))?!:/.test(n.subject)?t=`major`:t!==`major`&&/^feat(\([^)]*\))?:/i.test(n.subject)&&(t=`minor`)}return t}export{v as bulletHash,T as deriveBump,x as deriveVersionDate,w as readCommit,r as readCommits,g as recordIssues,p as renderAuthor,_ as renderIssues,a as repoSlug,f as resolveAuthorInfo};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import"node:url";import.meta.url;import{bulletHash as
|
|
2
|
-
`)){let e=/^##\s+([0-9]+\.[0-9]+\.[0-9]+)(?:\s*\(.*\))?\s*$/.exec(r);e?(n={version:e[1],bullets:[]},t.push(n)):n&&(r.includes(`<!-- release:`)||r.startsWith(`- `)&&n.bullets.push(r))}return t}function
|
|
3
|
-
`)[0]??`# Changelog`;return`${a.startsWith(`# `)?a:`# Changelog`}\n\n${i.map((e,a)=>{let o=i[a+1],
|
|
1
|
+
import{resolve as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{bulletHash as n,deriveVersionDate as r,readCommit as i,repoSlug as a}from"./git.js";import{changelogFiles as o,repoRoot as s}from"./repo.js";import{packageChangesForVersion as c}from"./packages.js";import{capitalize as l,formatBody as u,formatLine as d,groupItems as f,parseCcSubject as p,renderGroups as m}from"./format.js";import{renderChangelogEntry as h}from"./version.js";import{existsSync as g,readFileSync as _,writeFileSync as v}from"node:fs";function y(e){let t=[],n;for(let r of e.split(`
|
|
2
|
+
`)){let e=/^##\s+([0-9]+\.[0-9]+\.[0-9]+)(?:\s*\(.*\))?\s*$/.exec(r);e?(n={version:e[1],bullets:[]},t.push(n)):n&&(r.includes(`<!-- release:`)||r.startsWith(`- `)&&n.bullets.push(r))}return t}function b(e){let t=e.lastIndexOf(`([#`);if(t===-1)return``;let n=e.slice(t);return/^(\(\[#[^\]]+\]\([^)]*\) by [^)]*\)\)?)(?:\(fixes [^)]*\)\)?)?/.exec(n)?.[0]??``}function x(e,t,a=!1,o=``){let s=[];for(let r of e.bullets){let e=r.replace(/^-\s+/,``),a=n(r),o=a?i(a):void 0,c=o?.subject??e.replace(/\*\*/g,``),f=p(c),m=b(e),h=`- ${[d(l(f.rest),t),m].filter(Boolean).join(` `)}`,g=o?u(o.body):[];s.push({parsed:f,text:h,bodyParagraphs:g})}let c=r(e.version,e.bullets);return h(e.version,m(f(s)),c,a,o)}function S(e,t,n=!1,r=!1){let i=y(e);if(i.length===0)return e;let a=e.split(`
|
|
3
|
+
`)[0]??`# Changelog`;return`${a.startsWith(`# `)?a:`# Changelog`}\n\n${i.map((e,a)=>{let o=i[a+1],s=r&&o?c(e.version,o.version):``;return x(e,t,n&&a===0,s)}).filter(Boolean).join(`
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
`)}\n`}function
|
|
6
|
+
`)}\n`}function C(t=!1){let n=s(),r=e(n,`CHANGELOG.md`);return g(r)?S(_(r,`utf8`),a(),!1,t):``}function w(n,r=!1){let i=e(s(),`CHANGELOG.md`);for(let e of o()){let o=S(_(e,`utf8`),a(),!0,r&&e===i);if(n){let n=e.replace(/CHANGELOG\.md$/,`CHANGELOG.proposed.md`);v(n,o,`utf8`),t.info(`[DRY-RUN] Wrote ${n}`)}else v(e,o,`utf8`),t.info(` formatted ${e}`)}}export{w as formatExistingChangelogs,y as parseExistingChangelog,S as reformatChangelogContent,C as reformatRootChangelog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import"node:url";import.meta.url;import{existsSync as
|
|
1
|
+
import{resolve as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{existsSync as n,globSync as r,readFileSync as i,writeFileSync as a}from"node:fs";function o(){let t=process.cwd();for(let r=0;r<8;r++){if(n(e(t,`package.json`)))return t;let r=e(t,`..`);if(r===t)break;t=r}return process.cwd()}function s(){let t=o(),a=JSON.parse(i(e(t,`package.json`),`utf8`)),s=/* @__PURE__ */ new Set([t]);for(let i of a.workspaces??[])if(i!==`.`)for(let a of r(i,{cwd:t})){let r=e(t,a);n(e(r,`package.json`))&&s.add(r)}return[...s]}function c(){let t=e(o(),`package.json`);return JSON.parse(i(t,`utf8`)).version??`0.0.0`}function l(r){for(let o of s()){let s=e(o,`package.json`);if(!n(s))continue;let c=i(s,`utf8`),l=c.replace(/("version"\s*:\s*)"[^"]*"/,`$1"${r}"`);l!==c&&(a(s,l,`utf8`),t.info(` bumped ${s}`))}}function u(){let t=o();return[e(t,`CHANGELOG.md`),...s().filter(n=>e(n)!==e(t)).map(t=>e(t,`CHANGELOG.md`))].filter(e=>n(e))}export{u as changelogFiles,s as discoverWorkspaceDirs,c as readRootVersion,o as repoRoot,l as writeVersion};
|
|
@@ -2,6 +2,13 @@ import __tsdown_shims_path from 'node:path';
|
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { CommitRecord } from "./types.js";
|
|
4
4
|
//#region packages/changelog/src/utils/summary.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Render a commit reference for a changelog bullet. With a resolvable repo slug
|
|
7
|
+
* it is a Markdown link to the commit; without one (no GitHub remote and no
|
|
8
|
+
* GitHub `repository.url` in the root package.json) it degrades to a plain
|
|
9
|
+
* short hash rather than a broken `github.com/undefined/...` link.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderCommitRef(repo: string | undefined, hash: string): string;
|
|
5
12
|
/** Render the grouped changelog summary for a set of commits. */
|
|
6
13
|
export declare function buildSummary(records: CommitRecord[]): string;
|
|
7
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{recordIssues as e,renderAuthor as t,renderIssues as n,repoSlug as r,resolveAuthorInfo as i}from"./git.js";import{capitalize as a,formatBody as o,groupItems as s,parseCcSubject as c,renderGroups as l}from"./format.js";function u(
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{recordIssues as e,renderAuthor as t,renderIssues as n,repoSlug as r,resolveAuthorInfo as i}from"./git.js";import{capitalize as a,formatBody as o,groupItems as s,parseCcSubject as c,renderGroups as l}from"./format.js";function u(e,t){let n=t.slice(0,7);return e?`[#${n}](https://github.com/${e}/commit/${t})`:`#${n}`}function d(d){let f=r(),p=s(d.map(r=>{let s=c(r.subject),l=t(i(r,f));return{parsed:s,text:`- ${a(s.rest)} (${u(f,r.hash)} by ${l})${n(e(r,f))}`,bodyParagraphs:o(r.body)}}));return l(p)}export{d as buildSummary,u as renderCommitRef};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import"node:url";import.meta.url;import{discoverWorkspaceDirs as
|
|
1
|
+
import{resolve as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{discoverWorkspaceDirs as n,repoRoot as r}from"./repo.js";import{existsSync as i,readFileSync as a,writeFileSync as o}from"node:fs";function s(e){return`${e.toLocaleString(`en-US`,{month:`long`})} ${e.getFullYear()}`}function c(e,t){let n=/^(\d+)\.(\d+)\.(\d+)/.exec(e);if(!n)throw Error(`Cannot parse version "${e}"`);let r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);return t===`major`?(r+=1,i=0,a=0):t===`minor`?(i+=1,a=0):a+=1,`${r}.${i}.${a}`}function l(e,t,n,r=!0,i=``){let a=n?` (${s(n)})`:``,o=i?`${t}\n\n${i}`:t;return r?`## ${e}${a}
|
|
2
2
|
|
|
3
3
|
<!-- release:start -->
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${o}
|
|
6
6
|
|
|
7
|
-
<!-- release:end -->`:`## ${e}${a}\n\n${
|
|
7
|
+
<!-- release:end -->`:`## ${e}${a}\n\n${o}`}function u(e,t){let n=e.split(`
|
|
8
8
|
`).filter(e=>!e.includes(`<!-- release:start -->`)&&!e.includes(`<!-- release:end -->`)).join(`
|
|
9
9
|
`).trimEnd().replace(/\n{3,}/g,`
|
|
10
10
|
|
|
11
11
|
`),r=n.split(`
|
|
12
12
|
`),i=r[0],a;return a=i!==void 0&&i.startsWith(`# `)?[i,``,t.trimEnd(),``,...r.slice(1)].join(`
|
|
13
|
-
`):`${t.trimEnd()}\n\n${n}`,`${a.trimEnd()}\n`}function
|
|
14
|
-
`;
|
|
13
|
+
`):`${t.trimEnd()}\n\n${n}`,`${a.trimEnd()}\n`}function d(e,t){let n=i(e)?a(e,`utf8`):`# Changelog
|
|
14
|
+
`;o(e,u(n,t),`utf8`)}function f(s,c){let l=r(),u=[e(l,`CHANGELOG.md`),...n().map(t=>e(t,`CHANGELOG.md`))];for(let e of u){if(!i(e))continue;let n=a(e,`utf8`),r=n.replace(`## ${s}`,`## ${c}`);r!==n&&(o(e,r,`utf8`),t.info(` retagged ${e}`))}}export{c as bumpVersion,u as insertNewEntry,s as monthYear,d as prependChangelogEntry,l as renderChangelogEntry,f as retagChangelogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e,resolve as t}from"node:path";import"node:url";import.meta.url;import{readCommits as
|
|
1
|
+
import{relative as e,resolve as t}from"node:path";import"node:url";import.meta.url;import{logger as n}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{readCommits as r,repoSlug as i}from"./git.js";import{discoverWorkspaceDirs as a,repoRoot as o}from"./repo.js";import{packageChangesForCurrent as s}from"./packages.js";import{formatChangelogFile as c}from"./format.js";import{prependChangelogEntry as l,renderChangelogEntry as u}from"./version.js";import{parseExistingChangelog as d,reformatRootChangelog as f}from"./reformat.js";import{buildSummary as p}from"./summary.js";import{existsSync as m,readFileSync as h,writeFileSync as g}from"node:fs";function _(_,v,y,b,x,S=!1){let C=o(),w=i(),T=t(C,`CHANGELOG.md`),E=``;if(S&&m(T)){let e=d(h(T,`utf8`))[0];e&&(E=s(e.version))}if(x){let e=f(S);e&&(g(T,e,`utf8`),n.info(` reformatted ${T}`))}let D=u(_,b,/* @__PURE__ */ new Date,!0,E);l(T,D),n.info(` updated ${T}`);for(let i of a()){if(t(i)===t(C))continue;let a=t(i,`CHANGELOG.md`);if(!m(a))continue;let o=e(C,i).replace(/\\/g,`/`),s=r(v,o);if(s.length===0){n.info(` skipped ${a} (no commits in ${o})`);continue}let c=p(s);l(a,u(_,c,/* @__PURE__ */ new Date)),n.info(` updated ${a}`)}for(let e of[t(C,`CHANGELOG.md`),...a().filter(e=>t(e)!==t(C)).map(e=>t(e,`CHANGELOG.md`)).filter(e=>m(e))])c(e,w)}export{_ as writeChangelogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import t from"node:fs";function
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import n from"node:fs";function r(t,n){return e.resolve(t??n)}function i(i){let{engine:a}=i,o=i.defaults??{};return[{name:`config:env`,description:`Generate .env.example from the config schemas.`,options:[{flags:`-o, --out <dir>`,description:`Output directory.`}],run:({out:n})=>{let i=e.join(r(n,o.envDir??a.root),`.env.example`);a.writeEnvFile({output:i}),t.info(`Generated ${e.relative(process.cwd(),i)}`)}},{name:`config:types`,description:`Generate the config and env types.`,options:[{flags:`-o, --out <dir>`,description:`Output directory.`},{flags:`--env`,description:`Also write the env type files.`}],run:({out:n,env:i})=>{let s=r(n,o.typesDir??a.root),c=a.writeConfigTypes({outputDir:s});i&&c.push(...a.writeEnvTypes({outputDir:s}));for(let n of c)t.info(`Generated ${e.relative(process.cwd(),n)}`)}},{name:`config:json`,description:`Generate the config metadata JSON.`,options:[{flags:`-o, --out <file>`,description:`Output file.`}],run:({out:i})=>{let s=r(i,o.configJsonPath??e.join(a.root,`config.json`)),c=a.buildConfigJson();n.mkdirSync(e.dirname(s),{recursive:!0}),n.writeFileSync(s,`${JSON.stringify(c,null,4)}\n`,`utf-8`),t.info(`Generated ${e.relative(process.cwd(),s)}`)}},{name:`config:schema`,description:`Generate the untyped JSON Schema.`,options:[{flags:`-o, --out <file>`,description:`Output file.`}],run:async({out:n})=>{let i=r(n,o.schemaPath??e.join(a.root,`config.schema.json`));await a.writeJsonSchema({output:i}),t.info(`Generated ${e.relative(process.cwd(),i)}`)}},{name:`config:markdown`,description:`Generate the markdown configuration reference.`,options:[{flags:`-o, --out <dir>`,description:`Output directory.`}],run:({out:n})=>{let i=r(n,o.docsDir??e.join(a.root,`docs/reference/configuration`)),s=a.writeMarkdown({outDir:i});for(let n of s)t.info(`Generated ${e.relative(process.cwd(),n)}`)}},{name:`config:cli`,description:`Generate the CLI options JSON.`,options:[{flags:`-o, --out <file>`,description:`Output file.`}],run:({out:n})=>{let i=r(n,o.cliOptionsPath??e.join(a.root,`cli-options.json`));a.generateCliOptions({output:i}),t.info(`Generated ${e.relative(process.cwd(),i)}`)}},{name:`config:all`,description:`Run every config generator.`,options:[{flags:`-o, --out <dir>`,description:`Base output directory.`}],run:async({out:n})=>{let i=r(n,a.root),o=[];o.push(a.writeEnvFile({output:e.join(i,`.env.example`)})),o.push(...a.writeConfigTypes({outputDir:e.join(i,`types`)}),...a.writeEnvTypes({outputDir:e.join(i,`types`)}),...a.writeMarkdown({outDir:e.join(i,`docs/reference/configuration`)})),o.push(await a.writeJsonSchema({output:e.join(i,`config.schema.json`)})),o.push(a.generateCliOptions({output:e.join(i,`cli-options.json`)}));for(let n of o.filter(e=>typeof e==`string`))t.info(`Generated ${e.relative(process.cwd(),n)}`)}}]}export{i as configCommands};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region packages/config/src/generated-format.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Programmatic formatter for generated output.
|
|
6
|
+
*
|
|
7
|
+
* The config generators emit deterministic text; this helper runs it through
|
|
8
|
+
* Oxfmt **at generation time** instead of shelling out to the repo-root `vp`
|
|
9
|
+
* (or relying on a separate `yarn format` pass), so a generated file is written
|
|
10
|
+
* already formatted. It prefers the project-local `vite-plus/fmt` (Oxfmt ships
|
|
11
|
+
* with Vite+), falls back to `oxfmt`, and finally returns the input untouched
|
|
12
|
+
* when no formatter is resolvable — so generation never fails on a missing
|
|
13
|
+
* formatter.
|
|
14
|
+
*/
|
|
15
|
+
export interface FormatGeneratedOptions {
|
|
16
|
+
/** File name used to infer the language (default `generated.ts`). */
|
|
17
|
+
fileName?: string;
|
|
18
|
+
/** Extra Oxfmt options merged over {@link GENERATED_FORMAT_OPTIONS}. */
|
|
19
|
+
options?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Baseline Oxfmt options matching the toolchain's own `vite.config.ts`.
|
|
23
|
+
* `jsdoc` collapses the short, verbose comment blocks the type generator emits.
|
|
24
|
+
*/
|
|
25
|
+
export declare const GENERATED_FORMAT_OPTIONS: {
|
|
26
|
+
readonly useTabs: false;
|
|
27
|
+
readonly tabWidth: 4;
|
|
28
|
+
readonly printWidth: 100;
|
|
29
|
+
readonly endOfLine: 'lf';
|
|
30
|
+
readonly singleQuote: true;
|
|
31
|
+
readonly jsxSingleQuote: false;
|
|
32
|
+
readonly quoteProps: 'as-needed';
|
|
33
|
+
readonly trailingComma: 'es5';
|
|
34
|
+
readonly semi: true;
|
|
35
|
+
readonly arrowParens: 'avoid';
|
|
36
|
+
readonly bracketSpacing: true;
|
|
37
|
+
readonly bracketSameLine: false;
|
|
38
|
+
readonly jsdoc: true;
|
|
39
|
+
};
|
|
40
|
+
/** Format generated source with Oxfmt; returns it unchanged when unavailable. */
|
|
41
|
+
export declare function formatGenerated(source: string, options?: FormatGeneratedOptions): Promise<string>;
|
|
42
|
+
//#endregion
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;const e={useTabs:!1,tabWidth:4,printWidth:100,endOfLine:`lf`,singleQuote:!0,jsxSingleQuote:!1,quoteProps:`as-needed`,trailingComma:`es5`,semi:!0,arrowParens:`avoid`,bracketSpacing:!0,bracketSameLine:!1,jsdoc:!0};async function t(){for(let e of[`vite-plus/fmt`,`oxfmt`])try{let t=await import(
|
|
2
|
+
/* @vite-ignore */
|
|
3
|
+
e);if(typeof t.format==`function`)return t.format}catch{}}async function n(n,r={}){let i=await t();if(!i)return n;try{let{code:t}=await i(r.fileName??`generated.ts`,n,{...e,...r.options});return t}catch{return n}}export{e as GENERATED_FORMAT_OPTIONS,n as formatGenerated};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{pascalCase as t}from"../../../shared/src/string-utils.js";import"../../../shared/src/index.js";import{splitBaseSchema as n,zodToJsonSchema as r}from"../schema.js";import i from"node:fs";import{generateTypes as a}from"untyped";const o={addExport:!0,partial:!0};function s(e,t){return e??r(t)}function c(e
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{pascalCase as t}from"../../../shared/src/string-utils.js";import"../../../shared/src/index.js";import{splitBaseSchema as n,zodToJsonSchema as r}from"../schema.js";import i from"node:fs";import{generateTypes as a}from"untyped";const o={addExport:!0,partial:!0};function s(e,t){return e??r(t)}function c(e){let t=[],n=0,r=!1;for(let i of e.split(`
|
|
2
|
+
`)){let e=i.trim();if(r)t.push(i),e.endsWith(`*/`)&&(r=!1);else if(e.startsWith(`/*`))t.push(i),e.endsWith(`*/`)||(r=!0);else if(!(e===``&&n>0)){t.push(i);for(let e of i)e===`{`||e===`(`||e===`[`?n++:(e===`}`||e===`)`||e===`]`)&&n>0&&n--}}return t.join(`
|
|
3
|
+
`)}function l(e,t){return c(a(e,{...o,interfaceName:t}))}function u(e,r,i={}){let a=i.baseGroup??`base`,o=i.interfaceNames?.[e]??`${t(e)}Config`,s=i.aliases?.[e]??``,c=e=>i.header?`${i.header}\n\n${e}`:e;if(!r.properties)return c(`export type ${o} = ${r.tsType??`unknown`};\n${s}`);let{base:u,groups:d,hasBase:f}=n(r,a),p=Object.keys(d.properties??{});if(!f)return c(`${l(r,o)}\n${s}`);let m=l(u,`${o}Base`),h;return h=p.length>0?l(d,o).replace(`export interface ${o} {`,`export interface ${o} extends ${o}Base {`):`export interface ${o} extends ${o}Base {}\n`,c(`${m}\n${h}\n${s}`)}function d(e,t={}){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,u(e,s(n.jsonSchema,n.zodSchema),t)]))}function f(t,n){let r=n.extension??`ts`,a=[];for(let[o,s]of Object.entries(d(t,n))){let t=e.join(n.outputDir,`${o}.${r}`);i.mkdirSync(e.dirname(t),{recursive:!0}),i.writeFileSync(t,s,`utf-8`),a.push(t)}return a}export{f as generateConfigTypes,d as renderAllConfigTypes,u as renderConfigTypes,s as resolveScopeSchema};
|
|
@@ -11,11 +11,12 @@ import { ConfigFileSection, GenerateMarkdownOptions, RenderConfigFileOptions, Re
|
|
|
11
11
|
import { GenerateTypesOptions, generateConfigTypes, renderAllConfigTypes, renderConfigTypes, resolveScopeSchema } from "./generators/types.js";
|
|
12
12
|
import { ConfigEngine, createConfigEngine } from "./engine.js";
|
|
13
13
|
import { EnvSource, EnvTree, applyOverrides, envBool, envInt, envList, envMap, envString, parseEnvTree, readEnvPath, trimTrailingSlashes } from "./env.js";
|
|
14
|
+
import { FormatGeneratedOptions, GENERATED_FORMAT_OPTIONS, formatGenerated } from "./generated-format.js";
|
|
14
15
|
import "./generators/index.js";
|
|
15
16
|
import { findProjectRoot, monorepoRoot } from "./root.js";
|
|
16
17
|
import { SplitSchema, compileZodSchema, envMetaOf, flattenBaseSchema, renderTsType, resolveUntypedSchema, splitBaseSchema, zodToJsonSchema, zodToUntypedDefinition } from "./schema.js";
|
|
17
18
|
declare namespace index_d_exports {
|
|
18
|
-
export { BuildConfigJsonOptions, CliArgsOptionConfig, CliArgsParser, CliArgsResult, CliArgsValues, CliFlagOptions, CliOptionDef, CollectEnvVarsOptions, ConfigEngine, ConfigEngineOptions, ConfigFileSection, ConfigJsonDoc, ConfigJsonEntry, ConfigScopeDef, ConfigScopes, DEFAULT_ENV_PREFIX, EnvFileOptions, EnvSource, EnvTree, EnvValueType, EnvVarDef, EnvVarMeta, GenerateCliOptionsOptions, GenerateEnvTypesOptions, GenerateJsonSchemaOptions, GenerateMarkdownOptions, GenerateTypesOptions, RenderConfigFileOptions, RenderMarkdownOptions, SplitSchema, applyOverrides, buildConfigJson, cliFlagLabel, cliFlagOf, cliShortOf, collectEnvVars, collectRequiredEnvVars, compileZodSchema, createCliArgsParser, createConfigEngine, envBool, envInt, envList, envMap, envMetaOf, envPathOf, envString, findProjectRoot, flagOf, flattenBaseSchema, generateCliArgsOptions, generateCliOptions, generateConfigJsonSchema, generateConfigMarkdown, generateConfigTypes, generateEnv, generateEnvDts, generateEnvFile, generateEnvTypes, generateJsonSchemaFile, monorepoRoot, parseEnvTree, readEnvPath, renderAllConfigTypes, renderConfigFileMarkdown, renderConfigIndex, renderConfigTypes, renderScopeMarkdown, renderTsType, resolveScopeSchema, resolveUntypedSchema, splitBaseSchema, trimTrailingSlashes, zodToJsonSchema, zodToUntypedDefinition };
|
|
19
|
+
export { BuildConfigJsonOptions, CliArgsOptionConfig, CliArgsParser, CliArgsResult, CliArgsValues, CliFlagOptions, CliOptionDef, CollectEnvVarsOptions, ConfigEngine, ConfigEngineOptions, ConfigFileSection, ConfigJsonDoc, ConfigJsonEntry, ConfigScopeDef, ConfigScopes, DEFAULT_ENV_PREFIX, EnvFileOptions, EnvSource, EnvTree, EnvValueType, EnvVarDef, EnvVarMeta, FormatGeneratedOptions, GENERATED_FORMAT_OPTIONS, GenerateCliOptionsOptions, GenerateEnvTypesOptions, GenerateJsonSchemaOptions, GenerateMarkdownOptions, GenerateTypesOptions, RenderConfigFileOptions, RenderMarkdownOptions, SplitSchema, applyOverrides, buildConfigJson, cliFlagLabel, cliFlagOf, cliShortOf, collectEnvVars, collectRequiredEnvVars, compileZodSchema, createCliArgsParser, createConfigEngine, envBool, envInt, envList, envMap, envMetaOf, envPathOf, envString, findProjectRoot, flagOf, flattenBaseSchema, formatGenerated, generateCliArgsOptions, generateCliOptions, generateConfigJsonSchema, generateConfigMarkdown, generateConfigTypes, generateEnv, generateEnvDts, generateEnvFile, generateEnvTypes, generateJsonSchemaFile, monorepoRoot, parseEnvTree, readEnvPath, renderAllConfigTypes, renderConfigFileMarkdown, renderConfigIndex, renderConfigTypes, renderScopeMarkdown, renderTsType, resolveScopeSchema, resolveUntypedSchema, splitBaseSchema, trimTrailingSlashes, zodToJsonSchema, zodToUntypedDefinition };
|
|
19
20
|
}
|
|
20
21
|
//#endregion
|
|
21
|
-
export { BuildConfigJsonOptions, CliArgsOptionConfig, CliArgsParser, CliArgsResult, CliArgsValues, CliFlagOptions, CliOptionDef, CollectEnvVarsOptions, ConfigEngine, ConfigEngineOptions, ConfigFileSection, ConfigJsonDoc, ConfigJsonEntry, ConfigScopeDef, ConfigScopes, DEFAULT_ENV_PREFIX, EnvFileOptions, EnvSource, EnvTree, EnvValueType, EnvVarDef, EnvVarMeta, GenerateCliOptionsOptions, GenerateEnvTypesOptions, GenerateJsonSchemaOptions, GenerateMarkdownOptions, GenerateTypesOptions, RenderConfigFileOptions, RenderMarkdownOptions, SplitSchema, applyOverrides, buildConfigJson, cliFlagLabel, cliFlagOf, cliShortOf, collectEnvVars, collectRequiredEnvVars, compileZodSchema, createCliArgsParser, createConfigEngine, envBool, envInt, envList, envMap, envMetaOf, envPathOf, envString, findProjectRoot, flagOf, flattenBaseSchema, generateCliArgsOptions, generateCliOptions, generateConfigJsonSchema, generateConfigMarkdown, generateConfigTypes, generateEnv, generateEnvDts, generateEnvFile, generateEnvTypes, generateJsonSchemaFile, index_d_exports, monorepoRoot, parseEnvTree, readEnvPath, renderAllConfigTypes, renderConfigFileMarkdown, renderConfigIndex, renderConfigTypes, renderScopeMarkdown, renderTsType, resolveScopeSchema, resolveUntypedSchema, splitBaseSchema, trimTrailingSlashes, zodToJsonSchema, zodToUntypedDefinition };
|
|
22
|
+
export { BuildConfigJsonOptions, CliArgsOptionConfig, CliArgsParser, CliArgsResult, CliArgsValues, CliFlagOptions, CliOptionDef, CollectEnvVarsOptions, ConfigEngine, ConfigEngineOptions, ConfigFileSection, ConfigJsonDoc, ConfigJsonEntry, ConfigScopeDef, ConfigScopes, DEFAULT_ENV_PREFIX, EnvFileOptions, EnvSource, EnvTree, EnvValueType, EnvVarDef, EnvVarMeta, FormatGeneratedOptions, GENERATED_FORMAT_OPTIONS, GenerateCliOptionsOptions, GenerateEnvTypesOptions, GenerateJsonSchemaOptions, GenerateMarkdownOptions, GenerateTypesOptions, RenderConfigFileOptions, RenderMarkdownOptions, SplitSchema, applyOverrides, buildConfigJson, cliFlagLabel, cliFlagOf, cliShortOf, collectEnvVars, collectRequiredEnvVars, compileZodSchema, createCliArgsParser, createConfigEngine, envBool, envInt, envList, envMap, envMetaOf, envPathOf, envString, findProjectRoot, flagOf, flattenBaseSchema, formatGenerated, generateCliArgsOptions, generateCliOptions, generateConfigJsonSchema, generateConfigMarkdown, generateConfigTypes, generateEnv, generateEnvDts, generateEnvFile, generateEnvTypes, generateJsonSchemaFile, index_d_exports, monorepoRoot, parseEnvTree, readEnvPath, renderAllConfigTypes, renderConfigFileMarkdown, renderConfigIndex, renderConfigTypes, renderScopeMarkdown, renderTsType, resolveScopeSchema, resolveUntypedSchema, splitBaseSchema, trimTrailingSlashes, zodToJsonSchema, zodToUntypedDefinition };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{__exportAll as e}from"../../../_virtual/_rolldown/runtime.js";import{compileZodSchema as t,envMetaOf as n,flattenBaseSchema as r,renderTsType as i,resolveUntypedSchema as a,splitBaseSchema as o,zodToJsonSchema as s,zodToUntypedDefinition as c}from"./schema.js";import{envPathOf as l}from"./types.js";import{DEFAULT_ENV_PREFIX as u,collectEnvVars as d,collectRequiredEnvVars as f}from"./collect.js";import{buildConfigJson as p}from"./config-json.js";import{generateEnvFile as m}from"./env-file.js";import{cliFlagLabel as h,cliFlagOf as g,cliShortOf as _,createCliArgsParser as v,flagOf as y,generateCliArgsOptions as b,generateCliOptions as x}from"./generators/cli.js";import{generateEnv as S,generateEnvDts as C,generateEnvTypes as w}from"./generators/env.js";import{generateConfigJsonSchema as T,generateJsonSchemaFile as E}from"./generators/json.js";import{generateConfigMarkdown as D,renderConfigFileMarkdown as O,renderConfigIndex as k,renderScopeMarkdown as A}from"./generators/markdown.js";import{generateConfigTypes as j,renderAllConfigTypes as M,renderConfigTypes as N,resolveScopeSchema as P}from"./generators/types.js";import{findProjectRoot as F,monorepoRoot as I}from"./root.js";import{createConfigEngine as L}from"./engine.js";import{applyOverrides as R,envBool as z,envInt as B,envList as V,envMap as H,envString as U,parseEnvTree as W,readEnvPath as G,trimTrailingSlashes as K}from"./env.js";import"./generators/index.js";var
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{__exportAll as e}from"../../../_virtual/_rolldown/runtime.js";import{compileZodSchema as t,envMetaOf as n,flattenBaseSchema as r,renderTsType as i,resolveUntypedSchema as a,splitBaseSchema as o,zodToJsonSchema as s,zodToUntypedDefinition as c}from"./schema.js";import{envPathOf as l}from"./types.js";import{DEFAULT_ENV_PREFIX as u,collectEnvVars as d,collectRequiredEnvVars as f}from"./collect.js";import{buildConfigJson as p}from"./config-json.js";import{generateEnvFile as m}from"./env-file.js";import{cliFlagLabel as h,cliFlagOf as g,cliShortOf as _,createCliArgsParser as v,flagOf as y,generateCliArgsOptions as b,generateCliOptions as x}from"./generators/cli.js";import{generateEnv as S,generateEnvDts as C,generateEnvTypes as w}from"./generators/env.js";import{generateConfigJsonSchema as T,generateJsonSchemaFile as E}from"./generators/json.js";import{generateConfigMarkdown as D,renderConfigFileMarkdown as O,renderConfigIndex as k,renderScopeMarkdown as A}from"./generators/markdown.js";import{generateConfigTypes as j,renderAllConfigTypes as M,renderConfigTypes as N,resolveScopeSchema as P}from"./generators/types.js";import{findProjectRoot as F,monorepoRoot as I}from"./root.js";import{createConfigEngine as L}from"./engine.js";import{applyOverrides as R,envBool as z,envInt as B,envList as V,envMap as H,envString as U,parseEnvTree as W,readEnvPath as G,trimTrailingSlashes as K}from"./env.js";import{GENERATED_FORMAT_OPTIONS as q,formatGenerated as J}from"./generated-format.js";import"./generators/index.js";var Y=/* @__PURE__ */ e({DEFAULT_ENV_PREFIX:()=>u,GENERATED_FORMAT_OPTIONS:()=>q,applyOverrides:()=>R,buildConfigJson:()=>p,cliFlagLabel:()=>h,cliFlagOf:()=>g,cliShortOf:()=>_,collectEnvVars:()=>d,collectRequiredEnvVars:()=>f,compileZodSchema:()=>t,createCliArgsParser:()=>v,createConfigEngine:()=>L,envBool:()=>z,envInt:()=>B,envList:()=>V,envMap:()=>H,envMetaOf:()=>n,envPathOf:()=>l,envString:()=>U,findProjectRoot:()=>F,flagOf:()=>y,flattenBaseSchema:()=>r,formatGenerated:()=>J,generateCliArgsOptions:()=>b,generateCliOptions:()=>x,generateConfigJsonSchema:()=>T,generateConfigMarkdown:()=>D,generateConfigTypes:()=>j,generateEnv:()=>S,generateEnvDts:()=>C,generateEnvFile:()=>m,generateEnvTypes:()=>w,generateJsonSchemaFile:()=>E,monorepoRoot:()=>I,parseEnvTree:()=>W,readEnvPath:()=>G,renderAllConfigTypes:()=>M,renderConfigFileMarkdown:()=>O,renderConfigIndex:()=>k,renderConfigTypes:()=>N,renderScopeMarkdown:()=>A,renderTsType:()=>i,resolveScopeSchema:()=>P,resolveUntypedSchema:()=>a,splitBaseSchema:()=>o,trimTrailingSlashes:()=>K,zodToJsonSchema:()=>s,zodToUntypedDefinition:()=>c});export{u as DEFAULT_ENV_PREFIX,q as GENERATED_FORMAT_OPTIONS,R as applyOverrides,p as buildConfigJson,h as cliFlagLabel,g as cliFlagOf,_ as cliShortOf,d as collectEnvVars,f as collectRequiredEnvVars,t as compileZodSchema,v as createCliArgsParser,L as createConfigEngine,z as envBool,B as envInt,V as envList,H as envMap,n as envMetaOf,l as envPathOf,U as envString,F as findProjectRoot,y as flagOf,r as flattenBaseSchema,J as formatGenerated,b as generateCliArgsOptions,x as generateCliOptions,T as generateConfigJsonSchema,D as generateConfigMarkdown,j as generateConfigTypes,S as generateEnv,C as generateEnvDts,m as generateEnvFile,w as generateEnvTypes,E as generateJsonSchemaFile,I as monorepoRoot,W as parseEnvTree,G as readEnvPath,M as renderAllConfigTypes,O as renderConfigFileMarkdown,k as renderConfigIndex,N as renderConfigTypes,A as renderScopeMarkdown,i as renderTsType,P as resolveScopeSchema,a as resolveUntypedSchema,o as splitBaseSchema,Y as src_exports,K as trimTrailingSlashes,s as zodToJsonSchema,c as zodToUntypedDefinition};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region packages/core/src/gitignore.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Keep a consumer's `.gitignore` in sync with the toolchain's generated state.
|
|
6
|
+
*
|
|
7
|
+
* Everything under `.dbx/` is generated and local: the project graph embeds an
|
|
8
|
+
* absolute root path, so it must not be committed. The managed-file manifest is
|
|
9
|
+
* the exception, since it holds no absolute paths and is useful to track. Only
|
|
10
|
+
* an existing `.gitignore` is edited; a repo without one is left alone.
|
|
11
|
+
*/
|
|
12
|
+
/** The block appended to a consumer's `.gitignore`. */
|
|
13
|
+
export declare const DBX_GITIGNORE_BLOCK: string;
|
|
14
|
+
/**
|
|
15
|
+
* Append the `.dbx` ignore block to `<cwd>/.gitignore` when the file exists and
|
|
16
|
+
* does not already mention `.dbx`. Returns whether the file changed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ensureDbxGitignore(cwd: string): boolean;
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import t from"node:fs";const n=[`# @deltabox/toolchain (generated state; keep only the manifest)`,`.dbx/*`,`!.dbx/toolchain`,`.dbx/toolchain/*`,`!.dbx/toolchain/manifest.json`].join(`
|
|
2
|
+
`);function r(r){let i=e.join(r,`.gitignore`),a;try{a=t.readFileSync(i,`utf-8`)}catch{return!1}if(a.includes(`.dbx`))return!1;let o=a.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,s=n.split(`
|
|
6
|
+
`).join(o),c=a===``||a.endsWith(`
|
|
7
|
+
`)?o:`${o}${o}`;return t.writeFileSync(i,`${a}${c}${s}${o}`,`utf-8`),!0}export{n as DBX_GITIGNORE_BLOCK,r as ensureDbxGitignore};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { DBX_GITIGNORE_BLOCK, ensureDbxGitignore } from "./gitignore.js";
|
|
3
4
|
import { BuildProjectGraphOptions, IGNORED_DIRS, PackageManager, ProjectGraph, ProjectNode, buildProjectGraph, detectPackageManager, orderProjects, projectGraphPath, readProjectGraph, writeProjectGraph } from "./graph.js";
|
|
4
5
|
import { LoadedConfig, findConfigFile, loadToolingConfig } from "./loader.js";
|
|
5
6
|
import { MANIFEST_DIR, MANIFEST_FILE, Manifest, readManifest, writeManifest } from "./manifest.js";
|
|
@@ -10,7 +11,7 @@ import { RunSyncOptions, SyncResult, runSync } from "./sync.js";
|
|
|
10
11
|
import { VscodeSyncOptions, vscodeSyncTask } from "./vscode.js";
|
|
11
12
|
import { RunWatchOptions, runWatch } from "./watch.js";
|
|
12
13
|
declare namespace index_d_exports {
|
|
13
|
-
export { BuildProjectGraphOptions, IGNORED_DIRS, LoadedConfig, MANIFEST_DIR, MANIFEST_FILE, Manifest, PackageManager, ProjectGraph, ProjectNode, ResetProjectsOptions, ResetProjectsResult, ResetSelectors, ResetToolingOptions, ResetToolingResult, RunSyncOptions, RunWatchOptions, SelectProjectsOptions, SelectedProject, SyncResult, VscodeSyncOptions, buildProjectGraph, detectPackageManager, detectProjectType, findConfigFile, loadToolingConfig, orderProjects, projectGraphPath, readManifest, readProjectGraph, resetProjects, resetTooling, resolveProjectType, runSync, runWatch, selectProjects, vscodeSyncTask, writeManifest, writeProjectGraph };
|
|
14
|
+
export { BuildProjectGraphOptions, DBX_GITIGNORE_BLOCK, IGNORED_DIRS, LoadedConfig, MANIFEST_DIR, MANIFEST_FILE, Manifest, PackageManager, ProjectGraph, ProjectNode, ResetProjectsOptions, ResetProjectsResult, ResetSelectors, ResetToolingOptions, ResetToolingResult, RunSyncOptions, RunWatchOptions, SelectProjectsOptions, SelectedProject, SyncResult, VscodeSyncOptions, buildProjectGraph, detectPackageManager, detectProjectType, ensureDbxGitignore, findConfigFile, loadToolingConfig, orderProjects, projectGraphPath, readManifest, readProjectGraph, resetProjects, resetTooling, resolveProjectType, runSync, runWatch, selectProjects, vscodeSyncTask, writeManifest, writeProjectGraph };
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
16
|
-
export { BuildProjectGraphOptions, IGNORED_DIRS, LoadedConfig, MANIFEST_DIR, MANIFEST_FILE, Manifest, PackageManager, ProjectGraph, ProjectNode, ResetProjectsOptions, ResetProjectsResult, ResetSelectors, ResetToolingOptions, ResetToolingResult, RunSyncOptions, RunWatchOptions, SelectProjectsOptions, SelectedProject, SyncResult, VscodeSyncOptions, buildProjectGraph, detectPackageManager, detectProjectType, findConfigFile, index_d_exports, loadToolingConfig, orderProjects, projectGraphPath, readManifest, readProjectGraph, resetProjects, resetTooling, resolveProjectType, runSync, runWatch, selectProjects, vscodeSyncTask, writeManifest, writeProjectGraph };
|
|
17
|
+
export { BuildProjectGraphOptions, DBX_GITIGNORE_BLOCK, IGNORED_DIRS, LoadedConfig, MANIFEST_DIR, MANIFEST_FILE, Manifest, PackageManager, ProjectGraph, ProjectNode, ResetProjectsOptions, ResetProjectsResult, ResetSelectors, ResetToolingOptions, ResetToolingResult, RunSyncOptions, RunWatchOptions, SelectProjectsOptions, SelectedProject, SyncResult, VscodeSyncOptions, buildProjectGraph, detectPackageManager, detectProjectType, ensureDbxGitignore, findConfigFile, index_d_exports, loadToolingConfig, orderProjects, projectGraphPath, readManifest, readProjectGraph, resetProjects, resetTooling, resolveProjectType, runSync, runWatch, selectProjects, vscodeSyncTask, writeManifest, writeProjectGraph };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{__exportAll as e}from"../../../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{__exportAll as e}from"../../../_virtual/_rolldown/runtime.js";import{DBX_GITIGNORE_BLOCK as t,ensureDbxGitignore as n}from"./gitignore.js";import{detectProjectType as r,resolveProjectType as i}from"./project-type.js";import{findConfigFile as a,loadToolingConfig as o}from"./loader.js";import{IGNORED_DIRS as s,buildProjectGraph as c,detectPackageManager as l,orderProjects as u,projectGraphPath as d,readProjectGraph as f,writeProjectGraph as p}from"./graph.js";import{MANIFEST_DIR as m,MANIFEST_FILE as h,readManifest as g,writeManifest as _}from"./manifest.js";import{selectProjects as v}from"./select.js";import{resetProjects as y,resetTooling as b}from"./reset.js";import{runSync as x}from"./sync.js";import{vscodeSyncTask as S}from"./vscode.js";import{runWatch as C}from"./watch.js";var w=/* @__PURE__ */ e({DBX_GITIGNORE_BLOCK:()=>t,IGNORED_DIRS:()=>s,MANIFEST_DIR:()=>m,MANIFEST_FILE:()=>h,buildProjectGraph:()=>c,detectPackageManager:()=>l,detectProjectType:()=>r,ensureDbxGitignore:()=>n,findConfigFile:()=>a,loadToolingConfig:()=>o,orderProjects:()=>u,projectGraphPath:()=>d,readManifest:()=>g,readProjectGraph:()=>f,resetProjects:()=>y,resetTooling:()=>b,resolveProjectType:()=>i,runSync:()=>x,runWatch:()=>C,selectProjects:()=>v,vscodeSyncTask:()=>S,writeManifest:()=>_,writeProjectGraph:()=>p});export{t as DBX_GITIGNORE_BLOCK,s as IGNORED_DIRS,m as MANIFEST_DIR,h as MANIFEST_FILE,c as buildProjectGraph,l as detectPackageManager,r as detectProjectType,n as ensureDbxGitignore,a as findConfigFile,o as loadToolingConfig,u as orderProjects,d as projectGraphPath,g as readManifest,f as readProjectGraph,y as resetProjects,b as resetTooling,i as resolveProjectType,x as runSync,C as runWatch,v as selectProjects,w as src_exports,S as vscodeSyncTask,_ as writeManifest,p as writeProjectGraph};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import{pathToFileURL as t}from"node:url";import.meta.url;import{CONFIG_FILE_NAMES as n,resolveTokens as r}from"../../shared/src/toolchain.js";import"../../shared/src/index.js";import{resolveProjectType as i}from"./project-type.js";import a from"node:fs";function o(t=process.cwd()){for(let r of n){let n=e.resolve(t,r);if(a.existsSync(n))return n}}async function s(e){if(e.endsWith(`.json`))return JSON.parse(a.readFileSync(e,`utf-8`));let n=t(e).href;try{let e=await import(n);return e.default??e}catch(e){try{let{tsImport:e}=await import(`/home/runner/work/toolchain/toolchain/node_modules/tsx/dist/esm/api/index.mjs`),t=await e(n,import.meta.url);return t.default??t}catch{throw e}}}async function c(e=process.cwd()){let t=o(e),n={};if(t){let e=await s(t),r=e&&typeof e==`object`?e.toolchain:void 0;r&&typeof r==`object`&&(n=r)}let a=r(n);return await n.hooks?.afterLoad?.({cwd:e,config:n,tokens:a,...t?{path:t}:{}}),{config:n,...t?{path:t}:{},tokens:a,projectType:i(e,n)}}export{o as findConfigFile,c as loadToolingConfig};
|
|
1
|
+
import{default as e}from"node:path";import{pathToFileURL as t}from"node:url";import.meta.url;import{CONFIG_FILE_NAMES as n,resolveTokens as r}from"../../shared/src/toolchain.js";import"../../shared/src/index.js";import{resolveProjectType as i}from"./project-type.js";import a from"node:fs";function o(t=process.cwd()){for(let r of n){let n=e.resolve(t,r);if(a.existsSync(n))return n}}async function s(e){if(e.endsWith(`.json`))return JSON.parse(a.readFileSync(e,`utf-8`).replace(/^\uFEFF/,``));let n=t(e).href;try{let e=await import(n);return e.default??e}catch(e){try{let{tsImport:e}=await import(`/home/runner/work/toolchain/toolchain/node_modules/tsx/dist/esm/api/index.mjs`),t=await e(n,import.meta.url);return t.default??t}catch{throw e}}}async function c(e=process.cwd()){let t=o(e),n={};if(t){let e=await s(t),r=e&&typeof e==`object`?e.toolchain:void 0;r&&typeof r==`object`&&(n=r)}let a=r(n);return await n.hooks?.afterLoad?.({cwd:e,config:n,tokens:a,...t?{path:t}:{}}),{config:n,...t?{path:t}:{},tokens:a,projectType:i(e,n)}}export{o as findConfigFile,c as loadToolingConfig};
|
|
@@ -20,7 +20,7 @@ export interface RunSyncOptions {
|
|
|
20
20
|
check?: boolean;
|
|
21
21
|
/** Suppress logging. */
|
|
22
22
|
quiet?: boolean;
|
|
23
|
-
/** Custom logger (default `
|
|
23
|
+
/** Custom logger (default `logger.info`). */
|
|
24
24
|
log?: (message: string) => void;
|
|
25
25
|
}
|
|
26
26
|
export interface SyncResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../shared/src/logger.js";import"../../shared/src/index.js";import{ensureDbxGitignore as n}from"./gitignore.js";import{resolveProjectType as r}from"./project-type.js";import{readManifest as i,writeManifest as a}from"./manifest.js";import o from"node:fs";function s(e){return e.replace(/\\/g,`/`)}async function c(c){let{tasks:l,cwd:u,config:d,tokens:f}=c,p=c.quiet?()=>{}:c.log??(e=>t.info(e)),m=c.projectType??r(u,d),h={cwd:u,projectType:m,config:d,tokens:f,log:p},g=d.hooks??{};await g.beforeSync?.(h);let _=l.filter(e=>(!e.projectTypes||e.projectTypes.includes(m))&&(!e.enabled||e.enabled(d)));p(`running ${_.length} task(s)${c.check?` (check)`:``} [${m}]`);let v=[];for(let e of _){p(` - ${e.name}`),await g.beforeTask?.({task:e,ctx:h});let t=await e.run(h),n=Array.isArray(t)?t:void 0;n&&v.push(...n),await g.afterTask?.({task:e,ctx:h,...n?{files:n}:{}})}let y=new Map(v.map(e=>[s(e.path),e.content])),b=i(u),x=/* @__PURE__ */ new Set;for(let e of _)for(let t of e.keep??[])x.add(t);let S=e=>{for(let t of x)if(e===t||e.endsWith(`/${t}`)||e.endsWith(t))return!0;return!1},C=[];for(let[t,n]of y){let r=e.resolve(u,t);(o.existsSync(r)?o.readFileSync(r,`utf-8`):void 0)!==n&&C.push(t)}let w=b.files.filter(t=>!y.has(t)&&!S(t)&&o.existsSync(e.resolve(u,t))),T=C.length===0&&w.length===0;if(c.check){if(T)p(`generated files are in sync.`);else{p(`generated files are out of date:`);for(let e of C)p(` M ${e}`);for(let e of w)p(` D ${e}`);p("Run `dbx sync` to regenerate them.")}let e={written:[],changed:C,removed:w,upToDate:T};return await g.afterSync?.({cwd:u,config:d,result:e}),e}let E=[];for(let[t,n]of y){let r=e.resolve(u,t);o.mkdirSync(e.dirname(r),{recursive:!0}),o.writeFileSync(r,n,`utf-8`),E.push(t)}for(let t of w)o.rmSync(e.resolve(u,t),{force:!0});a(u,[...y.keys()]),n(u)&&p(` I .gitignore (added the .dbx ignore block)`),p(`wrote ${E.length}, removed ${w.length} file(s)${C.length?`, updated ${C.length}`:``}.`);let D={written:E,changed:C,removed:w,upToDate:T};return await g.afterSync?.({cwd:u,config:d,result:D}),D}export{c as runSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../shared/src/logger.js";import"../../shared/src/index.js";import{runSync as n}from"./sync.js";import r from"node:fs";import{Glob as i}from"glob";async function a(a){let{cwd:o,tasks:s}=a,c=a.debounce??150,l=a.quiet?()=>{}:a.log??(e=>t.info(e)),u=0,d,f=!1,p=!1,m=async()=>{if(f)p=!0;else{f=!0;try{await n(a)}finally{f=!1,u=Date.now()+Math.max(c*3,300),p&&(p=!1,h())}}},h=()=>{clearTimeout(d),d=setTimeout(m,c)};await m();let g=/* @__PURE__ */ new Set([o]),_=/* @__PURE__ */ new Set;for(let e of s)for(let t of e.watch??[])_.add(t);for(let t of _)try{let n=new i(t,{cwd:o,dot:!0,ignore:[`**/node_modules/**`]}).walkSync();for(let t of n)g.add(e.dirname(e.resolve(o,t)))}catch{}let v=[],y=e=>{Date.now()<u||(a.config?.hooks?.onChange?.(e?{path:e}:{}),h())};if(a.configPath)try{v.push(r.watch(a.configPath,()=>{l(`config changed; re-syncing`),y(a.configPath)}))}catch{}for(let e of g)try{v.push(r.watch(e,{recursive:!0},(e,t)=>y(t??void 0)))}catch{try{v.push(r.watch(e,(e,t)=>y(t??void 0)))}catch{}}l(`watching for changes (Ctrl+C to stop)`),await new Promise(e=>{let t=()=>{d&&clearTimeout(d),d=void 0;for(let e of v)e.close();process.off(`SIGINT`,t),process.off(`SIGTERM`,t),e()};process.on(`SIGINT`,t),process.on(`SIGTERM`,t)})}export{a as runWatch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{diffFiles as
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{diffFiles as n,hasPending as r}from"../check.js";import{detectMigrations as i,listMigrations as a,migrations as o}from"../registry.js";function s(){return[{name:`migrate`,description:`Migrate Biome / ESLint / Prettier / Dprint config to Ox (oxlint + oxfmt).`,options:[{flags:`--from <tool>`,description:`Source tool: biome | eslint | prettier | dprint | all.`},{flags:`--to <tool>`,description:`Target tool (default: ox).`,default:`ox`},{flags:`--cwd <dir>`,description:`Project root (default: cwd).`},{flags:`--write`,description:`Write the files (default: dry-run).`},{flags:`--dry-run`,description:`Do not write anything (default).`},{flags:`--check`,description:`CI: exit non-zero when the ox config is stale.`},{flags:`--target <target>`,description:`files (default) | vite.`},{flags:`--online`,description:`Allow network (e.g. @oxlint/migrate).`},{flags:`--json`,description:`Print the result as JSON.`}],run:async(a,s)=>{let c=a.cwd??s.cwd,l=!!a.check,u=!!a.write&&!a.dryRun&&!l,d=!!a.online,f=a.from,p=a.target??`files`,m=!f||f===`all`?i(c):o().filter(e=>e.from===f);if(m.length===0){t.info(f&&f!==`all`?`no "${f}" migration is registered.`:`nothing to migrate (no Biome/ESLint/Prettier/Dprint config detected).`);return}let h=[];for(let e of m)h.push(await e.run({cwd:c,write:u,online:d,target:p}));if(l){let i=h.flatMap(e=>n(e.files??[])),o=i.filter(e=>e.status!==`same`);if(a.json)t.raw(JSON.stringify(h,null,4));else if(o.length){for(let n of o)t.info(`${n.status} ${e.relative(c,n.path)||n.path}`);t.info(`${o.length} file(s) out of date — run \`migrate --write\` to apply.`)}else t.info(`up to date.`);r(i)&&(process.exitCode=1)}else if(a.json)t.raw(JSON.stringify(h,null,4));else{for(let e of h){t.info(`${e.from} -> ${e.to} ${u?`wrote`:`would write`}`);for(let n of e.written)t.info(` ${u?`+`:`?`} ${n}`);for(let n of e.notes??[])t.info(` ${n}`);if(e.unmapped?.length){t.info(` unmapped (${e.unmapped.length}):`);for(let n of e.unmapped.slice(0,25))t.info(` - ${n.source}: ${n.reason}`)}}u||t.info(`dry-run — re-run with --write to apply.`)}}},{name:`migrate:list`,description:`List the registered migrations and whether each is detected.`,options:[{flags:`--cwd <dir>`,description:`Project root (default: cwd).`},{flags:`--json`,description:`Print as JSON.`}],run:(e,n)=>{let r=e.cwd??n.cwd,i=a(r);if(e.json)t.raw(JSON.stringify(i,null,4));else for(let e of i)t.info(` ${e.id.padEnd(16)} ${e.from} -> ${e.to} [${e.detected?`detected`:`not found`}]`),t.info(` ${e.description}`)}}]}export{s as migrateCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;const e=[`**/node_modules/**`,`**/dist/**`,`**/.turbo/**`];function t(e){let t=e.formatter??{},n=e.javascript?.formatter??{},r={},i=[];t.indentStyle&&(r.useTabs=t.indentStyle===`tab`),typeof t.indentWidth==`number`&&(r.tabWidth=t.indentWidth),typeof t.lineWidth==`number`&&(r.printWidth=t.lineWidth),t.lineEnding&&t.lineEnding!==`auto`&&(r.endOfLine=t.lineEnding),typeof t.bracketSameLine==`boolean`&&(r.bracketSameLine=t.bracketSameLine),typeof t.bracketSpacing==`boolean`&&(r.bracketSpacing=t.bracketSpacing),t.attributePosition===`multiline`&&(r.singleAttributePerLine=!0),n.quoteStyle&&(r.singleQuote=n.quoteStyle===`single`),n.jsxQuoteStyle&&(r.jsxSingleQuote=n.jsxQuoteStyle===`single`),n.quoteProperties&&(r.quoteProps=n.quoteProperties===`asNeeded`?`as-needed`:`preserve`),n.trailingCommas&&(r.trailingComma=n.trailingCommas),n.semicolons&&(r.semi=n.semicolons===`always`),n.arrowParentheses&&(r.arrowParens=n.arrowParentheses===`always`?`always`:`avoid`);
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;const e=[`**/node_modules/**`,`**/dist/**`,`**/.turbo/**`];function t(e){let t=e.formatter??{},n=e.javascript?.formatter??{},r={},i=[];t.indentStyle&&(r.useTabs=t.indentStyle===`tab`),typeof t.indentWidth==`number`&&(r.tabWidth=t.indentWidth),typeof t.lineWidth==`number`&&(r.printWidth=t.lineWidth),t.lineEnding&&t.lineEnding!==`auto`&&(r.endOfLine=t.lineEnding),typeof t.bracketSameLine==`boolean`&&(r.bracketSameLine=t.bracketSameLine),typeof t.bracketSpacing==`boolean`&&(r.bracketSpacing=t.bracketSpacing),t.attributePosition===`multiline`&&(r.singleAttributePerLine=!0),n.quoteStyle&&(r.singleQuote=n.quoteStyle===`single`),n.jsxQuoteStyle&&(r.jsxSingleQuote=n.jsxQuoteStyle===`single`),n.quoteProperties&&(r.quoteProps=n.quoteProperties===`asNeeded`?`as-needed`:`preserve`),n.trailingCommas&&(r.trailingComma=n.trailingCommas),n.semicolons&&(r.semi=n.semicolons===`always`),n.arrowParentheses&&(r.arrowParens=n.arrowParentheses===`always`?`always`:`avoid`);let a=[[`formatter.expand`,t,`expand`],[`formatter.useEditorconfig`,t,`useEditorconfig`],[`formatter.formatWithErrors`,t,`formatWithErrors`],[`javascript.formatter.jsxQuoteStyle`,n,`jsxQuoteStyle`]];for(let[e,t,n]of a)n in t&&i.push({source:e,reason:`no Oxfmt equivalent`});return{oxfmt:r,unmapped:i}}function n(t){let n=(t.files?.includes??[]).filter(e=>typeof e==`string`&&e.startsWith(`!`)).map(e=>e.slice(1));return[.../* @__PURE__ */ new Set([...e,...n])]}const r={":NODE:":`builtin`,":BUN:":`builtin`,":PACKAGE:":`external`,":ALIAS:":`internal`,":PATH:":[`parent`,`sibling`,`index`]};function i(e){return/^[@~#][\w-]*\/?/.test(e)||e.endsWith(`/**`)}function a(e){let t=[],n=[],a=[],o=/* @__PURE__ */ new Set([`~/`,`@/`]),s=Array.isArray(e)?e:[];for(let e of s){if(e===`:BLANK_LINE:`)continue;let s=Array.isArray(e)?e:[e],c=[];for(let e of s){if(typeof e!=`string`)continue;if(e in r){let t=r[e];if(!t)continue;for(let e of Array.isArray(t)?t:[t])c.push(e);continue}if(e.startsWith(`:`)){t.push({source:`organizeImports ${e}`,reason:`unknown Biome selector`});continue}if(e.startsWith(`!`)){t.push({source:`organizeImports ${e}`,reason:`negated group members are approximated`});continue}if(i(e)){let t=e.replace(/\*+.*$/,``);t&&o.add(t),c.push(`internal`);continue}let n=`custom${a.length}`;a.push({groupName:n,elementNamePattern:[e]}),c.push(n)}let l=[...new Set(c)];l.length&&n.push(l.length===1?l[0]:l)}let c=[];for(let e of n){let t=c[c.length-1];(t===void 0||JSON.stringify(t)!==JSON.stringify(e))&&c.push(e)}let l={groups:c,internalPattern:[...o],newlinesBetween:!0,sortPackageJson:!1};return a.length&&(l.customGroups=a),{sortImports:l,unmapped:t}}function o(e){let r=t(e),i={...r.oxfmt,ignorePatterns:n(e)},o=[...r.unmapped],s=e.assist?.actions?.source?.organizeImports;if(s){let e=s.options?.groups;if(e){let t=a(e);i.sortImports=t.sortImports,o.push(...t.unmapped)}}return{oxfmt:i,unmapped:o}}export{e as DEFAULT_IGNORE,t as mapBiomeFormatter,n as mapBiomeIncludes,o as mapBiomeToOxfmt,a as mapOrganizeImports};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{createMonorepoRootFiles as
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{logger as e}from"../../../shared/src/logger.js";import"../../../shared/src/index.js";import{createMonorepoRootFiles as t,createRootProjectFiles as n,createWorkspaceFiles as r,writeGeneratedFiles as i}from"../typescript.js";import{generateProjectConfigs as a}from"../config.js";const o=[{flags:`--no-config`,description:`Skip the dbx.config.ts file.`},{flags:`--type <type>`,description:`Project type: project | monorepo-root | monorepo-workspace.`}];function s(){return[{name:`project:init`,description:`Scaffold a single-package TypeScript project.`,options:[{flags:`-n, --name <name>`,description:`Project name.`},{flags:`-s, --scope <scope>`,description:`npm scope, eg. @acme.`},{flags:`-o, --out <dir>`,description:`Output directory (default: cwd).`},...o],run:(t,r)=>{let a=String(t.name??r.config.project?.name??`app`),o=n({name:a,...t.scope?{scope:t.scope}:{},type:t.type??`project`,includeConfig:t.config??!0}),s=i(o,t.out??r.cwd);for(let t of s)e.info(`Created ${t}`)}},{name:`project:init:monorepo`,description:`Scaffold a monorepo root + one example workspace.`,options:[{flags:`-n, --name <name>`,description:`Project name.`},{flags:`-s, --scope <scope>`,description:`npm scope, eg. @acme.`},{flags:`-o, --out <dir>`,description:`Output directory (default: cwd).`},...o],run:(n,a)=>{let o=String(n.name??a.config.project?.name??`monorepo`),s=n.scope??a.config.project?.scope??`@${o}`,c=n.out??a.cwd,l=n.config??!0,u=n.type??`monorepo-root`,d=t({name:o,scope:s,type:u,includeConfig:l,workspaces:[{alias:`core`,dir:`packages/core`}]});d.push(...r({name:o,scope:s,wsName:`core`,wsDir:`packages/core`,type:`monorepo-workspace`,includeConfig:l}).map(e=>({...e,path:`packages/core/${e.path}`})));let f=i(d,c);for(let t of f)e.info(`Created ${t}`)}},{name:`project:init:workspace`,description:`Scaffold a monorepo workspace package into an existing monorepo root.`,options:[{flags:`-n, --name <name>`,description:`Workspace package name (unscoped).`},{flags:`-s, --scope <scope>`,description:`npm scope, eg. @acme.`},{flags:`-r, --root <dir>`,description:`Monorepo root (default: cwd).`},{flags:`-d, --dir <dir>`,description:`Workspace dir relative to the root (default: packages/<name>).`},...o],run:(t,n)=>{let a=t.root??n.cwd,o=String(t.name??`workspace`),s=t.scope??n.config.project?.scope??`@${o}`,c=(t.dir??`packages/${o}`).replace(/\\/g,`/`).replace(/\/+$/,``),l=t.config??!0,u=t.type??`monorepo-workspace`,d=r({name:o,scope:s,wsName:o,wsDir:c,type:u,includeConfig:l}).map(e=>({...e,path:`${c}/${e.path}`})),f=i(d,a);for(let t of f)e.info(`Created ${t}`)}},{name:`project:config`,description:`Generate dbx.config.ts for existing projects that are missing one.`,options:[{flags:`--cwd <dir>`,description:`Root to scan (default: cwd).`},{flags:`--include <pattern...>`,description:`Only projects matching these patterns (glob or substring).`},{flags:`--exclude <pattern...>`,description:`Skip projects matching these patterns (glob or substring).`},{flags:`--type <type>`,description:`Force a project type for every config.`},{flags:`--force`,description:`Overwrite configs that already exist.`},{flags:`--dry-run`,description:`Report what would be written without writing.`},{flags:`--json`,description:`Print the result as JSON.`}],run:(t,n)=>{let r=t.cwd??n.cwd,i=a({root:r,...t.include?{include:t.include}:{},...t.exclude?{exclude:t.exclude}:{},...t.type?{type:t.type}:{},force:!!t.force,dryRun:!!t.dryRun});if(t.json){e.raw(JSON.stringify(i,null,4));return}let o=i.dryRun?`would create`:`created`;e.info(`${o} ${i.created.length} config(s), skipped ${i.skipped.length}.`);for(let t of i.configs)t.created&&e.info(` + ${t.rel===`.`?`dbx.config.ts`:`${t.rel}/dbx.config.ts`} [${t.type}]`)}}]}export{s as projectCommands};
|