@xubylele/schema-forge 0.3.1 → 1.1.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/README.md +27 -15
- package/dist/cli.js +4 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -24,8 +24,6 @@ Or use directly with npx (no installation required):
|
|
|
24
24
|
npx @xubylele/schema-forge init
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
> **Note for contributors:** This is a scoped package. To publish, use `npm publish --access public` or run `npm run publish:public`.
|
|
28
|
-
|
|
29
27
|
## Development
|
|
30
28
|
|
|
31
29
|
Clone the repository and install dependencies:
|
|
@@ -61,7 +59,7 @@ Here's a quick walkthrough to get started with SchemaForge:
|
|
|
61
59
|
### 1. Initialize a new project
|
|
62
60
|
|
|
63
61
|
```bash
|
|
64
|
-
|
|
62
|
+
schema-forge init
|
|
65
63
|
```
|
|
66
64
|
|
|
67
65
|
This creates:
|
|
@@ -98,7 +96,7 @@ table posts {
|
|
|
98
96
|
### 3. Generate your first migration
|
|
99
97
|
|
|
100
98
|
```bash
|
|
101
|
-
|
|
99
|
+
schema-forge generate
|
|
102
100
|
```
|
|
103
101
|
|
|
104
102
|
This generates a timestamped SQL migration file with CREATE TABLE statements and updates the state file.
|
|
@@ -120,7 +118,7 @@ table users {
|
|
|
120
118
|
### 5. Generate a migration for the changes
|
|
121
119
|
|
|
122
120
|
```bash
|
|
123
|
-
|
|
121
|
+
schema-forge generate --name "add user avatar"
|
|
124
122
|
```
|
|
125
123
|
|
|
126
124
|
This generates a new migration file with ALTER TABLE statements.
|
|
@@ -128,29 +126,29 @@ This generates a new migration file with ALTER TABLE statements.
|
|
|
128
126
|
### 6. Check for pending changes
|
|
129
127
|
|
|
130
128
|
```bash
|
|
131
|
-
|
|
129
|
+
schema-forge diff
|
|
132
130
|
```
|
|
133
131
|
|
|
134
132
|
If your schema matches the state file, you'll see "No changes detected". If there are changes, it will display the SQL that would be generated.
|
|
135
133
|
|
|
136
134
|
## Commands
|
|
137
135
|
|
|
138
|
-
### `
|
|
136
|
+
### `schema-forge init`
|
|
139
137
|
|
|
140
138
|
Initialize a new SchemaForge project in the current directory.
|
|
141
139
|
|
|
142
140
|
```bash
|
|
143
|
-
|
|
141
|
+
schema-forge init
|
|
144
142
|
```
|
|
145
143
|
|
|
146
144
|
Creates the necessary directory structure and configuration files.
|
|
147
145
|
|
|
148
|
-
### `
|
|
146
|
+
### `schema-forge generate`
|
|
149
147
|
|
|
150
148
|
Generate SQL migration from schema changes.
|
|
151
149
|
|
|
152
150
|
```bash
|
|
153
|
-
|
|
151
|
+
schema-forge generate [--name "migration description"]
|
|
154
152
|
```
|
|
155
153
|
|
|
156
154
|
**Options:**
|
|
@@ -159,12 +157,12 @@ schemaforge generate [--name "migration description"]
|
|
|
159
157
|
|
|
160
158
|
Compares your current schema with the tracked state, generates SQL for any changes, and updates the state file.
|
|
161
159
|
|
|
162
|
-
### `
|
|
160
|
+
### `schema-forge diff`
|
|
163
161
|
|
|
164
162
|
Compare your schema with the current state without generating files.
|
|
165
163
|
|
|
166
164
|
```bash
|
|
167
|
-
|
|
165
|
+
schema-forge diff
|
|
168
166
|
```
|
|
169
167
|
|
|
170
168
|
Shows what SQL would be generated if you ran `generate`. Useful for previewing changes.
|
|
@@ -282,10 +280,10 @@ Currently supports:
|
|
|
282
280
|
|
|
283
281
|
A typical development workflow looks like this:
|
|
284
282
|
|
|
285
|
-
1. **Initialize** - `
|
|
283
|
+
1. **Initialize** - `schema-forge init` (one time)
|
|
286
284
|
2. **Edit schema** - Modify `schemaforge/schema.sf`
|
|
287
|
-
3. **Preview changes** - `
|
|
288
|
-
4. **Generate migration** - `
|
|
285
|
+
3. **Preview changes** - `schema-forge diff` (optional)
|
|
286
|
+
4. **Generate migration** - `schema-forge generate --name "description"`
|
|
289
287
|
5. **Apply migration** - Run the generated SQL against your database
|
|
290
288
|
6. **Repeat** - Continue editing and generating migrations as needed
|
|
291
289
|
|
|
@@ -315,6 +313,20 @@ Once your PR is merged to `main`, the release workflow automatically:
|
|
|
315
313
|
|
|
316
314
|
No manual steps required! See [docs/releasing.md](docs/releasing.md) for detailed documentation.
|
|
317
315
|
|
|
316
|
+
### Publishing Manually
|
|
317
|
+
|
|
318
|
+
To publish a scoped package to npm:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
npm publish --access public
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Or use the convenience script:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
npm run publish:public
|
|
328
|
+
```
|
|
329
|
+
|
|
318
330
|
For detailed guidelines on contributing and automated releases, see [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/releasing.md](docs/releasing.md).
|
|
319
331
|
|
|
320
332
|
## License
|
package/dist/cli.js
CHANGED
|
@@ -29,22 +29,22 @@ var import_commander4 = require("commander");
|
|
|
29
29
|
// package.json
|
|
30
30
|
var package_default = {
|
|
31
31
|
name: "@xubylele/schema-forge",
|
|
32
|
-
version: "
|
|
32
|
+
version: "1.1.1",
|
|
33
33
|
description: "Universal migration generator from schema DSL",
|
|
34
34
|
main: "dist/cli.js",
|
|
35
35
|
type: "commonjs",
|
|
36
36
|
bin: {
|
|
37
|
-
|
|
37
|
+
"schema-forge": "dist/cli.js"
|
|
38
38
|
},
|
|
39
39
|
scripts: {
|
|
40
40
|
build: "tsup src/cli.ts --format cjs --dts",
|
|
41
41
|
dev: "ts-node src/cli.ts",
|
|
42
42
|
test: "vitest",
|
|
43
43
|
prepublishOnly: "npm run build",
|
|
44
|
+
"publish:public": "npm publish --access public",
|
|
44
45
|
changeset: "changeset",
|
|
45
46
|
"version-packages": "changeset version",
|
|
46
|
-
release: "changeset publish"
|
|
47
|
-
"publish:public": "npm publish --access public"
|
|
47
|
+
release: "changeset publish"
|
|
48
48
|
},
|
|
49
49
|
keywords: [
|
|
50
50
|
"cli",
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xubylele/schema-forge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Universal migration generator from schema DSL",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|
|
8
|
-
"
|
|
8
|
+
"schema-forge": "dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsup src/cli.ts --format cjs --dts",
|
|
12
12
|
"dev": "ts-node src/cli.ts",
|
|
13
13
|
"test": "vitest",
|
|
14
14
|
"prepublishOnly": "npm run build",
|
|
15
|
+
"publish:public": "npm publish --access public",
|
|
15
16
|
"changeset": "changeset",
|
|
16
17
|
"version-packages": "changeset version",
|
|
17
|
-
"release": "changeset publish"
|
|
18
|
-
"publish:public": "npm publish --access public"
|
|
18
|
+
"release": "changeset publish"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"cli",
|