Skip to content

Commit 7329bee

Browse files
committed
Remove all those packages and use @ethdebug/format
- Setup jest in @ethdebug/format - Centralize all the schema types and type predicates into a src/types directory - Turn on strict optional property business even though it makes describeSchema a bit uglier - Don't stare too long at describeSchema right now even though you want to fix it - Move jest stuff back from the root into @ethdebug/format's directory - Get rid of the `/// <reference` garbage, yay - Downgrade chalk to avoid turning @ethdebug/format into ESM
1 parent 9caf8ea commit 7329bee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+93
-298
lines changed

bin/start

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ fi
1010
# Run the commands with concurrently
1111
concurrently --names=format,pointers,web,jest \
1212
"cd ./packages/format && yarn watch" \
13-
"cd ./packages/materials && yarn watch" \
1413
"cd ./packages/pointers && yarn watch" \
15-
"cd ./packages/types && yarn watch" \
16-
"cd ./packages/programs && yarn watch" \
1714
"cd ./packages/web && yarn start $NO_OPEN_FLAG" \
1815
"yarn test --watchAll"
1916

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"devDependencies": {
1616
"@hyperjump/json-schema": "1.6.7",
1717
"@types/jest": "^29.5.14",
18-
"chalk": "^5.4.1",
1918
"concurrently": "^8.2.2",
2019
"jest": "^29.7.0",
2120
"lerna": "^8.0.2",

packages/format/jest.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Config } from "jest";
2+
3+
const config: Config = {
4+
displayName: "@ethdebug/format",
5+
preset: "ts-jest",
6+
testEnvironment: "node",
7+
moduleFileExtensions: ["ts", "js"],
8+
moduleNameMapper: {
9+
'^(\\.{1,2}/.*)\\.js$': '$1',
10+
},
11+
modulePathIgnorePatterns: ["<rootDir>/dist/"],
12+
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
13+
transform: {
14+
'^.+\\.tsx?$': "ts-jest"
15+
},
16+
};
17+
18+
export default config;
File renamed without changes.

packages/format/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"prepare:yamls": "node ./bin/generate-schema-yamls.js > yamls.ts",
1313
"prepare": "yarn prepare:yamls && tsc",
1414
"clean": "rm -rf dist && rm yamls.ts",
15+
"test": "node --experimental-vm-modules $(yarn bin jest)",
1516
"watch:typescript": "tsc --watch",
1617
"watch:schemas": "nodemon --watch ../../schemas -e 'yaml' --exec 'yarn prepare:yamls'",
1718
"watch": "concurrently --names=tsc,schemas \"yarn watch:typescript\" \"yarn watch:schemas\""
@@ -21,8 +22,14 @@
2122
"yaml": "^2.3.4"
2223
},
2324
"devDependencies": {
25+
"@jest/globals": "^29.7.0",
26+
"chalk": "^4.1.0",
2427
"concurrently": "^8.2.2",
25-
"nodemon": "^3.0.2"
28+
"jest": "^29.7.0",
29+
"nodemon": "^3.0.2",
30+
"ts-jest": "^29.1.1",
31+
"ts-node": "^10.9.2",
32+
"typescript": "^5.3.3"
2633
},
2734
"publishConfig": {
2835
"access": "public"

packages/format/src/describe.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export function describeSchema({
3535
}
3636

3737
return referencesId(schema)
38-
? describeSchemaById({ schema, pointer })
38+
? describeSchemaById({ schema, ...(pointer ? { pointer } : {}) })
3939
: referencesYaml(schema)
40-
? describeSchemaByYaml({ schema, pointer })
41-
: describeSchemaByObject({ schema, pointer });
40+
? describeSchemaByYaml({ schema, ...(pointer ? { pointer } : {}) })
41+
: describeSchemaByObject({ schema, ...(pointer ? { pointer } : {}) });
4242
}
4343

4444
function describeSchemaById({
@@ -65,7 +65,7 @@ function describeSchemaById({
6565

6666
return {
6767
id,
68-
pointer,
68+
...(pointer ? { pointer } : {}),
6969
yaml,
7070
schema,
7171
rootSchema
@@ -86,14 +86,14 @@ function describeSchemaByYaml({
8686
if (id) {
8787
return {
8888
id,
89-
pointer,
89+
...(pointer ? { pointer } : {}),
9090
yaml,
9191
schema,
9292
rootSchema
9393
}
9494
} else {
9595
return {
96-
pointer,
96+
...(pointer ? { pointer } : {}),
9797
yaml,
9898
schema,
9999
rootSchema
@@ -116,14 +116,14 @@ function describeSchemaByObject({
116116
if (id) {
117117
return {
118118
id,
119-
pointer,
119+
...(pointer ? { pointer } : {}),
120120
yaml,
121121
schema,
122122
rootSchema
123123
}
124124
} else {
125125
return {
126-
pointer,
126+
...(pointer ? { pointer } : {}),
127127
yaml,
128128
schema,
129129
rootSchema

packages/format/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
export * from "./describe";
22
export { schemas, schemaIds, type Schema } from "./schemas";
3+
4+
export * from "./types";

packages/materials/src/data.test.ts renamed to packages/format/src/types/data/index.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/// <reference path="../../../jest.d.ts" />
21
import { expect, describe, it } from "@jest/globals";
32

4-
import { describeSchema } from "@ethdebug/format";
3+
import { describeSchema } from "../../describe";
54

65
import { Data } from "./index.js";
76

0 commit comments

Comments
 (0)