@donotdev/cli 0.0.4 → 0.0.5
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/dependencies-matrix.json +194 -98
- package/dist/bin/commands/bump.js +103 -96
- package/dist/bin/commands/create-app.js +40 -28
- package/dist/bin/commands/create-project.js +40 -28
- package/dist/index.js +40 -28
- package/package.json +1 -1
- package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +5 -5
- package/templates/app-next/src/app/ClientLayout.tsx.example +1 -1
- package/templates/app-vite/src/App.tsx.example +1 -1
- package/templates/root-consumer/guides/AGENT_START_HERE.md.example +229 -7
- package/templates/root-consumer/guides/COMPONENTS_ADV.md.example +360 -0
- package/templates/root-consumer/guides/COMPONENTS_ATOMIC.md.example +1 -1
- package/templates/root-consumer/guides/COMPONENTS_UI.md.example +6 -0
- package/templates/root-consumer/guides/SETUP_I18N.md.example +145 -6
- package/templates/root-consumer/guides/SETUP_LAYOUTS.md.example +18 -0
- package/templates/root-consumer/guides/SETUP_PAGES.md.example +8 -0
|
@@ -7489,10 +7489,6 @@ import {
|
|
|
7489
7489
|
resolve as resolve2,
|
|
7490
7490
|
isAbsolute as pathIsAbsolute
|
|
7491
7491
|
} from "node:path";
|
|
7492
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7493
|
-
function getDirnameFromUrl(importMetaUrl) {
|
|
7494
|
-
return dirname2(fileURLToPath2(importMetaUrl));
|
|
7495
|
-
}
|
|
7496
7492
|
function detectExecutionMode() {
|
|
7497
7493
|
const currentDir = process.cwd();
|
|
7498
7494
|
const toolingPath = joinPath(currentDir, PACKAGE_PATHS.TOOLING);
|
|
@@ -7505,10 +7501,6 @@ function detectExecutionMode() {
|
|
|
7505
7501
|
}
|
|
7506
7502
|
return "published";
|
|
7507
7503
|
}
|
|
7508
|
-
function getCliRootFromBundle() {
|
|
7509
|
-
const currentDir = getDirnameFromUrl(import.meta.url);
|
|
7510
|
-
return normalizePath(currentDir, "..", "..", "..");
|
|
7511
|
-
}
|
|
7512
7504
|
function globSync(pattern, options = {}) {
|
|
7513
7505
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
7514
7506
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
@@ -7566,7 +7558,7 @@ var init_pathResolver = __esm({
|
|
|
7566
7558
|
|
|
7567
7559
|
// packages/tooling/src/bundler/utils.ts
|
|
7568
7560
|
import { createRequire as createRequire3 } from "node:module";
|
|
7569
|
-
import { fileURLToPath as
|
|
7561
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7570
7562
|
import { dirname as dirname3, resolve as resolve3 } from "node:path";
|
|
7571
7563
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
7572
7564
|
import process from "node:process";
|
|
@@ -7575,7 +7567,7 @@ var init_utils = __esm({
|
|
|
7575
7567
|
"packages/tooling/src/bundler/utils.ts"() {
|
|
7576
7568
|
"use strict";
|
|
7577
7569
|
require2 = createRequire3(import.meta.url);
|
|
7578
|
-
__filename =
|
|
7570
|
+
__filename = fileURLToPath2(import.meta.url);
|
|
7579
7571
|
__dirname = dirname3(__filename);
|
|
7580
7572
|
if (typeof globalThis !== "undefined") {
|
|
7581
7573
|
globalThis.require = require2;
|
|
@@ -7617,52 +7609,60 @@ async function askForConfirmation(message, defaultValue = false) {
|
|
|
7617
7609
|
// packages/tooling/src/utils/matrix.ts
|
|
7618
7610
|
init_utils();
|
|
7619
7611
|
init_pathResolver();
|
|
7612
|
+
import { createRequire as createRequire4 } from "node:module";
|
|
7620
7613
|
var cachedMatrix = null;
|
|
7621
7614
|
function getMatrixPath(mode) {
|
|
7615
|
+
try {
|
|
7616
|
+
const require3 = createRequire4(import.meta.url);
|
|
7617
|
+
const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
|
|
7618
|
+
if (pathExists(resolved)) {
|
|
7619
|
+
return resolved;
|
|
7620
|
+
}
|
|
7621
|
+
} catch {
|
|
7622
|
+
}
|
|
7622
7623
|
const executionMode = mode || detectExecutionMode();
|
|
7623
7624
|
if (executionMode === "development") {
|
|
7624
7625
|
const repoRoot = getRepoRoot();
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7626
|
+
if (repoRoot) {
|
|
7627
|
+
const devPath = normalizePath(
|
|
7628
|
+
repoRoot,
|
|
7629
|
+
"packages/cli/dependencies-matrix.json"
|
|
7630
|
+
);
|
|
7631
|
+
if (pathExists(devPath)) {
|
|
7632
|
+
return devPath;
|
|
7633
|
+
}
|
|
7631
7634
|
}
|
|
7632
|
-
return devPath;
|
|
7633
|
-
}
|
|
7634
|
-
const cliPackagePath = getCliRootFromBundle();
|
|
7635
|
-
const matrixPath = joinPath(cliPackagePath, "dependencies-matrix.json");
|
|
7636
|
-
if (!pathExists(matrixPath)) {
|
|
7637
|
-
throw new Error(`[PROD] Matrix not found at: ${matrixPath}`);
|
|
7638
7635
|
}
|
|
7639
|
-
return
|
|
7636
|
+
return null;
|
|
7640
7637
|
}
|
|
7641
7638
|
function getCliVersion(mode) {
|
|
7639
|
+
try {
|
|
7640
|
+
const require3 = createRequire4(import.meta.url);
|
|
7641
|
+
const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
|
|
7642
|
+
const pkg = readSync(packageJsonPath, { format: "json" });
|
|
7643
|
+
return String(pkg?.version || "0.0.0");
|
|
7644
|
+
} catch {
|
|
7645
|
+
}
|
|
7642
7646
|
const executionMode = mode || detectExecutionMode();
|
|
7643
7647
|
if (executionMode === "development") {
|
|
7644
7648
|
const repoRoot = getRepoRoot();
|
|
7645
7649
|
const cliPackageJson = joinPath(repoRoot, "packages/cli/package.json");
|
|
7646
|
-
if (
|
|
7647
|
-
|
|
7650
|
+
if (pathExists(cliPackageJson)) {
|
|
7651
|
+
const pkg = readSync(cliPackageJson, { format: "json" });
|
|
7652
|
+
return String(pkg?.version || "0.0.0");
|
|
7648
7653
|
}
|
|
7649
|
-
const pkg2 = readSync(cliPackageJson, { format: "json" });
|
|
7650
|
-
return String(pkg2?.version || "0.0.0");
|
|
7651
|
-
}
|
|
7652
|
-
const cliPackagePath = getCliRootFromBundle();
|
|
7653
|
-
const packageJsonPath = joinPath(cliPackagePath, "package.json");
|
|
7654
|
-
if (!pathExists(packageJsonPath)) {
|
|
7655
|
-
throw new Error(`[PROD] CLI package.json not found at: ${packageJsonPath}`);
|
|
7656
7654
|
}
|
|
7657
|
-
|
|
7658
|
-
return String(pkg?.version || "0.0.0");
|
|
7655
|
+
return "0.0.0";
|
|
7659
7656
|
}
|
|
7660
7657
|
function loadMatrix(mode) {
|
|
7661
7658
|
if (cachedMatrix) return cachedMatrix;
|
|
7662
7659
|
const matrixPath = getMatrixPath(mode);
|
|
7660
|
+
if (!matrixPath) {
|
|
7661
|
+
return null;
|
|
7662
|
+
}
|
|
7663
7663
|
const content = readSync(matrixPath, { format: "json" });
|
|
7664
7664
|
if (!content) {
|
|
7665
|
-
|
|
7665
|
+
return null;
|
|
7666
7666
|
}
|
|
7667
7667
|
cachedMatrix = {
|
|
7668
7668
|
matrix: content,
|
|
@@ -7680,9 +7680,10 @@ function flattenGroups(groups) {
|
|
|
7680
7680
|
return flat;
|
|
7681
7681
|
}
|
|
7682
7682
|
function getMigrationGuide(currentMajor, targetMajor, mode) {
|
|
7683
|
-
const
|
|
7683
|
+
const matrixResult = loadMatrix(mode);
|
|
7684
|
+
if (!matrixResult) return void 0;
|
|
7684
7685
|
const key = `${currentMajor}.0\u2192${targetMajor}.0`;
|
|
7685
|
-
return matrix.migrationGuides?.[key];
|
|
7686
|
+
return matrixResult.matrix.migrationGuides?.[key];
|
|
7686
7687
|
}
|
|
7687
7688
|
|
|
7688
7689
|
// packages/tooling/src/utils/package-deps.ts
|
|
@@ -7772,7 +7773,7 @@ async function queryNpmVersions(packages) {
|
|
|
7772
7773
|
function detectProjectDeps(files) {
|
|
7773
7774
|
const frameworkPkgs = /* @__PURE__ */ new Set();
|
|
7774
7775
|
const externalDeps = /* @__PURE__ */ new Set();
|
|
7775
|
-
const
|
|
7776
|
+
const packageOccurrences = /* @__PURE__ */ new Map();
|
|
7776
7777
|
for (const file of files) {
|
|
7777
7778
|
const pkg = parsePackageJson(file);
|
|
7778
7779
|
if (!pkg) continue;
|
|
@@ -7784,9 +7785,10 @@ function detectProjectDeps(files) {
|
|
|
7784
7785
|
if (!deps) continue;
|
|
7785
7786
|
for (const [name, version] of Object.entries(deps)) {
|
|
7786
7787
|
const key = `${name}:${field}`;
|
|
7787
|
-
if (!
|
|
7788
|
-
|
|
7788
|
+
if (!packageOccurrences.has(key)) {
|
|
7789
|
+
packageOccurrences.set(key, []);
|
|
7789
7790
|
}
|
|
7791
|
+
packageOccurrences.get(key).push({ version, field, file });
|
|
7790
7792
|
if (name.startsWith("@donotdev/")) {
|
|
7791
7793
|
frameworkPkgs.add(name);
|
|
7792
7794
|
} else {
|
|
@@ -7795,7 +7797,7 @@ function detectProjectDeps(files) {
|
|
|
7795
7797
|
}
|
|
7796
7798
|
}
|
|
7797
7799
|
}
|
|
7798
|
-
return { frameworkPkgs, externalDeps,
|
|
7800
|
+
return { frameworkPkgs, externalDeps, packageOccurrences };
|
|
7799
7801
|
}
|
|
7800
7802
|
async function main(options = {}) {
|
|
7801
7803
|
const { dryRun } = options;
|
|
@@ -7816,16 +7818,19 @@ async function main(options = {}) {
|
|
|
7816
7818
|
return 0;
|
|
7817
7819
|
}
|
|
7818
7820
|
log.info(`Found ${files.length} package.json file(s)`);
|
|
7819
|
-
const { frameworkPkgs, externalDeps,
|
|
7821
|
+
const { frameworkPkgs, externalDeps, packageOccurrences } = detectProjectDeps(files);
|
|
7820
7822
|
log.info(`Found ${frameworkPkgs.size} @donotdev/* package(s)`);
|
|
7821
7823
|
log.info(`Found ${externalDeps.size} external dep(s)`);
|
|
7822
7824
|
log.info("Querying npm...");
|
|
7823
7825
|
const npmVersions = await queryNpmVersions(Array.from(frameworkPkgs));
|
|
7824
|
-
const
|
|
7825
|
-
const matrixVersions = flattenGroups(matrix.groups);
|
|
7826
|
+
const matrixResult = loadMatrix();
|
|
7827
|
+
const matrixVersions = matrixResult ? flattenGroups(matrixResult.matrix.groups) : {};
|
|
7828
|
+
if (!matrixResult && externalDeps.size > 0) {
|
|
7829
|
+
log.info("Matrix not found - only updating @donotdev/* packages (external deps skipped)");
|
|
7830
|
+
}
|
|
7826
7831
|
const updates = [];
|
|
7827
7832
|
const majorUpdates = [];
|
|
7828
|
-
for (const [key,
|
|
7833
|
+
for (const [key, occurrences] of packageOccurrences) {
|
|
7829
7834
|
const [name, field] = key.split(":");
|
|
7830
7835
|
if (name === "@donotdev/templates") continue;
|
|
7831
7836
|
let latest;
|
|
@@ -7835,29 +7840,33 @@ async function main(options = {}) {
|
|
|
7835
7840
|
latest = matrixVersions[name];
|
|
7836
7841
|
}
|
|
7837
7842
|
if (!latest) continue;
|
|
7838
|
-
const
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
)
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7843
|
+
for (const occurrence of occurrences) {
|
|
7844
|
+
const normalizedCurrent = normalizeVersion(occurrence.version);
|
|
7845
|
+
const normalizedLatest = normalizeVersion(latest);
|
|
7846
|
+
const cmp = compareVersions(normalizedCurrent, normalizedLatest);
|
|
7847
|
+
if (cmp.equal || cmp.ahead) continue;
|
|
7848
|
+
const update = {
|
|
7849
|
+
pkg: name,
|
|
7850
|
+
field,
|
|
7851
|
+
current: occurrence.version,
|
|
7852
|
+
latest,
|
|
7853
|
+
file: occurrence.file,
|
|
7854
|
+
isMajor: cmp.isMajor
|
|
7855
|
+
};
|
|
7856
|
+
if (cmp.isMajor) {
|
|
7857
|
+
const currentMajor = Number(normalizedCurrent.split(".")[0]);
|
|
7858
|
+
const latestMajor = Number(normalizedLatest.split(".")[0]);
|
|
7859
|
+
if (matrixResult) {
|
|
7860
|
+
const guide = getMigrationGuide(currentMajor, latestMajor);
|
|
7861
|
+
if (guide) {
|
|
7862
|
+
update.migrationPath = guide.path;
|
|
7863
|
+
update.breakingChanges = guide.breakingChanges;
|
|
7864
|
+
}
|
|
7865
|
+
}
|
|
7866
|
+
majorUpdates.push(update);
|
|
7867
|
+
} else {
|
|
7868
|
+
updates.push(update);
|
|
7857
7869
|
}
|
|
7858
|
-
majorUpdates.push(update);
|
|
7859
|
-
} else {
|
|
7860
|
-
updates.push(update);
|
|
7861
7870
|
}
|
|
7862
7871
|
}
|
|
7863
7872
|
if (updates.length === 0 && majorUpdates.length === 0) {
|
|
@@ -7894,20 +7903,11 @@ ${majorUpdates.length} major update(s) available (manual review required):`
|
|
|
7894
7903
|
let shouldApply = false;
|
|
7895
7904
|
if (dryRun) {
|
|
7896
7905
|
log.info("\n[DRY RUN] Would update package.json files:");
|
|
7897
|
-
for (const
|
|
7898
|
-
const
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
"dependencies",
|
|
7903
|
-
"devDependencies",
|
|
7904
|
-
"peerDependencies"
|
|
7905
|
-
]) {
|
|
7906
|
-
if (pkg[field]?.[u2.pkg]) {
|
|
7907
|
-
log.info(` ${file}: ${u2.pkg} \u2192 ^${u2.latest}`);
|
|
7908
|
-
}
|
|
7909
|
-
}
|
|
7910
|
-
}
|
|
7906
|
+
for (const u2 of updates) {
|
|
7907
|
+
const relativeFile = appRoot ? getRelativePathBetween(appRoot, u2.file) : u2.file;
|
|
7908
|
+
const normalizedLatest = normalizeVersion(u2.latest);
|
|
7909
|
+
const displayLatest = ensureCaretPrefix(normalizedLatest);
|
|
7910
|
+
log.info(` ${relativeFile}: ${u2.pkg} ${u2.current} \u2192 ${displayLatest} (${u2.field})`);
|
|
7911
7911
|
}
|
|
7912
7912
|
log.info("\n[DRY RUN] No files modified");
|
|
7913
7913
|
} else {
|
|
@@ -7916,32 +7916,39 @@ ${majorUpdates.length} major update(s) available (manual review required):`
|
|
|
7916
7916
|
);
|
|
7917
7917
|
shouldApply = await askForConfirmation("Apply updates?", true);
|
|
7918
7918
|
if (shouldApply) {
|
|
7919
|
-
const updatedFiles = /* @__PURE__ */ new
|
|
7920
|
-
for (const
|
|
7919
|
+
const updatedFiles = /* @__PURE__ */ new Map();
|
|
7920
|
+
for (const u2 of updates) {
|
|
7921
|
+
if (!updatedFiles.has(u2.file)) {
|
|
7922
|
+
updatedFiles.set(u2.file, /* @__PURE__ */ new Set());
|
|
7923
|
+
}
|
|
7924
|
+
updatedFiles.get(u2.file).add(`${u2.pkg}:${u2.field}`);
|
|
7925
|
+
}
|
|
7926
|
+
for (const [file, packageKeys] of updatedFiles) {
|
|
7921
7927
|
const pkg = parsePackageJson(file);
|
|
7922
7928
|
if (!pkg) continue;
|
|
7923
7929
|
let changed = false;
|
|
7924
|
-
for (const
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7930
|
+
for (const packageKey of packageKeys) {
|
|
7931
|
+
const [pkgName, field] = packageKey.split(":");
|
|
7932
|
+
const update = updates.find(
|
|
7933
|
+
(u2) => u2.file === file && u2.pkg === pkgName && u2.field === field
|
|
7934
|
+
);
|
|
7935
|
+
if (!update) continue;
|
|
7936
|
+
const deps = pkg[field];
|
|
7937
|
+
if (deps?.[pkgName]) {
|
|
7938
|
+
const normalizedLatest = normalizeVersion(update.latest);
|
|
7939
|
+
deps[pkgName] = ensureCaretPrefix(normalizedLatest);
|
|
7940
|
+
changed = true;
|
|
7935
7941
|
}
|
|
7936
7942
|
}
|
|
7937
7943
|
if (changed) {
|
|
7938
7944
|
writePackageJson(file, pkg);
|
|
7939
|
-
|
|
7945
|
+
const relativeFile = appRoot ? getRelativePathBetween(appRoot, file) : file;
|
|
7946
|
+
log.info(`Updated: ${relativeFile}`);
|
|
7940
7947
|
}
|
|
7941
7948
|
}
|
|
7942
7949
|
if (updatedFiles.size > 0) {
|
|
7943
7950
|
log.success(`
|
|
7944
|
-
Done. Run "bun install" to apply.`);
|
|
7951
|
+
Done. Updated ${updatedFiles.size} file(s). Run "bun install" to apply.`);
|
|
7945
7952
|
}
|
|
7946
7953
|
} else {
|
|
7947
7954
|
log.info("\nUpdates not applied");
|
|
@@ -8432,52 +8432,60 @@ async function updateRootPackageJson(rootDir, appNames) {
|
|
|
8432
8432
|
// packages/tooling/src/utils/matrix.ts
|
|
8433
8433
|
init_utils();
|
|
8434
8434
|
init_pathResolver();
|
|
8435
|
+
import { createRequire as createRequire4 } from "node:module";
|
|
8435
8436
|
var cachedMatrix = null;
|
|
8436
8437
|
function getMatrixPath(mode) {
|
|
8438
|
+
try {
|
|
8439
|
+
const require3 = createRequire4(import.meta.url);
|
|
8440
|
+
const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
|
|
8441
|
+
if (pathExists(resolved)) {
|
|
8442
|
+
return resolved;
|
|
8443
|
+
}
|
|
8444
|
+
} catch {
|
|
8445
|
+
}
|
|
8437
8446
|
const executionMode = mode || detectExecutionMode();
|
|
8438
8447
|
if (executionMode === "development") {
|
|
8439
8448
|
const repoRoot = getRepoRoot();
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8449
|
+
if (repoRoot) {
|
|
8450
|
+
const devPath = normalizePath(
|
|
8451
|
+
repoRoot,
|
|
8452
|
+
"packages/cli/dependencies-matrix.json"
|
|
8453
|
+
);
|
|
8454
|
+
if (pathExists(devPath)) {
|
|
8455
|
+
return devPath;
|
|
8456
|
+
}
|
|
8446
8457
|
}
|
|
8447
|
-
return devPath;
|
|
8448
|
-
}
|
|
8449
|
-
const cliPackagePath = getCliRootFromBundle();
|
|
8450
|
-
const matrixPath = joinPath(cliPackagePath, "dependencies-matrix.json");
|
|
8451
|
-
if (!pathExists(matrixPath)) {
|
|
8452
|
-
throw new Error(`[PROD] Matrix not found at: ${matrixPath}`);
|
|
8453
8458
|
}
|
|
8454
|
-
return
|
|
8459
|
+
return null;
|
|
8455
8460
|
}
|
|
8456
8461
|
function getCliVersion(mode) {
|
|
8462
|
+
try {
|
|
8463
|
+
const require3 = createRequire4(import.meta.url);
|
|
8464
|
+
const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
|
|
8465
|
+
const pkg = readSync(packageJsonPath, { format: "json" });
|
|
8466
|
+
return String(pkg?.version || "0.0.0");
|
|
8467
|
+
} catch {
|
|
8468
|
+
}
|
|
8457
8469
|
const executionMode = mode || detectExecutionMode();
|
|
8458
8470
|
if (executionMode === "development") {
|
|
8459
8471
|
const repoRoot = getRepoRoot();
|
|
8460
8472
|
const cliPackageJson = joinPath(repoRoot, "packages/cli/package.json");
|
|
8461
|
-
if (
|
|
8462
|
-
|
|
8473
|
+
if (pathExists(cliPackageJson)) {
|
|
8474
|
+
const pkg = readSync(cliPackageJson, { format: "json" });
|
|
8475
|
+
return String(pkg?.version || "0.0.0");
|
|
8463
8476
|
}
|
|
8464
|
-
const pkg2 = readSync(cliPackageJson, { format: "json" });
|
|
8465
|
-
return String(pkg2?.version || "0.0.0");
|
|
8466
8477
|
}
|
|
8467
|
-
|
|
8468
|
-
const packageJsonPath = joinPath(cliPackagePath, "package.json");
|
|
8469
|
-
if (!pathExists(packageJsonPath)) {
|
|
8470
|
-
throw new Error(`[PROD] CLI package.json not found at: ${packageJsonPath}`);
|
|
8471
|
-
}
|
|
8472
|
-
const pkg = readSync(packageJsonPath, { format: "json" });
|
|
8473
|
-
return String(pkg?.version || "0.0.0");
|
|
8478
|
+
return "0.0.0";
|
|
8474
8479
|
}
|
|
8475
8480
|
function loadMatrix(mode) {
|
|
8476
8481
|
if (cachedMatrix) return cachedMatrix;
|
|
8477
8482
|
const matrixPath = getMatrixPath(mode);
|
|
8483
|
+
if (!matrixPath) {
|
|
8484
|
+
return null;
|
|
8485
|
+
}
|
|
8478
8486
|
const content = readSync(matrixPath, { format: "json" });
|
|
8479
8487
|
if (!content) {
|
|
8480
|
-
|
|
8488
|
+
return null;
|
|
8481
8489
|
}
|
|
8482
8490
|
cachedMatrix = {
|
|
8483
8491
|
matrix: content,
|
|
@@ -8661,7 +8669,11 @@ function generateScripts(templateName, options) {
|
|
|
8661
8669
|
return scripts;
|
|
8662
8670
|
}
|
|
8663
8671
|
function generatePackageJson(templateName, mode, options = {}) {
|
|
8664
|
-
const
|
|
8672
|
+
const matrixResult = loadMatrix(mode);
|
|
8673
|
+
if (!matrixResult) {
|
|
8674
|
+
throw new Error("dependencies-matrix.json not found. This command requires the matrix file.");
|
|
8675
|
+
}
|
|
8676
|
+
const { matrix, cliVersion } = matrixResult;
|
|
8665
8677
|
const template = matrix.templateMapping?.[templateName];
|
|
8666
8678
|
if (!template) {
|
|
8667
8679
|
throw new Error(`Template "${templateName}" not found in matrix`);
|
|
@@ -8711,8 +8723,8 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
8711
8723
|
result.peerDependencies = peerDependencies;
|
|
8712
8724
|
}
|
|
8713
8725
|
if (templateName === "consumer-root") {
|
|
8714
|
-
result.packageManager = "bun@1.3.
|
|
8715
|
-
result.engines = { node: ">=
|
|
8726
|
+
result.packageManager = "bun@1.3.5";
|
|
8727
|
+
result.engines = { node: ">=24.0.0", bun: ">=1.3.0" };
|
|
8716
8728
|
result.workspaces = ["apps/*", "entities"];
|
|
8717
8729
|
}
|
|
8718
8730
|
if (templateName === "entities") {
|
|
@@ -8573,52 +8573,60 @@ async function mergeRootTurboJson(rootDir) {
|
|
|
8573
8573
|
// packages/tooling/src/utils/matrix.ts
|
|
8574
8574
|
init_utils();
|
|
8575
8575
|
init_pathResolver();
|
|
8576
|
+
import { createRequire as createRequire4 } from "node:module";
|
|
8576
8577
|
var cachedMatrix = null;
|
|
8577
8578
|
function getMatrixPath(mode) {
|
|
8579
|
+
try {
|
|
8580
|
+
const require3 = createRequire4(import.meta.url);
|
|
8581
|
+
const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
|
|
8582
|
+
if (pathExists(resolved)) {
|
|
8583
|
+
return resolved;
|
|
8584
|
+
}
|
|
8585
|
+
} catch {
|
|
8586
|
+
}
|
|
8578
8587
|
const executionMode = mode || detectExecutionMode();
|
|
8579
8588
|
if (executionMode === "development") {
|
|
8580
8589
|
const repoRoot = getRepoRoot();
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8590
|
+
if (repoRoot) {
|
|
8591
|
+
const devPath = normalizePath(
|
|
8592
|
+
repoRoot,
|
|
8593
|
+
"packages/cli/dependencies-matrix.json"
|
|
8594
|
+
);
|
|
8595
|
+
if (pathExists(devPath)) {
|
|
8596
|
+
return devPath;
|
|
8597
|
+
}
|
|
8587
8598
|
}
|
|
8588
|
-
return devPath;
|
|
8589
|
-
}
|
|
8590
|
-
const cliPackagePath = getCliRootFromBundle();
|
|
8591
|
-
const matrixPath = joinPath(cliPackagePath, "dependencies-matrix.json");
|
|
8592
|
-
if (!pathExists(matrixPath)) {
|
|
8593
|
-
throw new Error(`[PROD] Matrix not found at: ${matrixPath}`);
|
|
8594
8599
|
}
|
|
8595
|
-
return
|
|
8600
|
+
return null;
|
|
8596
8601
|
}
|
|
8597
8602
|
function getCliVersion(mode) {
|
|
8603
|
+
try {
|
|
8604
|
+
const require3 = createRequire4(import.meta.url);
|
|
8605
|
+
const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
|
|
8606
|
+
const pkg = readSync(packageJsonPath, { format: "json" });
|
|
8607
|
+
return String(pkg?.version || "0.0.0");
|
|
8608
|
+
} catch {
|
|
8609
|
+
}
|
|
8598
8610
|
const executionMode = mode || detectExecutionMode();
|
|
8599
8611
|
if (executionMode === "development") {
|
|
8600
8612
|
const repoRoot = getRepoRoot();
|
|
8601
8613
|
const cliPackageJson = joinPath(repoRoot, "packages/cli/package.json");
|
|
8602
|
-
if (
|
|
8603
|
-
|
|
8614
|
+
if (pathExists(cliPackageJson)) {
|
|
8615
|
+
const pkg = readSync(cliPackageJson, { format: "json" });
|
|
8616
|
+
return String(pkg?.version || "0.0.0");
|
|
8604
8617
|
}
|
|
8605
|
-
const pkg2 = readSync(cliPackageJson, { format: "json" });
|
|
8606
|
-
return String(pkg2?.version || "0.0.0");
|
|
8607
8618
|
}
|
|
8608
|
-
|
|
8609
|
-
const packageJsonPath = joinPath(cliPackagePath, "package.json");
|
|
8610
|
-
if (!pathExists(packageJsonPath)) {
|
|
8611
|
-
throw new Error(`[PROD] CLI package.json not found at: ${packageJsonPath}`);
|
|
8612
|
-
}
|
|
8613
|
-
const pkg = readSync(packageJsonPath, { format: "json" });
|
|
8614
|
-
return String(pkg?.version || "0.0.0");
|
|
8619
|
+
return "0.0.0";
|
|
8615
8620
|
}
|
|
8616
8621
|
function loadMatrix(mode) {
|
|
8617
8622
|
if (cachedMatrix) return cachedMatrix;
|
|
8618
8623
|
const matrixPath = getMatrixPath(mode);
|
|
8624
|
+
if (!matrixPath) {
|
|
8625
|
+
return null;
|
|
8626
|
+
}
|
|
8619
8627
|
const content = readSync(matrixPath, { format: "json" });
|
|
8620
8628
|
if (!content) {
|
|
8621
|
-
|
|
8629
|
+
return null;
|
|
8622
8630
|
}
|
|
8623
8631
|
cachedMatrix = {
|
|
8624
8632
|
matrix: content,
|
|
@@ -8802,7 +8810,11 @@ function generateScripts(templateName, options) {
|
|
|
8802
8810
|
return scripts;
|
|
8803
8811
|
}
|
|
8804
8812
|
function generatePackageJson(templateName, mode, options = {}) {
|
|
8805
|
-
const
|
|
8813
|
+
const matrixResult = loadMatrix(mode);
|
|
8814
|
+
if (!matrixResult) {
|
|
8815
|
+
throw new Error("dependencies-matrix.json not found. This command requires the matrix file.");
|
|
8816
|
+
}
|
|
8817
|
+
const { matrix, cliVersion } = matrixResult;
|
|
8806
8818
|
const template = matrix.templateMapping?.[templateName];
|
|
8807
8819
|
if (!template) {
|
|
8808
8820
|
throw new Error(`Template "${templateName}" not found in matrix`);
|
|
@@ -8852,8 +8864,8 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
8852
8864
|
result.peerDependencies = peerDependencies;
|
|
8853
8865
|
}
|
|
8854
8866
|
if (templateName === "consumer-root") {
|
|
8855
|
-
result.packageManager = "bun@1.3.
|
|
8856
|
-
result.engines = { node: ">=
|
|
8867
|
+
result.packageManager = "bun@1.3.5";
|
|
8868
|
+
result.engines = { node: ">=24.0.0", bun: ">=1.3.0" };
|
|
8857
8869
|
result.workspaces = ["apps/*", "entities"];
|
|
8858
8870
|
}
|
|
8859
8871
|
if (templateName === "entities") {
|
package/dist/index.js
CHANGED
|
@@ -9797,52 +9797,60 @@ async function mergeRootTurboJson(rootDir) {
|
|
|
9797
9797
|
// packages/tooling/src/utils/matrix.ts
|
|
9798
9798
|
init_utils();
|
|
9799
9799
|
init_pathResolver();
|
|
9800
|
+
import { createRequire as createRequire4 } from "node:module";
|
|
9800
9801
|
var cachedMatrix = null;
|
|
9801
9802
|
function getMatrixPath(mode) {
|
|
9803
|
+
try {
|
|
9804
|
+
const require3 = createRequire4(import.meta.url);
|
|
9805
|
+
const resolved = require3.resolve("@donotdev/cli/dependencies-matrix.json");
|
|
9806
|
+
if (pathExists(resolved)) {
|
|
9807
|
+
return resolved;
|
|
9808
|
+
}
|
|
9809
|
+
} catch {
|
|
9810
|
+
}
|
|
9802
9811
|
const executionMode = mode || detectExecutionMode();
|
|
9803
9812
|
if (executionMode === "development") {
|
|
9804
9813
|
const repoRoot = getRepoRoot();
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9814
|
+
if (repoRoot) {
|
|
9815
|
+
const devPath = normalizePath(
|
|
9816
|
+
repoRoot,
|
|
9817
|
+
"packages/cli/dependencies-matrix.json"
|
|
9818
|
+
);
|
|
9819
|
+
if (pathExists(devPath)) {
|
|
9820
|
+
return devPath;
|
|
9821
|
+
}
|
|
9811
9822
|
}
|
|
9812
|
-
return devPath;
|
|
9813
9823
|
}
|
|
9814
|
-
|
|
9815
|
-
const matrixPath = joinPath(cliPackagePath, "dependencies-matrix.json");
|
|
9816
|
-
if (!pathExists(matrixPath)) {
|
|
9817
|
-
throw new Error(`[PROD] Matrix not found at: ${matrixPath}`);
|
|
9818
|
-
}
|
|
9819
|
-
return matrixPath;
|
|
9824
|
+
return null;
|
|
9820
9825
|
}
|
|
9821
9826
|
function getCliVersion(mode) {
|
|
9827
|
+
try {
|
|
9828
|
+
const require3 = createRequire4(import.meta.url);
|
|
9829
|
+
const packageJsonPath = require3.resolve("@donotdev/cli/package.json");
|
|
9830
|
+
const pkg = readSync(packageJsonPath, { format: "json" });
|
|
9831
|
+
return String(pkg?.version || "0.0.0");
|
|
9832
|
+
} catch {
|
|
9833
|
+
}
|
|
9822
9834
|
const executionMode = mode || detectExecutionMode();
|
|
9823
9835
|
if (executionMode === "development") {
|
|
9824
9836
|
const repoRoot = getRepoRoot();
|
|
9825
9837
|
const cliPackageJson = joinPath(repoRoot, "packages/cli/package.json");
|
|
9826
|
-
if (
|
|
9827
|
-
|
|
9838
|
+
if (pathExists(cliPackageJson)) {
|
|
9839
|
+
const pkg = readSync(cliPackageJson, { format: "json" });
|
|
9840
|
+
return String(pkg?.version || "0.0.0");
|
|
9828
9841
|
}
|
|
9829
|
-
const pkg2 = readSync(cliPackageJson, { format: "json" });
|
|
9830
|
-
return String(pkg2?.version || "0.0.0");
|
|
9831
|
-
}
|
|
9832
|
-
const cliPackagePath = getCliRootFromBundle();
|
|
9833
|
-
const packageJsonPath = joinPath(cliPackagePath, "package.json");
|
|
9834
|
-
if (!pathExists(packageJsonPath)) {
|
|
9835
|
-
throw new Error(`[PROD] CLI package.json not found at: ${packageJsonPath}`);
|
|
9836
9842
|
}
|
|
9837
|
-
|
|
9838
|
-
return String(pkg?.version || "0.0.0");
|
|
9843
|
+
return "0.0.0";
|
|
9839
9844
|
}
|
|
9840
9845
|
function loadMatrix(mode) {
|
|
9841
9846
|
if (cachedMatrix) return cachedMatrix;
|
|
9842
9847
|
const matrixPath = getMatrixPath(mode);
|
|
9848
|
+
if (!matrixPath) {
|
|
9849
|
+
return null;
|
|
9850
|
+
}
|
|
9843
9851
|
const content = readSync(matrixPath, { format: "json" });
|
|
9844
9852
|
if (!content) {
|
|
9845
|
-
|
|
9853
|
+
return null;
|
|
9846
9854
|
}
|
|
9847
9855
|
cachedMatrix = {
|
|
9848
9856
|
matrix: content,
|
|
@@ -11151,7 +11159,11 @@ function generateScripts(templateName, options) {
|
|
|
11151
11159
|
return scripts;
|
|
11152
11160
|
}
|
|
11153
11161
|
function generatePackageJson(templateName, mode, options = {}) {
|
|
11154
|
-
const
|
|
11162
|
+
const matrixResult = loadMatrix(mode);
|
|
11163
|
+
if (!matrixResult) {
|
|
11164
|
+
throw new Error("dependencies-matrix.json not found. This command requires the matrix file.");
|
|
11165
|
+
}
|
|
11166
|
+
const { matrix, cliVersion } = matrixResult;
|
|
11155
11167
|
const template = matrix.templateMapping?.[templateName];
|
|
11156
11168
|
if (!template) {
|
|
11157
11169
|
throw new Error(`Template "${templateName}" not found in matrix`);
|
|
@@ -11201,8 +11213,8 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
11201
11213
|
result.peerDependencies = peerDependencies;
|
|
11202
11214
|
}
|
|
11203
11215
|
if (templateName === "consumer-root") {
|
|
11204
|
-
result.packageManager = "bun@1.3.
|
|
11205
|
-
result.engines = { node: ">=
|
|
11216
|
+
result.packageManager = "bun@1.3.5";
|
|
11217
|
+
result.engines = { node: ">=24.0.0", bun: ">=1.3.0" };
|
|
11206
11218
|
result.workspaces = ["apps/*", "entities"];
|
|
11207
11219
|
}
|
|
11208
11220
|
if (templateName === "entities") {
|