@lssm/app.cli-databases 1.41.1 → 1.42.1
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +2 -1
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/profile.d.mts +15 -0
- package/dist/profile.d.mts.map +1 -0
- package/dist/profile.mjs +2 -1
- package/dist/profile.mjs.map +1 -0
- package/package.json +16 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chaman Ventures, SASU
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
CHANGED
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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(\n 'database',\n ['import', '--modules', db.modules.join(','), '--target', db.cwd],\n { stdio: 'inherit' }\n );\n }\n break;\n case 'check':\n for (const db of profile.databases) {\n await execa('database', ['check', '--target', db.cwd], {\n stdio: 'inherit',\n });\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(\n 'Usage: databases <import|check|generate|migrate:dev|migrate:deploy|migrate:status|seed> --profile <name>'\n );\n process.exit(1);\n }\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n"],"mappings":";;;;;;AAKA,eAAe,OAAO;CACpB,MAAM,OAAO,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;CACvC,MAAM,CAAC,OAAO,KAAK;CAEnB,MAAM,UAAU,MAAM,YADD,KAAK,WAAsB,UACF;CAE9C,eAAe,aAAa,MAAgB;AAC1C,OAAK,MAAM,MAAM,QAAQ,UACvB,OAAM,MAAM,UAAU,MAAM;GAAE,OAAO;GAAW,KAAK,GAAG;GAAK,CAAC;;AAIlE,SAAQ,KAAR;EACE,KAAK;AACH,QAAK,MAAM,MAAM,QAAQ,UACvB,OAAM,MACJ,YACA;IAAC;IAAU;IAAa,GAAG,QAAQ,KAAK,IAAI;IAAE;IAAY,GAAG;IAAI,EACjE,EAAE,OAAO,WAAW,CACrB;AAEH;EACF,KAAK;AACH,QAAK,MAAM,MAAM,QAAQ,UACvB,OAAM,MAAM,YAAY;IAAC;IAAS;IAAY,GAAG;IAAI,EAAE,EACrD,OAAO,WACR,CAAC;AAEJ;EACF,KAAK;AACH,SAAM,aAAa,CAAC,WAAW,CAAC;AAChC;EACF,KAAK;AACH,SAAM,aAAa,CAAC,WAAW,MAAM,CAAC;AACtC;EACF,KAAK;AACH,SAAM,aAAa,CAAC,WAAW,SAAS,CAAC;AACzC;EACF,KAAK;AACH,SAAM,aAAa,CAAC,WAAW,SAAS,CAAC;AACzC;EACF,KAAK;AACH,SAAM,aAAa,CAAC,MAAM,OAAO,CAAC;AAClC;EACF;AACE,WAAQ,MACN,2GACD;AACD,WAAQ,KAAK,EAAE;;;AAIrB,MAAM,CAAC,OAAO,QAAQ;AACpB,SAAQ,MAAM,IAAI;AAClB,SAAQ,KAAK,EAAE;EACf"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
CHANGED
|
@@ -0,0 +1 @@
|
|
|
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":";;;;AAeA,eAAsB,YAAY,MAAyC;CAEzE,MAAM,OAAO,QAAQ,KAAK;CAC1B,MAAM,OAAO,KAAK,KAAK,MAAM,qBAAqB,KAAK,OAAO;AAC9D,KAAI,CAAC,GAAG,WAAW,KAAK,CACtB,OAAM,IAAI,MAAM,sBAAsB,OAAO;AAG/C,QADa,KAAK,MAAM,GAAG,aAAa,MAAM,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/app.cli-databases",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"databases": "dist/cli.js"
|
|
@@ -10,15 +10,17 @@
|
|
|
10
10
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
11
11
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
12
12
|
"build": "tsdown",
|
|
13
|
-
"dev": "bun run build --watch"
|
|
13
|
+
"dev": "bun run build --watch",
|
|
14
|
+
"lint": "eslint src --fix"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"minimist": "^1.2.8",
|
|
17
18
|
"execa": "^9.6.1"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@lssm/tool.
|
|
21
|
-
"tsdown": "
|
|
21
|
+
"@lssm/tool.typescript": "1.42.1",
|
|
22
|
+
"@lssm/tool.tsdown": "1.42.1",
|
|
23
|
+
"tsdown": "^0.18.3"
|
|
22
24
|
},
|
|
23
25
|
"main": "./dist/index.mjs",
|
|
24
26
|
"module": "./dist/index.mjs",
|
|
@@ -28,8 +30,8 @@
|
|
|
28
30
|
"README.md"
|
|
29
31
|
],
|
|
30
32
|
"exports": {
|
|
31
|
-
".": "./
|
|
32
|
-
"./cli": "./
|
|
33
|
+
".": "./dist/index.mjs",
|
|
34
|
+
"./cli": "./dist/cli.mjs",
|
|
33
35
|
"./*": "./*"
|
|
34
36
|
},
|
|
35
37
|
"publishConfig": {
|
|
@@ -38,6 +40,13 @@
|
|
|
38
40
|
".": "./dist/index.mjs",
|
|
39
41
|
"./cli": "./dist/cli.mjs",
|
|
40
42
|
"./*": "./*"
|
|
41
|
-
}
|
|
43
|
+
},
|
|
44
|
+
"registry": "https://registry.npmjs.org/"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
50
|
+
"directory": "packages/apps/cli-databases"
|
|
42
51
|
}
|
|
43
52
|
}
|