@smartive/graphql-magic 9.1.1 → 9.1.3
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/CHANGELOG.md +2 -2
- package/dist/bin/gqm.cjs +9 -7
- package/package.json +9 -9
- package/src/bin/gqm/gqm.ts +9 -7
- package/src/bin/gqm/settings.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## [9.1.
|
|
1
|
+
## [9.1.3](https://github.com/smartive/graphql-magic/compare/v9.1.2...v9.1.3) (2023-09-25)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* Migration generator ([#79](https://github.com/smartive/graphql-magic/issues/79)) ([30fa32b](https://github.com/smartive/graphql-magic/commit/30fa32bcaf84b10658232c9ccb2bb52e3f776063))
|
package/dist/bin/gqm.cjs
CHANGED
|
@@ -1355,7 +1355,7 @@ var ensureDirectoryExists = (dir) => {
|
|
|
1355
1355
|
if ((0, import_fs.existsSync)(dir)) {
|
|
1356
1356
|
return true;
|
|
1357
1357
|
}
|
|
1358
|
-
ensureDirectoryExists(dir);
|
|
1358
|
+
ensureDirectoryExists((0, import_path.dirname)(dir));
|
|
1359
1359
|
try {
|
|
1360
1360
|
console.info(`Creating directory ${dir}`);
|
|
1361
1361
|
(0, import_fs.mkdirSync)(dir);
|
|
@@ -1763,18 +1763,20 @@ import_commander.program.command("generate-graphql-api-types").description("Gene
|
|
|
1763
1763
|
import_commander.program.command("generate-graphql-client-types").description("Generate Graphql client types").action(async () => {
|
|
1764
1764
|
await generateGraphqlClientTypes();
|
|
1765
1765
|
});
|
|
1766
|
-
import_commander.program.command("generate-migration").description("Generate Migration").action(async () => {
|
|
1766
|
+
import_commander.program.command("generate-migration [<name>] [<date>]").description("Generate Migration").action(async (name2, date) => {
|
|
1767
1767
|
const git = (0, import_simple_git.simpleGit)();
|
|
1768
|
-
|
|
1769
|
-
|
|
1768
|
+
if (!name2) {
|
|
1769
|
+
name2 = (await git.branch()).current.split("/").pop();
|
|
1770
|
+
}
|
|
1771
|
+
if (!name2 || ["main", "staging", "production"].includes(name2)) {
|
|
1770
1772
|
name2 = await readLine("Migration name:");
|
|
1771
1773
|
}
|
|
1772
1774
|
const knexfile = await parseKnexfile();
|
|
1773
1775
|
const db = (0, import_knex.default)(knexfile);
|
|
1774
1776
|
try {
|
|
1775
|
-
const
|
|
1776
|
-
const migrations = await new MigrationGenerator(db,
|
|
1777
|
-
writeToFile(`migrations/${getMigrationDate()}_${name2}.ts`, migrations);
|
|
1777
|
+
const models = await parseModels();
|
|
1778
|
+
const migrations = await new MigrationGenerator(db, models).generate();
|
|
1779
|
+
writeToFile(`migrations/${date || getMigrationDate()}_${name2}.ts`, migrations);
|
|
1778
1780
|
} finally {
|
|
1779
1781
|
await db.destroy();
|
|
1780
1782
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartive/graphql-magic",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"overrides": {
|
|
37
37
|
"graphql": "$graphql",
|
|
38
|
-
"rollup": "3.
|
|
38
|
+
"rollup": "3.29.3"
|
|
39
39
|
},
|
|
40
40
|
"browserslist": "> 0.25%, not dead",
|
|
41
41
|
"publishConfig": {
|
|
@@ -64,20 +64,20 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@smartive/eslint-config": "3.2.0",
|
|
66
66
|
"@smartive/prettier-config": "3.1.2",
|
|
67
|
-
"@types/jest": "29.5.
|
|
68
|
-
"@types/lodash": "4.14.
|
|
67
|
+
"@types/jest": "29.5.5",
|
|
68
|
+
"@types/lodash": "4.14.199",
|
|
69
69
|
"@types/luxon": "3.3.2",
|
|
70
|
-
"@types/uuid": "9.0.
|
|
70
|
+
"@types/uuid": "9.0.4",
|
|
71
71
|
"create-ts-index": "1.14.0",
|
|
72
72
|
"del-cli": "5.1.0",
|
|
73
|
-
"esbuild": "0.19.
|
|
74
|
-
"eslint": "8.
|
|
73
|
+
"esbuild": "0.19.3",
|
|
74
|
+
"eslint": "8.50.0",
|
|
75
75
|
"graphql-request": "6.1.0",
|
|
76
|
-
"jest": "29.
|
|
76
|
+
"jest": "29.7.0",
|
|
77
77
|
"mock-knex": "0.4.12",
|
|
78
78
|
"pg": "8.11.3",
|
|
79
79
|
"prettier": "2.8.8",
|
|
80
|
-
"simple-git": "3.
|
|
80
|
+
"simple-git": "3.20.0",
|
|
81
81
|
"ts-jest": "29.1.1",
|
|
82
82
|
"ts-node": "10.9.1",
|
|
83
83
|
"typescript": "5.2.2"
|
package/src/bin/gqm/gqm.ts
CHANGED
|
@@ -110,14 +110,16 @@ program
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
program
|
|
113
|
-
.command('generate-migration')
|
|
113
|
+
.command('generate-migration [<name>] [<date>]')
|
|
114
114
|
.description('Generate Migration')
|
|
115
|
-
.action(async () => {
|
|
115
|
+
.action(async (name, date) => {
|
|
116
116
|
const git = simpleGit();
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
if (!name) {
|
|
119
|
+
name = (await git.branch()).current.split('/').pop();
|
|
120
|
+
}
|
|
119
121
|
|
|
120
|
-
if (name
|
|
122
|
+
if (!name || ['main', 'staging', 'production'].includes(name)) {
|
|
121
123
|
name = await readLine('Migration name:');
|
|
122
124
|
}
|
|
123
125
|
|
|
@@ -125,10 +127,10 @@ program
|
|
|
125
127
|
const db = knex(knexfile);
|
|
126
128
|
|
|
127
129
|
try {
|
|
128
|
-
const
|
|
129
|
-
const migrations = await new MigrationGenerator(db,
|
|
130
|
+
const models = await parseModels();
|
|
131
|
+
const migrations = await new MigrationGenerator(db, models).generate();
|
|
130
132
|
|
|
131
|
-
writeToFile(`migrations/${getMigrationDate()}_${name}.ts`, migrations);
|
|
133
|
+
writeToFile(`migrations/${date || getMigrationDate()}_${name}.ts`, migrations);
|
|
132
134
|
} finally {
|
|
133
135
|
await db.destroy();
|
|
134
136
|
}
|