@cedarjs/cli-data-migrate 0.5.0 → 0.5.1-next.38
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/dist/bin.js +2 -2
- package/dist/lib/colors.d.ts +12 -13
- package/dist/lib/colors.d.ts.map +1 -1
- package/dist/lib/colors.js +13 -13
- package/package.json +6 -6
package/dist/bin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var L=Object.create;var M=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var w=(t,r)=>()=>(t&&(r=t(t=0)),r);var W=(t,r,e
|
|
2
|
+
"use strict";var L=Object.create;var M=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var w=(t,r)=>()=>(t&&(r=t(t=0)),r);var W=(t,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of R(r))!U.call(t,o)&&o!==i&&M(t,o,{get:()=>r[o],enumerable:!(e=N(r,o))||e.enumerable});return t};var l=(t,r,i)=>(i=t!=null?L(V(t)):{},W(r||!t||!t.__esModule?M(i,"default",{value:t,enumerable:!0}):i,t));var a,c,C=w(()=>{"use strict";a=l(require("ansis")),c={error:a.default.bold.red,warning:a.default.hex("#ffa500"),highlight:a.default.hex("#ffa500"),success:a.default.green,info:a.default.gray,bold:a.default.bold,underline:a.default.underline,note:a.default.blue,tip:a.default.green,important:a.default.magenta,caution:a.default.red,link:a.default.hex("#e8e8e8")}});async function O({importDbClientFromDist:t,distPath:r}){let i,e=!1;if(t){if(!g.default.existsSync(r)){console.warn(`Can't find api dist at ${r}. You may need to build first: yarn rw build api`),process.exitCode=1;return}let p=m.default.join(r,"lib"),d=m.default.join(p,"db.js");if(!g.default.existsSync(d)){console.error(`Can't find db.js at ${d}. CedarJS expects the db.js file to be in the ${p} directory`),process.exitCode=1;return}i=(await import(d)).db}else(0,h.registerApiSideBabelHook)(),e=!0,i=require(m.default.join((0,b.getPaths)().api.lib,"db")).db;let o=await B(i);if(!o.length){console.info(c.success(`
|
|
3
3
|
${H}
|
|
4
|
-
`)),process.exitCode=0;return}let s={run:0,skipped:0,error:0},n=o.map(p=>{let d=m.default.basename(p.path,".js");return{title:d,skip(){return s.error>0?(s.skipped++,!0):!1},async task(){
|
|
4
|
+
`)),process.exitCode=0;return}let s={run:0,skipped:0,error:0},n=o.map(p=>{let d=m.default.basename(p.path,".js");return{title:d,skip(){return s.error>0?(s.skipped++,!0):!1},async task(){e||(0,h.registerApiSideBabelHook)();try{let{startedAt:u,finishedAt:I}=await G(i,p.path);s.run++,await T(i,{version:p.version,name:d,startedAt:u,finishedAt:I})}catch(u){s.error++,console.error(c.error(`Error in data migration: ${u.message}`))}}}}),f=new j.Listr(n,{renderer:"verbose"});try{await f.run(),await i.$disconnect(),console.log(),E(s),console.log(),s.error&&(process.exitCode=1)}catch{process.exitCode=1,await i.$disconnect(),console.log(),E(s),console.log()}}async function B(t){let r=(0,b.getPaths)().api.dataMigrations;if(!g.default.existsSync(r))return[];let i=g.default.readdirSync(r).filter(n=>["js",".ts"].some(f=>n.endsWith(f))).map(n=>{let[f]=n.split("-");return{version:f,path:m.default.join(r,n)}}),o=(await t.rW_DataMigration.findMany({orderBy:{version:"asc"}})).map(n=>n.version.toString());return i.filter(({version:n})=>!o.includes(n)).sort(q)}function q(t,r){let i=parseInt(t.version),e=parseInt(r.version);return i>e?1:i<e?-1:0}async function G(t,r){let i=require(r),e=new Date;return await i.default({db:t}),{startedAt:e,finishedAt:new Date}}async function T(t,{version:r,name:i,startedAt:e,finishedAt:o}){await t.rW_DataMigration.create({data:{version:r,name:i,startedAt:e,finishedAt:o}})}function E(t){t.run&&console.info(c.success(`${t.run} data migration(s) completed successfully.`)),t.error&&console.error(c.error(`${t.error} data migration(s) exited with errors.`)),t.skipped&&console.warn(c.warning(`${t.skipped} data migration(s) skipped due to previous error.`))}var g,m,j,h,b,H,P=w(()=>{"use strict";g=l(require("fs")),m=l(require("path")),j=require("listr2"),h=require("@cedarjs/babel-config"),b=require("@cedarjs/project-config");C();H="No pending data migrations run, already up-to-date."});var y=l(require("path")),S=require("dotenv-defaults"),$=require("yargs/helpers"),_=l(require("yargs/yargs")),D=require("@cedarjs/project-config");var v=require("termi-link"),x=require("@cedarjs/project-config");var k="Run any outstanding Data Migrations against the database";function A(t){return t.option("import-db-client-from-dist",{type:"boolean",alias:["db-from-dist"],description:"Import the db client from dist",default:!1}).option("dist-path",{type:"string",alias:"d",description:"Path to the api dist directory",default:(0,x.getPaths)().api.dist}).epilogue(`Also see the ${(0,v.terminalLink)("Redwood CLI Reference","https://redwoodjs.com/docs/cli-commands#datamigrate-up")}`)}P();process.env.REDWOOD_ENV_FILES_LOADED||((0,S.config)({path:y.default.join((0,D.getPaths)().base,".env"),defaults:y.default.join((0,D.getPaths)().base,".env.defaults"),multiline:!0}),process.env.REDWOOD_ENV_FILES_LOADED="true");(0,_.default)((0,$.hideBin)(process.argv)).scriptName("data-migrate").command("$0",k,A,O).parse();
|
package/dist/lib/colors.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
declare const _default: {
|
|
3
|
-
error:
|
|
4
|
-
warning:
|
|
5
|
-
highlight:
|
|
6
|
-
success:
|
|
7
|
-
info:
|
|
8
|
-
bold:
|
|
9
|
-
underline:
|
|
10
|
-
note:
|
|
11
|
-
tip:
|
|
12
|
-
important:
|
|
13
|
-
caution:
|
|
14
|
-
link:
|
|
2
|
+
error: import("ansis").Ansis;
|
|
3
|
+
warning: import("ansis").Ansis;
|
|
4
|
+
highlight: import("ansis").Ansis;
|
|
5
|
+
success: import("ansis").Ansis;
|
|
6
|
+
info: import("ansis").Ansis;
|
|
7
|
+
bold: import("ansis").Ansis;
|
|
8
|
+
underline: import("ansis").Ansis;
|
|
9
|
+
note: import("ansis").Ansis;
|
|
10
|
+
tip: import("ansis").Ansis;
|
|
11
|
+
important: import("ansis").Ansis;
|
|
12
|
+
caution: import("ansis").Ansis;
|
|
13
|
+
link: import("ansis").Ansis;
|
|
15
14
|
};
|
|
16
15
|
export default _default;
|
|
17
16
|
//# sourceMappingURL=colors.d.ts.map
|
package/dist/lib/colors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/lib/colors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/lib/colors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,wBAaC"}
|
package/dist/lib/colors.js
CHANGED
|
@@ -31,18 +31,18 @@ __export(colors_exports, {
|
|
|
31
31
|
default: () => colors_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(colors_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_ansis = __toESM(require("ansis"));
|
|
35
35
|
var colors_default = {
|
|
36
|
-
error:
|
|
37
|
-
warning:
|
|
38
|
-
highlight:
|
|
39
|
-
success:
|
|
40
|
-
info:
|
|
41
|
-
bold:
|
|
42
|
-
underline:
|
|
43
|
-
note:
|
|
44
|
-
tip:
|
|
45
|
-
important:
|
|
46
|
-
caution:
|
|
47
|
-
link:
|
|
36
|
+
error: import_ansis.default.bold.red,
|
|
37
|
+
warning: import_ansis.default.hex("#ffa500"),
|
|
38
|
+
highlight: import_ansis.default.hex("#ffa500"),
|
|
39
|
+
success: import_ansis.default.green,
|
|
40
|
+
info: import_ansis.default.gray,
|
|
41
|
+
bold: import_ansis.default.bold,
|
|
42
|
+
underline: import_ansis.default.underline,
|
|
43
|
+
note: import_ansis.default.blue,
|
|
44
|
+
tip: import_ansis.default.green,
|
|
45
|
+
important: import_ansis.default.magenta,
|
|
46
|
+
caution: import_ansis.default.red,
|
|
47
|
+
link: import_ansis.default.hex("#e8e8e8")
|
|
48
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli-data-migrate",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1-next.38+78d2119a5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"test:unit": "yarn jest src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@cedarjs/babel-config": "0.5.
|
|
29
|
-
"@cedarjs/project-config": "0.5.
|
|
30
|
-
"
|
|
28
|
+
"@cedarjs/babel-config": "0.5.1-next.38+78d2119a5",
|
|
29
|
+
"@cedarjs/project-config": "0.5.1-next.38+78d2119a5",
|
|
30
|
+
"ansis": "4.1.0",
|
|
31
31
|
"dotenv-defaults": "5.0.2",
|
|
32
32
|
"execa": "5.1.1",
|
|
33
33
|
"fs-extra": "11.2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"yargs": "17.7.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@cedarjs/framework-tools": "0.5.
|
|
39
|
+
"@cedarjs/framework-tools": "0.5.1-next.38",
|
|
40
40
|
"@prisma/client": "5.20.0",
|
|
41
41
|
"@types/fs-extra": "11.0.4",
|
|
42
42
|
"@types/yargs": "17.0.33",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "78d2119a507ed80faa9adb94b78d92662f134c4b"
|
|
52
52
|
}
|