@rljson/rljson 0.0.6 → 0.0.8

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