@rljson/rljson 0.0.7 → 0.0.9

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.
@@ -1,21 +1,53 @@
1
- # Contributors
1
+ <!--
2
+ // @license
3
+ // Copyright (c) 2025 Rljson
4
+ //
5
+ // Use of this source code is governed by terms that can be
6
+ // found in the LICENSE file in the root of this package.
7
+ -->
8
+
9
+ # Contributors Guide
10
+
11
+ - [Install](#install)
12
+ - [Check out](#check-out)
13
+ - [Install pnpm](#install-pnpm)
14
+ - [Install dependencies](#install-dependencies)
15
+ - [Install Vscode extensions](#install-vscode-extensions)
16
+ - [Uninstall Jest and Jasmine](#uninstall-jest-and-jasmine)
17
+ - [Install GitHub CLI](#install-github-cli)
18
+ - [Develop](#develop)
19
+ - [Read architecture doc](#read-architecture-doc)
20
+ - [Debug](#debug)
21
+ - [Update goldens](#update-goldens)
22
+ - [Test and Build](#test-and-build)
23
+ - [Workflow](#workflow)
24
+ - [Checkout main](#checkout-main)
25
+ - [Create a branch](#create-a-branch)
26
+ - [Commit](#commit)
27
+ - [Update dependencies](#update-dependencies)
28
+ - [Increase version](#increase-version)
29
+ - [Create a pull request](#create-a-pull-request)
30
+ - [Wait until PR is merged](#wait-until-pr-is-merged)
31
+ - [Delete feature branch](#delete-feature-branch)
32
+ - [Publish to NPM](#publish-to-npm)
33
+ - [Troubleshooting](#troubleshooting)
34
+ - [Checkout README.trouble.md](#checkout-readmetroublemd)
35
+ - [File issues on GitHub](#file-issues-on-github)
36
+
37
+ <!-- ........................................................................-->
38
+
39
+ ## Install
40
+
41
+ ### Check out
2
42
 
3
- ## Important
4
-
5
- ⚠️ IMPORTANT: On `Windows, please checkout the repo on drive C`.
6
- There is a bug in the Vscode vitest extension v 1.14.4, making debugging tests
7
- not work. <https://github.com/vitest-dev/vscode/issues/548>
8
- Please check from time to time, if the issue is fixed and remove this hint.
9
-
10
- ## Report issues
11
-
12
- Visit <https://github.com/rljson/rljson/issues>
13
-
14
- Check if there is already an issue for your problem
15
-
16
- If no, report the issue
43
+ ```bash
44
+ mkdir rljson
45
+ cd rljson
46
+ git clone https://github.com/rljson/rljson.git
47
+ cd io
48
+ ```
17
49
 
18
- ## Install pnpm
50
+ ### Install pnpm
19
51
 
20
52
  Windows:
21
53
 
@@ -29,123 +61,185 @@ Mac:
29
61
  sudo corepack enable pnpm
30
62
  ```
31
63
 
32
- ## Check out
64
+ ### Install dependencies
33
65
 
34
66
  ```bash
35
- mkdir rljson
36
- cd rljson
37
- git clone https://github.com/rljson/rljson.git
38
- cd rljson
67
+ pnpm install
39
68
  ```
40
69
 
41
- ## Install dependencies
70
+ ### Install Vscode extensions
42
71
 
43
- ```bash
44
- npm install
45
- ```
72
+ Open this project in `vscode`.
46
73
 
47
- ## Run the tests
74
+ Press `Cmd+Shift+P`.
75
+
76
+ Type `Extensions: Show Recommended Extensions` and press `Enter`.
77
+
78
+ The recommended extensions will be shown.
79
+
80
+ Make sure, all recommended extensions are shown.
81
+
82
+ ### Uninstall Jest and Jasmine
83
+
84
+ Jest or Jasmine extensions conflict with the `Vitest` extension used for this
85
+ project.
86
+
87
+ Uninstall them, if you have installed them.
88
+
89
+ ### Install GitHub CLI
90
+
91
+ Install GitHub CLI on Mac
48
92
 
49
93
  ```bash
50
- npm run test
94
+ brew install gh
51
95
  ```
52
96
 
53
- ## Build the package
97
+ Login
54
98
 
55
99
  ```bash
56
- npm run build
100
+ gh auth login
57
101
  ```
58
102
 
59
- ## Publish the package
103
+ <!-- ........................................................................-->
60
104
 
61
- Open `package.json`
105
+ ## Develop
62
106
 
63
- Increase `version`
107
+ ### Read architecture doc
64
108
 
65
- Make sure all dependencies are listed in `peerDependencies`
109
+ Read [README.architecture.md](./README.architecture.md) to get an overview
110
+ of the package's architecture.
111
+
112
+ ### Debug
113
+
114
+ In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
115
+
116
+ At the `top`, click on the `refresh` icon to show update the tests.
66
117
 
67
- Make sure no file references are contained
118
+ Open a test file (`*.spec.ts`)
68
119
 
69
- Open `vite.config.mts` right beside `package.json`
120
+ Set a breakpoint.
70
121
 
71
- Make sure all `peerDependencies` are listed in `rollupOptions/external`
122
+ Press `alt` and click on the play button left beside the test.
72
123
 
73
- Compile typescript:
124
+ Execution should stop at the breakpoint.
125
+
126
+ ### Update goldens
127
+
128
+ In various tests we are creating golden files, that are reference files that
129
+ are compared against the files created in the tests.
74
130
 
75
131
  ```bash
76
- npm run build
132
+ pnpm updateGoldens
77
133
  ```
78
134
 
79
- Make publish dry-run
135
+ ### Test and Build
80
136
 
81
137
  ```bash
82
- npm publish --access=public --dry-run
138
+ pnpm test &&\
139
+ pnpm build
83
140
  ```
84
141
 
85
- Check the changes to uploaded
142
+ <!-- ........................................................................-->
143
+
144
+ ## Workflow
86
145
 
87
- Publish the package
146
+ ### Checkout main
88
147
 
89
148
  ```bash
90
- npm publish --access=public
149
+ git checkout main && \
150
+ git fetch && \
151
+ git pull
91
152
  ```
92
153
 
93
- ## Architecture
154
+ ### Create a branch
94
155
 
95
- Reade [README.architecture.md](./README.architecture.md) to get an overview
96
- of the package's architecture.
156
+ Please replace `Commit Message` in the next command by your commit message.
157
+ It will also used for branch name and pull request
97
158
 
98
- ## Install Vscode extensions
159
+ ```bash
160
+ export MESSAGE="Add package.json tests and fix issues" && \
161
+ export BRANCH=`echo "$MESSAGE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g'` &&\
162
+ git checkout -b $BRANCH
163
+ ```
99
164
 
100
- Open this project in `vscode`.
165
+ ### Commit
101
166
 
102
- Press `Cmd+Shift+P`.
167
+ Develop your feature
103
168
 
104
- Type `Extensions: Show Recommended Extensions` and press `Enter`.
169
+ Commit your changes
105
170
 
106
- The recommended extensions will be shown.
171
+ If you only have one thing, execute
107
172
 
108
- Make sure, all recommended extensions are shown.
173
+ ```bash
174
+ git commit -am"$MESSAGE"
175
+ ```
109
176
 
110
- ## Uninstall all test extensions, e.g. Jest or Jasmine
177
+ ### Update dependencies
111
178
 
112
- Jest or Jasmine extensions conflict with the `Vitest` extension used for this
113
- project.
179
+ We aim to work with the latest versions of our dependencies.
114
180
 
115
- Uninstall them, if you have installed them.
181
+ ```bash
182
+ pnpm update --latest &&\
183
+ git commit -am"Update dependencies"
184
+ ```
116
185
 
117
- ## Debug tests
186
+ ### Increase version
118
187
 
119
- In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
188
+ ```bash
189
+ pnpm version patch --no-git-tag-version && \
190
+ git commit -am"Increase version"
191
+ ```
120
192
 
121
- At the `top`, click on the `refresh` icon to show update the tests.
193
+ ### Create a pull request
122
194
 
123
- Open a test file (`*.spec.ts`)
195
+ ```bash
196
+ git push -u origin $BRANCH && \
197
+ gh pr create --base main --title "$MESSAGE" --body "" && \
198
+ gh pr merge --auto --squash
124
199
 
125
- Set a breakpoint.
200
+ ```
126
201
 
127
- Press `alt` and click on the play button left beside the test.
202
+ ### Wait until PR is merged
128
203
 
129
- Execution should stop at the breakpoint.
204
+ Get the PR URL with the following command
130
205
 
131
- ## Update goldens
206
+ ```bash
207
+ echo -e "\033[34m$(gh pr view --json url | jq -r '.url')\033[0m"
208
+ echo "Wait until PR is closed ..." && \
209
+ until gh pr view --json closed | jq -e '.closed == true' >/dev/null; do
210
+ sleep 2 >/dev/null;
211
+ done;
212
+ ```
132
213
 
133
- In various tests we are creating golden files, that are reference files that
134
- are compared against the files created in the tests.
214
+ ### Delete feature branch
215
+
216
+ ```bash
217
+ git fetch && git checkout main && \
218
+ git reset --soft origin/main && \
219
+ git stash -m"PR Aftermath" && \
220
+ git pull && \
221
+ git branch -d $BRANCH
222
+ ```
135
223
 
136
- If change is detected, the fest fail.
224
+ ### Publish to NPM
137
225
 
138
- An example is `test/goldens/README.md` which is compared against
139
- `dist/README.md`.
226
+ ```bash
227
+ npm publish --access public && \
228
+ git tag $(npm pkg get version | tr -d '\\"')
229
+ ```
230
+
231
+ <!-- ........................................................................-->
140
232
 
141
- If the changes are desired, update the golden files:
233
+ ## Troubleshooting
142
234
 
143
- Open `update-goldens.ts`
235
+ ### Checkout README.trouble.md
144
236
 
145
- Set `export const updateGoldens` to `true`
237
+ Checkout [./README.trouble.md](./README.trouble.md)
146
238
 
147
- Run tests again.
239
+ ### File issues on GitHub
240
+
241
+ Visit <https://github.com/rljson/rljson/issues>
148
242
 
149
- Set `export const updateGoldens` to `false`.
243
+ Check if there is already an issue for your problem.
150
244
 
151
- Run tests again.
245
+ If no, report the issue.
@@ -1,21 +1,53 @@
1
- # Contributors
1
+ <!--
2
+ // @license
3
+ // Copyright (c) 2025 Rljson
4
+ //
5
+ // Use of this source code is governed by terms that can be
6
+ // found in the LICENSE file in the root of this package.
7
+ -->
8
+
9
+ # Contributors Guide
10
+
11
+ - [Install](#install)
12
+ - [Check out](#check-out)
13
+ - [Install pnpm](#install-pnpm)
14
+ - [Install dependencies](#install-dependencies)
15
+ - [Install Vscode extensions](#install-vscode-extensions)
16
+ - [Uninstall Jest and Jasmine](#uninstall-jest-and-jasmine)
17
+ - [Install GitHub CLI](#install-github-cli)
18
+ - [Develop](#develop)
19
+ - [Read architecture doc](#read-architecture-doc)
20
+ - [Debug](#debug)
21
+ - [Update goldens](#update-goldens)
22
+ - [Test and Build](#test-and-build)
23
+ - [Workflow](#workflow)
24
+ - [Checkout main](#checkout-main)
25
+ - [Create a branch](#create-a-branch)
26
+ - [Commit](#commit)
27
+ - [Update dependencies](#update-dependencies)
28
+ - [Increase version](#increase-version)
29
+ - [Create a pull request](#create-a-pull-request)
30
+ - [Wait until PR is merged](#wait-until-pr-is-merged)
31
+ - [Delete feature branch](#delete-feature-branch)
32
+ - [Publish to NPM](#publish-to-npm)
33
+ - [Troubleshooting](#troubleshooting)
34
+ - [Checkout README.trouble.md](#checkout-readmetroublemd)
35
+ - [File issues on GitHub](#file-issues-on-github)
36
+
37
+ <!-- ........................................................................-->
38
+
39
+ ## Install
40
+
41
+ ### Check out
2
42
 
3
- ## Important
4
-
5
- ⚠️ IMPORTANT: On `Windows, please checkout the repo on drive C`.
6
- There is a bug in the Vscode vitest extension v 1.14.4, making debugging tests
7
- not work. <https://github.com/vitest-dev/vscode/issues/548>
8
- Please check from time to time, if the issue is fixed and remove this hint.
9
-
10
- ## Report issues
11
-
12
- Visit <https://github.com/rljson/rljson/issues>
13
-
14
- Check if there is already an issue for your problem
15
-
16
- If no, report the issue
43
+ ```bash
44
+ mkdir rljson
45
+ cd rljson
46
+ git clone https://github.com/rljson/rljson.git
47
+ cd io
48
+ ```
17
49
 
18
- ## Install pnpm
50
+ ### Install pnpm
19
51
 
20
52
  Windows:
21
53
 
@@ -29,123 +61,185 @@ Mac:
29
61
  sudo corepack enable pnpm
30
62
  ```
31
63
 
32
- ## Check out
64
+ ### Install dependencies
33
65
 
34
66
  ```bash
35
- mkdir rljson
36
- cd rljson
37
- git clone https://github.com/rljson/rljson.git
38
- cd rljson
67
+ pnpm install
39
68
  ```
40
69
 
41
- ## Install dependencies
70
+ ### Install Vscode extensions
42
71
 
43
- ```bash
44
- npm install
45
- ```
72
+ Open this project in `vscode`.
46
73
 
47
- ## Run the tests
74
+ Press `Cmd+Shift+P`.
75
+
76
+ Type `Extensions: Show Recommended Extensions` and press `Enter`.
77
+
78
+ The recommended extensions will be shown.
79
+
80
+ Make sure, all recommended extensions are shown.
81
+
82
+ ### Uninstall Jest and Jasmine
83
+
84
+ Jest or Jasmine extensions conflict with the `Vitest` extension used for this
85
+ project.
86
+
87
+ Uninstall them, if you have installed them.
88
+
89
+ ### Install GitHub CLI
90
+
91
+ Install GitHub CLI on Mac
48
92
 
49
93
  ```bash
50
- npm run test
94
+ brew install gh
51
95
  ```
52
96
 
53
- ## Build the package
97
+ Login
54
98
 
55
99
  ```bash
56
- npm run build
100
+ gh auth login
57
101
  ```
58
102
 
59
- ## Publish the package
103
+ <!-- ........................................................................-->
60
104
 
61
- Open `package.json`
105
+ ## Develop
62
106
 
63
- Increase `version`
107
+ ### Read architecture doc
64
108
 
65
- Make sure all dependencies are listed in `peerDependencies`
109
+ Read [README.architecture.md](./README.architecture.md) to get an overview
110
+ of the package's architecture.
111
+
112
+ ### Debug
113
+
114
+ In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
115
+
116
+ At the `top`, click on the `refresh` icon to show update the tests.
66
117
 
67
- Make sure no file references are contained
118
+ Open a test file (`*.spec.ts`)
68
119
 
69
- Open `vite.config.mts` right beside `package.json`
120
+ Set a breakpoint.
70
121
 
71
- Make sure all `peerDependencies` are listed in `rollupOptions/external`
122
+ Press `alt` and click on the play button left beside the test.
72
123
 
73
- Compile typescript:
124
+ Execution should stop at the breakpoint.
125
+
126
+ ### Update goldens
127
+
128
+ In various tests we are creating golden files, that are reference files that
129
+ are compared against the files created in the tests.
74
130
 
75
131
  ```bash
76
- npm run build
132
+ pnpm updateGoldens
77
133
  ```
78
134
 
79
- Make publish dry-run
135
+ ### Test and Build
80
136
 
81
137
  ```bash
82
- npm publish --access=public --dry-run
138
+ pnpm test &&\
139
+ pnpm build
83
140
  ```
84
141
 
85
- Check the changes to uploaded
142
+ <!-- ........................................................................-->
143
+
144
+ ## Workflow
86
145
 
87
- Publish the package
146
+ ### Checkout main
88
147
 
89
148
  ```bash
90
- npm publish --access=public
149
+ git checkout main && \
150
+ git fetch && \
151
+ git pull
91
152
  ```
92
153
 
93
- ## Architecture
154
+ ### Create a branch
94
155
 
95
- Reade [README.architecture.md](./README.architecture.md) to get an overview
96
- of the package's architecture.
156
+ Please replace `Commit Message` in the next command by your commit message.
157
+ It will also used for branch name and pull request
97
158
 
98
- ## Install Vscode extensions
159
+ ```bash
160
+ export MESSAGE="Add package.json tests and fix issues" && \
161
+ export BRANCH=`echo "$MESSAGE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g'` &&\
162
+ git checkout -b $BRANCH
163
+ ```
99
164
 
100
- Open this project in `vscode`.
165
+ ### Commit
101
166
 
102
- Press `Cmd+Shift+P`.
167
+ Develop your feature
103
168
 
104
- Type `Extensions: Show Recommended Extensions` and press `Enter`.
169
+ Commit your changes
105
170
 
106
- The recommended extensions will be shown.
171
+ If you only have one thing, execute
107
172
 
108
- Make sure, all recommended extensions are shown.
173
+ ```bash
174
+ git commit -am"$MESSAGE"
175
+ ```
109
176
 
110
- ## Uninstall all test extensions, e.g. Jest or Jasmine
177
+ ### Update dependencies
111
178
 
112
- Jest or Jasmine extensions conflict with the `Vitest` extension used for this
113
- project.
179
+ We aim to work with the latest versions of our dependencies.
114
180
 
115
- Uninstall them, if you have installed them.
181
+ ```bash
182
+ pnpm update --latest &&\
183
+ git commit -am"Update dependencies"
184
+ ```
116
185
 
117
- ## Debug tests
186
+ ### Increase version
118
187
 
119
- In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
188
+ ```bash
189
+ pnpm version patch --no-git-tag-version && \
190
+ git commit -am"Increase version"
191
+ ```
120
192
 
121
- At the `top`, click on the `refresh` icon to show update the tests.
193
+ ### Create a pull request
122
194
 
123
- Open a test file (`*.spec.ts`)
195
+ ```bash
196
+ git push -u origin $BRANCH && \
197
+ gh pr create --base main --title "$MESSAGE" --body "" && \
198
+ gh pr merge --auto --squash
124
199
 
125
- Set a breakpoint.
200
+ ```
126
201
 
127
- Press `alt` and click on the play button left beside the test.
202
+ ### Wait until PR is merged
128
203
 
129
- Execution should stop at the breakpoint.
204
+ Get the PR URL with the following command
130
205
 
131
- ## Update goldens
206
+ ```bash
207
+ echo -e "\033[34m$(gh pr view --json url | jq -r '.url')\033[0m"
208
+ echo "Wait until PR is closed ..." && \
209
+ until gh pr view --json closed | jq -e '.closed == true' >/dev/null; do
210
+ sleep 2 >/dev/null;
211
+ done;
212
+ ```
132
213
 
133
- In various tests we are creating golden files, that are reference files that
134
- are compared against the files created in the tests.
214
+ ### Delete feature branch
215
+
216
+ ```bash
217
+ git fetch && git checkout main && \
218
+ git reset --soft origin/main && \
219
+ git stash -m"PR Aftermath" && \
220
+ git pull && \
221
+ git branch -d $BRANCH
222
+ ```
135
223
 
136
- If change is detected, the fest fail.
224
+ ### Publish to NPM
137
225
 
138
- An example is `test/goldens/README.md` which is compared against
139
- `dist/README.md`.
226
+ ```bash
227
+ npm publish --access public && \
228
+ git tag $(npm pkg get version | tr -d '\\"')
229
+ ```
230
+
231
+ <!-- ........................................................................-->
140
232
 
141
- If the changes are desired, update the golden files:
233
+ ## Troubleshooting
142
234
 
143
- Open `update-goldens.ts`
235
+ ### Checkout README.trouble.md
144
236
 
145
- Set `export const updateGoldens` to `true`
237
+ Checkout [./README.trouble.md](./README.trouble.md)
146
238
 
147
- Run tests again.
239
+ ### File issues on GitHub
240
+
241
+ Visit <https://github.com/rljson/rljson/issues>
148
242
 
149
- Set `export const updateGoldens` to `false`.
243
+ Check if there is already an issue for your problem.
150
244
 
151
- Run tests again.
245
+ If no, report the issue.
package/dist/rljson.d.ts CHANGED
@@ -166,3 +166,5 @@ export interface Rljson extends Json {
166
166
  [tableId: TableName]: TableType | string;
167
167
  }
168
168
  export declare const exampleRljson: () => Rljson;
169
+ export declare const exampleRljsonEmpty: () => Rljson;
170
+ export declare const exampleRljsonWithErrors: () => Rljson;
package/dist/rljson.js CHANGED
@@ -1,5 +1,20 @@
1
+ import { exampleJsonObject } from "@rljson/json";
1
2
  // @license
2
- const exampleRljson = () => ({});
3
+ const exampleRljson = () => ({
4
+ table: {
5
+ _type: "properties",
6
+ _data: [exampleJsonObject()]
7
+ }
8
+ });
9
+ const exampleRljsonEmpty = () => ({});
10
+ const exampleRljsonWithErrors = () => ({
11
+ brok$en: {
12
+ _type: "properties",
13
+ _data: []
14
+ }
15
+ });
3
16
  export {
4
- exampleRljson
17
+ exampleRljson,
18
+ exampleRljsonEmpty,
19
+ exampleRljsonWithErrors
5
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "packageManager": "pnpm@10.6.2",
5
5
  "description": "The RLJSON data format specification",
6
6
  "homepage": "https://github.com/rljson/rljson",
@@ -14,7 +14,7 @@
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/rljson/rljson.git"
16
16
  },
17
- "main": "dist/index.js",
17
+ "main": "dist/rljson.js",
18
18
  "types": "dist/index.d.ts",
19
19
  "files": [
20
20
  "dist"
@@ -39,6 +39,7 @@
39
39
  "eslint-plugin-tsdoc": "^0.4.0",
40
40
  "globals": "^16.0.0",
41
41
  "jsdoc": "^4.0.4",
42
+ "read-pkg": "^9.0.1",
42
43
  "typescript": "~5.8.2",
43
44
  "typescript-eslint": "^8.26.1",
44
45
  "vite": "^6.2.1",
@@ -49,8 +50,8 @@
49
50
  "vitest-dom": "^0.1.1"
50
51
  },
51
52
  "dependencies": {
52
- "@rljson/hash": "^0.0.9",
53
- "@rljson/json": "^0.0.7"
53
+ "@rljson/hash": "^0.0.10",
54
+ "@rljson/json": "^0.0.9"
54
55
  },
55
56
  "pnpm": {
56
57
  "onlyBuiltDependencies": [