@lssm/app.cli-databases 1.11.0 → 1.41.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/app.cli-databases",
3
- "version": "1.11.0",
3
+ "version": "1.41.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "databases": "dist/cli.js"
@@ -13,11 +13,11 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "minimist": "^1.2.8",
16
- "execa": "^9.5.1"
16
+ "execa": "^9.6.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@lssm/tool.tsdown": "0.12.0",
20
- "tsdown": "^0.16.6"
19
+ "@lssm/tool.tsdown": "workspace:*",
20
+ "tsdown": "^0.17.4"
21
21
  },
22
22
  "main": "./dist/index.mjs",
23
23
  "module": "./dist/index.mjs",
@@ -27,11 +27,16 @@
27
27
  "README.md"
28
28
  ],
29
29
  "exports": {
30
- ".": "./dist/index.mjs",
31
- "./cli": "./dist/cli.mjs",
30
+ ".": "./src/index.ts",
31
+ "./cli": "./src/cli.ts",
32
32
  "./*": "./*"
33
33
  },
34
34
  "publishConfig": {
35
- "access": "public"
35
+ "access": "public",
36
+ "exports": {
37
+ ".": "./dist/index.mjs",
38
+ "./cli": "./dist/cli.mjs",
39
+ "./*": "./*"
40
+ }
36
41
  }
37
42
  }
package/dist/cli.d.mts DELETED
@@ -1 +0,0 @@
1
- export { };
package/dist/cli.mjs DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{loadProfile as e}from"./profile.mjs";import t from"minimist";import{execa as n}from"execa";async function r(){let r=t(process.argv.slice(2)),[i]=r._,a=await e(r.profile||`default`);async function o(e){for(let t of a.databases)await n(`prisma`,e,{stdio:`inherit`,cwd:t.cwd})}switch(i){case`import`:for(let e of a.databases)await n(`database`,[`import`,`--modules`,e.modules.join(`,`),`--target`,e.cwd],{stdio:`inherit`});break;case`check`:for(let e of a.databases)await n(`database`,[`check`,`--target`,e.cwd],{stdio:`inherit`});break;case`generate`:await o([`generate`]);break;case`migrate:dev`:await o([`migrate`,`dev`]);break;case`migrate:deploy`:await o([`migrate`,`deploy`]);break;case`migrate:status`:await o([`migrate`,`status`]);break;case`seed`:await o([`db`,`seed`]);break;default:console.error(`Usage: databases <import|check|generate|migrate:dev|migrate:deploy|migrate:status|seed> --profile <name>`),process.exit(1)}}r().catch(e=>{console.error(e),process.exit(1)});export{};
3
- //# sourceMappingURL=cli.mjs.map
package/dist/cli.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport mri from 'minimist';\nimport { execa } from 'execa';\nimport { loadProfile } from './profile.js';\n\nasync function main() {\n const argv = mri(process.argv.slice(2));\n const [cmd] = argv._ as string[];\n const profileName = (argv.profile as string) || 'default';\n const profile = await loadProfile(profileName);\n\n async function runForEachDb(args: string[]) {\n for (const db of profile.databases) {\n await execa('prisma', args, { stdio: 'inherit', cwd: db.cwd });\n }\n }\n\n switch (cmd) {\n case 'import':\n for (const db of profile.databases) {\n await execa('database', ['import', '--modules', db.modules.join(','), '--target', db.cwd], { stdio: 'inherit' });\n }\n break;\n case 'check':\n for (const db of profile.databases) {\n await execa('database', ['check', '--target', db.cwd], { stdio: 'inherit' });\n }\n break;\n case 'generate':\n await runForEachDb(['generate']);\n break;\n case 'migrate:dev':\n await runForEachDb(['migrate', 'dev']);\n break;\n case 'migrate:deploy':\n await runForEachDb(['migrate', 'deploy']);\n break;\n case 'migrate:status':\n await runForEachDb(['migrate', 'status']);\n break;\n case 'seed':\n await runForEachDb(['db', 'seed']);\n break;\n default:\n console.error('Usage: databases <import|check|generate|migrate:dev|migrate:deploy|migrate:status|seed> --profile <name>');\n process.exit(1);\n }\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n\n\n"],"mappings":";kGAKA,eAAe,GAAO,CACpB,IAAM,EAAO,EAAI,QAAQ,KAAK,MAAM,EAAE,CAAC,CACjC,CAAC,GAAO,EAAK,EAEb,EAAU,MAAM,EADD,EAAK,SAAsB,UACF,CAE9C,eAAe,EAAa,EAAgB,CAC1C,IAAK,IAAM,KAAM,EAAQ,UACvB,MAAM,EAAM,SAAU,EAAM,CAAE,MAAO,UAAW,IAAK,EAAG,IAAK,CAAC,CAIlE,OAAQ,EAAR,CACE,IAAK,SACH,IAAK,IAAM,KAAM,EAAQ,UACvB,MAAM,EAAM,WAAY,CAAC,SAAU,YAAa,EAAG,QAAQ,KAAK,IAAI,CAAE,WAAY,EAAG,IAAI,CAAE,CAAE,MAAO,UAAW,CAAC,CAElH,MACF,IAAK,QACH,IAAK,IAAM,KAAM,EAAQ,UACvB,MAAM,EAAM,WAAY,CAAC,QAAS,WAAY,EAAG,IAAI,CAAE,CAAE,MAAO,UAAW,CAAC,CAE9E,MACF,IAAK,WACH,MAAM,EAAa,CAAC,WAAW,CAAC,CAChC,MACF,IAAK,cACH,MAAM,EAAa,CAAC,UAAW,MAAM,CAAC,CACtC,MACF,IAAK,iBACH,MAAM,EAAa,CAAC,UAAW,SAAS,CAAC,CACzC,MACF,IAAK,iBACH,MAAM,EAAa,CAAC,UAAW,SAAS,CAAC,CACzC,MACF,IAAK,OACH,MAAM,EAAa,CAAC,KAAM,OAAO,CAAC,CAClC,MACF,QACE,QAAQ,MAAM,2GAA2G,CACzH,QAAQ,KAAK,EAAE,EAIrB,GAAM,CAAC,MAAO,GAAQ,CACpB,QAAQ,MAAM,EAAI,CAClB,QAAQ,KAAK,EAAE,EACf"}
package/dist/index.d.mts DELETED
@@ -1,2 +0,0 @@
1
- import { DatabasesProfile, DbConfig, loadProfile } from "./profile.mjs";
2
- export { DatabasesProfile, DbConfig, loadProfile };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{loadProfile as e}from"./profile.mjs";export{e as loadProfile};
@@ -1,15 +0,0 @@
1
- //#region src/profile.d.ts
2
- interface DbConfig {
3
- dbId: string;
4
- cwd: string;
5
- modules: string[];
6
- configFile?: string;
7
- }
8
- interface DatabasesProfile {
9
- name: string;
10
- databases: DbConfig[];
11
- }
12
- declare function loadProfile(name: string): Promise<DatabasesProfile>;
13
- //#endregion
14
- export { DatabasesProfile, DbConfig, loadProfile };
15
- //# sourceMappingURL=profile.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.d.mts","names":[],"sources":["../src/profile.ts"],"sourcesContent":[],"mappings":";UAGiB,QAAA;EAAA,IAAA,EAAA,MAAQ;EAOR,GAAA,EAAA,MAAA;EAKK,OAAA,EAAA,MAAW,EAAA;;;UALhB,gBAAA;;aAEJ;;iBAGS,WAAA,gBAA2B,QAAQ"}
package/dist/profile.mjs DELETED
@@ -1,2 +0,0 @@
1
- import e from"node:fs";import t from"node:path";async function n(n){let r=process.cwd(),i=t.join(r,`databases.profile.${n}.json`);if(!e.existsSync(i))throw Error(`Profile not found: ${i}`);return JSON.parse(e.readFileSync(i,`utf8`))}export{n as loadProfile};
2
- //# sourceMappingURL=profile.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.mjs","names":[],"sources":["../src/profile.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nexport interface DbConfig {\n dbId: string;\n cwd: string; // path to the DB package root where prisma/ lives\n modules: string[]; // @lssm/app.cli-database-* modules to import\n configFile?: string; // override prisma config location (defaults to prisma.config.ts)\n}\n\nexport interface DatabasesProfile {\n name: string;\n databases: DbConfig[];\n}\n\nexport async function loadProfile(name: string): Promise<DatabasesProfile> {\n // Convention: look for databases.profile.<name>.json at repo root\n const root = process.cwd();\n const file = path.join(root, `databases.profile.${name}.json`);\n if (!fs.existsSync(file)) {\n throw new Error(`Profile not found: ${file}`);\n }\n const json = JSON.parse(fs.readFileSync(file, 'utf8')) as DatabasesProfile;\n return json;\n}\n"],"mappings":"gDAeA,eAAsB,EAAY,EAAyC,CAEzE,IAAM,EAAO,QAAQ,KAAK,CACpB,EAAO,EAAK,KAAK,EAAM,qBAAqB,EAAK,OAAO,CAC9D,GAAI,CAAC,EAAG,WAAW,EAAK,CACtB,MAAU,MAAM,sBAAsB,IAAO,CAG/C,OADa,KAAK,MAAM,EAAG,aAAa,EAAM,OAAO,CAAC"}