@yongdall/migrate 0.1.0 → 0.2.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/bin.mjs +2 -1
- package/bin.mjs.map +1 -1
- package/cli/migrate.mjs +24 -0
- package/cli/migrate.mjs.map +1 -0
- package/cli/yongdall.yml +4 -0
- package/package.json +9 -6
package/bin.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { stop } from "@yongdall/connection";
|
|
2
|
-
import "@yongdall/init";
|
|
2
|
+
import init from "@yongdall/init";
|
|
3
3
|
import migrate from "#index";
|
|
4
4
|
|
|
5
5
|
//#region cli/migrate/bin.mjs
|
|
6
6
|
let args = process.argv.slice(2);
|
|
7
7
|
let index = args.indexOf("--");
|
|
8
8
|
if (index >= 0) args = args.slice(0, index);
|
|
9
|
+
await init({ development: args.includes("--development") });
|
|
9
10
|
const domain = args.find((v) => v.startsWith("--domain="))?.slice(9) || "";
|
|
10
11
|
const plugins = [...args.filter((v) => v.startsWith("--plugin=")).map((v) => v.slice(9)), ...args.filter((v) => v.startsWith("--plugins=")).map((v) => v.slice(10))].flatMap((v) => v.split(",")).filter(Boolean);
|
|
11
12
|
const database = args.find((v) => v.startsWith("--database="))?.slice(11);
|
package/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.mjs","names":[],"sources":["../../cli/migrate/bin.mjs"],"sourcesContent":["import { stop } from '@yongdall/connection';\nimport '@yongdall/init';\nimport migrate from '#index';\n\n\n\nlet args = process.argv.slice(2);\nlet index = args.indexOf('--');\nif (index >= 0) {\n\targs = args.slice(0, index);\n}\n\nconst domain = args.find(v => v.startsWith('--domain='))?.slice('--domain='.length) || ''
|
|
1
|
+
{"version":3,"file":"bin.mjs","names":[],"sources":["../../cli/migrate/bin.mjs"],"sourcesContent":["import { stop } from '@yongdall/connection';\nimport init from '@yongdall/init';\nimport migrate from '#index';\n\n\n\nlet args = process.argv.slice(2);\nlet index = args.indexOf('--');\nif (index >= 0) {\n\targs = args.slice(0, index);\n}\nconst development = args.includes('--development');\nawait init({ development });\n\nconst domain = args.find(v => v.startsWith('--domain='))?.slice('--domain='.length) || '';\n\nconst plugins = [\n\t...args.filter(v => v.startsWith('--plugin=')).map(v => v.slice('--plugin='.length)),\n\t...args.filter(v => v.startsWith('--plugins=')).map(v => v.slice('--plugins='.length)),\n].flatMap(v => v.split(',')).filter(Boolean);\nconst database = args.find(v => v.startsWith('--database='))?.slice('--database='.length);\nmigrate({ domain, plugins, database }).then(stop);\n"],"mappings":";;;;;AAMA,IAAI,OAAO,QAAQ,KAAK,MAAM,EAAE;AAChC,IAAI,QAAQ,KAAK,QAAQ,KAAK;AAC9B,IAAI,SAAS,EACZ,QAAO,KAAK,MAAM,GAAG,MAAM;AAG5B,MAAM,KAAK,EAAE,aADO,KAAK,SAAS,gBAAgB,EACxB,CAAC;AAE3B,MAAM,SAAS,KAAK,MAAK,MAAK,EAAE,WAAW,YAAY,CAAC,EAAE,MAAM,EAAmB,IAAI;AAEvF,MAAM,UAAU,CACf,GAAG,KAAK,QAAO,MAAK,EAAE,WAAW,YAAY,CAAC,CAAC,KAAI,MAAK,EAAE,MAAM,EAAmB,CAAC,EACpF,GAAG,KAAK,QAAO,MAAK,EAAE,WAAW,aAAa,CAAC,CAAC,KAAI,MAAK,EAAE,MAAM,GAAoB,CAAC,CACtF,CAAC,SAAQ,MAAK,EAAE,MAAM,IAAI,CAAC,CAAC,OAAO,QAAQ;AAC5C,MAAM,WAAW,KAAK,MAAK,MAAK,EAAE,WAAW,cAAc,CAAC,EAAE,MAAM,GAAqB;AACzF,QAAQ;CAAE;CAAQ;CAAS;CAAU,CAAC,CAAC,KAAK,KAAK"}
|
package/cli/migrate.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { stop } from "@yongdall/connection";
|
|
2
|
+
import init from "@yongdall/init";
|
|
3
|
+
import migrate from "#index";
|
|
4
|
+
|
|
5
|
+
//#region cli/migrate/cli/migrate.mjs
|
|
6
|
+
/** @import { Cli } from '@yongdall/cli-parse' */
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {Cli.Env} env
|
|
10
|
+
*/
|
|
11
|
+
async function migrate_default({ options, development, plugins }) {
|
|
12
|
+
await init({ development });
|
|
13
|
+
const domain = options.domain?.find(Boolean) || "";
|
|
14
|
+
const database = options.domain?.find(Boolean) || void 0;
|
|
15
|
+
migrate({
|
|
16
|
+
domain,
|
|
17
|
+
plugins: [...plugins],
|
|
18
|
+
database
|
|
19
|
+
}).then(stop);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { migrate_default as default };
|
|
24
|
+
//# sourceMappingURL=migrate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.mjs","names":[],"sources":["../../../cli/migrate/cli/migrate.mjs"],"sourcesContent":["import { stop } from '@yongdall/connection';\nimport init from '@yongdall/init';\nimport migrate from '#index';\n/** @import { Cli } from '@yongdall/cli-parse' */\n\n\n\n/**\n * \n * @param {Cli.Env} env \n */\nexport default async function ({ options, development, plugins }) {\n\tawait init({ development });\n\tconst domain = options.domain?.find(Boolean) || '';\n\tconst database = options.domain?.find(Boolean) || undefined;\n\tmigrate({ domain, plugins: [...plugins], database }).then(stop);\n}\n"],"mappings":";;;;;;;;;;AAWA,+BAA+B,EAAE,SAAS,aAAa,WAAW;AACjE,OAAM,KAAK,EAAE,aAAa,CAAC;CAC3B,MAAM,SAAS,QAAQ,QAAQ,KAAK,QAAQ,IAAI;CAChD,MAAM,WAAW,QAAQ,QAAQ,KAAK,QAAQ,IAAI;AAClD,SAAQ;EAAE;EAAQ,SAAS,CAAC,GAAG,QAAQ;EAAE;EAAU,CAAC,CAAC,KAAK,KAAK"}
|
package/cli/yongdall.yml
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yongdall/migrate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"migrate.yongdall": "./bin.mjs"
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
"#index": "./index.mjs"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@yongdall/plugins": "^0.
|
|
14
|
-
"@yongdall/context": "^0.
|
|
15
|
-
"@yongdall/core": "^0.
|
|
16
|
-
"@yongdall/init": "^0.
|
|
17
|
-
"@yongdall/connection": "^0.
|
|
13
|
+
"@yongdall/plugins": "^0.2.0",
|
|
14
|
+
"@yongdall/context": "^0.2.0",
|
|
15
|
+
"@yongdall/core": "^0.2.0",
|
|
16
|
+
"@yongdall/init": "^0.2.0",
|
|
17
|
+
"@yongdall/connection": "^0.2.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@yongdall/cli-parse": "^0.2.0"
|
|
18
21
|
},
|
|
19
22
|
"exports": {
|
|
20
23
|
".": "./index.mjs"
|