doc-detective-common 3.0.4-dev.2 → 3.0.4
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/.github/workflows/npm-test.yml +55 -5
- package/package.json +2 -2
- package/src/schemas/dereferenceSchemas.js +39 -20
- package/src/schemas/output_schemas/config_v3.schema.json +2 -2
- package/src/schemas/output_schemas/resolvedTests_v3.schema.json +3 -3
- package/src/schemas/schemas.json +5 -5
- package/src/schemas/src_schemas/config_v3.schema.json +1 -1
- package/src/schemas/src_schemas/resolvedTests_v3.schema.json +1 -1
- package/.github/workflows/npm-publish.yml +0 -62
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Test (& Publish)
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
7
|
pull_request:
|
|
8
|
-
types:
|
|
8
|
+
types:
|
|
9
|
+
- opened
|
|
10
|
+
- reopened
|
|
11
|
+
- synchronize
|
|
12
|
+
release:
|
|
13
|
+
types:
|
|
14
|
+
- published
|
|
9
15
|
workflow_dispatch:
|
|
10
16
|
|
|
11
17
|
jobs:
|
|
@@ -13,7 +19,7 @@ jobs:
|
|
|
13
19
|
runs-on: ${{ matrix.os }}
|
|
14
20
|
strategy:
|
|
15
21
|
matrix:
|
|
16
|
-
os:
|
|
22
|
+
os:
|
|
17
23
|
- ubuntu-latest
|
|
18
24
|
- windows-latest
|
|
19
25
|
- macos-latest
|
|
@@ -21,11 +27,55 @@ jobs:
|
|
|
21
27
|
- 18
|
|
22
28
|
- 20
|
|
23
29
|
- 22
|
|
24
|
-
|
|
30
|
+
- 24
|
|
31
|
+
|
|
25
32
|
steps:
|
|
26
33
|
- uses: actions/checkout@v4
|
|
27
34
|
- uses: actions/setup-node@v4
|
|
28
35
|
with:
|
|
36
|
+
cache: 'npm'
|
|
37
|
+
cache-dependency-path: package-lock.json
|
|
29
38
|
node-version: ${{ matrix.node }}
|
|
30
39
|
- run: npm ci
|
|
31
|
-
- run: npm
|
|
40
|
+
- run: npm run build # Automatically run tests because of the `postbuild` script in package.json
|
|
41
|
+
|
|
42
|
+
publish-npm:
|
|
43
|
+
# if: github.event_name == 'release' && github.event.action == 'published'
|
|
44
|
+
name: Publish to NPM
|
|
45
|
+
needs: test
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: actions/setup-node@v4
|
|
50
|
+
with:
|
|
51
|
+
cache: 'npm'
|
|
52
|
+
cache-dependency-path: package-lock.json
|
|
53
|
+
registry-url: https://registry.npmjs.org/
|
|
54
|
+
- run: echo "NODE_AUTH_TOKEN is set"
|
|
55
|
+
env:
|
|
56
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
|
57
|
+
- run: npm whoami
|
|
58
|
+
env:
|
|
59
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
|
60
|
+
- run: npm ci
|
|
61
|
+
- run: npm run build
|
|
62
|
+
- run: npm publish
|
|
63
|
+
env:
|
|
64
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
|
65
|
+
|
|
66
|
+
update-docs:
|
|
67
|
+
name: Update documentation
|
|
68
|
+
needs: publish-npm
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
|
|
73
|
+
- name: Get package version
|
|
74
|
+
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
|
|
75
|
+
|
|
76
|
+
- name: Trigger GitHub Action in doc-detective.github.io
|
|
77
|
+
run: |
|
|
78
|
+
curl -XPOST -H "Authorization: token ${{ secrets.DOCS_PERSONAL_ACCESS_TOKEN }}" \
|
|
79
|
+
-H "Accept: application/vnd.github.everest-preview+json" \
|
|
80
|
+
"https://api.github.com/repos/doc-detective/doc-detective.github.io/dispatches" \
|
|
81
|
+
-d '{"event_type": "update-common-package-event", "client_payload": {"version": "${{ env.VERSION }}"} }'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective-common",
|
|
3
|
-
"version": "3.0.4
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Shared components for Doc Detective projects.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"homepage": "https://github.com/doc-detective/doc-detective-common#readme",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"chai": "^5.2.0",
|
|
24
|
-
"mocha": "^11.
|
|
24
|
+
"mocha": "^11.4.0",
|
|
25
25
|
"sinon": "^20.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
@@ -67,30 +67,49 @@ async function dereferenceSchemas() {
|
|
|
67
67
|
for (const file of files) {
|
|
68
68
|
// console.log(`File: ${file}`)
|
|
69
69
|
const filePath = path.resolve(`${inputDir}/${file}`);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
const buildFilePath = path.resolve(`${buildDir}/${file}`);
|
|
71
|
+
try {
|
|
72
|
+
// Check if file exists
|
|
73
|
+
if (!fs.existsSync(filePath)) {
|
|
74
|
+
throw new Error(`File not found: ${filePath}`);
|
|
75
|
+
}
|
|
76
|
+
// Load schema
|
|
77
|
+
let schema = fs.readFileSync(filePath).toString();
|
|
78
|
+
schema = JSON.parse(schema);
|
|
79
|
+
|
|
80
|
+
// Update references to current relative path
|
|
81
|
+
schema.$id = `${filePath}`;
|
|
82
|
+
schema = updateRefPaths(schema);
|
|
83
|
+
|
|
84
|
+
// Write to build directory
|
|
85
|
+
fs.writeFileSync(buildFilePath, JSON.stringify(schema, null, 2));
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error(`Error processing ${file}:`, err);
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
// Dereference schemas
|
|
82
91
|
for await (const file of files) {
|
|
83
92
|
const filePath = path.resolve(`${buildDir}/${file}`);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
const outputFilePath = path.resolve(`${outputDir}/${file}`);
|
|
94
|
+
try {
|
|
95
|
+
// Check if file exists
|
|
96
|
+
if (!fs.existsSync(filePath))
|
|
97
|
+
throw new Error(`File not found: ${filePath}`);
|
|
98
|
+
|
|
99
|
+
// Load schema
|
|
100
|
+
let schema = fs.readFileSync(filePath).toString();
|
|
101
|
+
schema = JSON.parse(schema);
|
|
102
|
+
|
|
103
|
+
// Dereference schema
|
|
104
|
+
schema = await parser.dereference(schema);
|
|
105
|
+
// Delete $id attributes
|
|
106
|
+
schema = deleteDollarIds(schema);
|
|
107
|
+
|
|
108
|
+
// Write to file
|
|
109
|
+
fs.writeFileSync(outputFilePath, JSON.stringify(schema, null, 2));
|
|
110
|
+
} catch (err) {
|
|
111
|
+
console.error(`Error processing ${file}:`, err);
|
|
112
|
+
}
|
|
94
113
|
}
|
|
95
114
|
// Build final schemas.json file
|
|
96
115
|
const schemas = {};
|
|
@@ -5324,7 +5324,7 @@
|
|
|
5324
5324
|
"environment": {
|
|
5325
5325
|
"type": "object",
|
|
5326
5326
|
"description": "Environment information for the system running Doc Detective.",
|
|
5327
|
-
"
|
|
5327
|
+
"readOnly": true,
|
|
5328
5328
|
"additionalProperties": false,
|
|
5329
5329
|
"required": [
|
|
5330
5330
|
"platform"
|
|
@@ -5361,7 +5361,7 @@
|
|
|
5361
5361
|
"environment": {
|
|
5362
5362
|
"type": "object",
|
|
5363
5363
|
"description": "Environment information for the system running Doc Detective.",
|
|
5364
|
-
"
|
|
5364
|
+
"readOnly": true,
|
|
5365
5365
|
"additionalProperties": false,
|
|
5366
5366
|
"required": [
|
|
5367
5367
|
"platform"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "A collection of resolved tests ready to be performed.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"dynamicDefaults": {
|
|
7
|
-
"
|
|
7
|
+
"resolvedTestsId": "uuid"
|
|
8
8
|
},
|
|
9
9
|
"properties": {
|
|
10
10
|
"resolvedTestsId": {
|
|
@@ -5337,7 +5337,7 @@
|
|
|
5337
5337
|
"environment": {
|
|
5338
5338
|
"type": "object",
|
|
5339
5339
|
"description": "Environment information for the system running Doc Detective.",
|
|
5340
|
-
"
|
|
5340
|
+
"readOnly": true,
|
|
5341
5341
|
"additionalProperties": false,
|
|
5342
5342
|
"required": [
|
|
5343
5343
|
"platform"
|
|
@@ -5374,7 +5374,7 @@
|
|
|
5374
5374
|
"environment": {
|
|
5375
5375
|
"type": "object",
|
|
5376
5376
|
"description": "Environment information for the system running Doc Detective.",
|
|
5377
|
-
"
|
|
5377
|
+
"readOnly": true,
|
|
5378
5378
|
"additionalProperties": false,
|
|
5379
5379
|
"required": [
|
|
5380
5380
|
"platform"
|
package/src/schemas/schemas.json
CHANGED
|
@@ -5582,7 +5582,7 @@
|
|
|
5582
5582
|
"environment": {
|
|
5583
5583
|
"type": "object",
|
|
5584
5584
|
"description": "Environment information for the system running Doc Detective.",
|
|
5585
|
-
"
|
|
5585
|
+
"readOnly": true,
|
|
5586
5586
|
"additionalProperties": false,
|
|
5587
5587
|
"required": [
|
|
5588
5588
|
"platform"
|
|
@@ -5619,7 +5619,7 @@
|
|
|
5619
5619
|
"environment": {
|
|
5620
5620
|
"type": "object",
|
|
5621
5621
|
"description": "Environment information for the system running Doc Detective.",
|
|
5622
|
-
"
|
|
5622
|
+
"readOnly": true,
|
|
5623
5623
|
"additionalProperties": false,
|
|
5624
5624
|
"required": [
|
|
5625
5625
|
"platform"
|
|
@@ -12339,7 +12339,7 @@
|
|
|
12339
12339
|
"description": "A collection of resolved tests ready to be performed.",
|
|
12340
12340
|
"type": "object",
|
|
12341
12341
|
"dynamicDefaults": {
|
|
12342
|
-
"
|
|
12342
|
+
"resolvedTestsId": "uuid"
|
|
12343
12343
|
},
|
|
12344
12344
|
"properties": {
|
|
12345
12345
|
"resolvedTestsId": {
|
|
@@ -17672,7 +17672,7 @@
|
|
|
17672
17672
|
"environment": {
|
|
17673
17673
|
"type": "object",
|
|
17674
17674
|
"description": "Environment information for the system running Doc Detective.",
|
|
17675
|
-
"
|
|
17675
|
+
"readOnly": true,
|
|
17676
17676
|
"additionalProperties": false,
|
|
17677
17677
|
"required": [
|
|
17678
17678
|
"platform"
|
|
@@ -17709,7 +17709,7 @@
|
|
|
17709
17709
|
"environment": {
|
|
17710
17710
|
"type": "object",
|
|
17711
17711
|
"description": "Environment information for the system running Doc Detective.",
|
|
17712
|
-
"
|
|
17712
|
+
"readOnly": true,
|
|
17713
17713
|
"additionalProperties": false,
|
|
17714
17714
|
"required": [
|
|
17715
17715
|
"platform"
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"environment": {
|
|
218
218
|
"type": "object",
|
|
219
219
|
"description": "Environment information for the system running Doc Detective.",
|
|
220
|
-
"
|
|
220
|
+
"readOnly": true,
|
|
221
221
|
"additionalProperties": false,
|
|
222
222
|
"required": ["platform"],
|
|
223
223
|
"properties": {
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Publish NPM package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
workflow_dispatch:
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test:
|
|
13
|
-
runs-on: ${{ matrix.os }}
|
|
14
|
-
strategy:
|
|
15
|
-
matrix:
|
|
16
|
-
os:
|
|
17
|
-
- ubuntu-latest
|
|
18
|
-
- windows-latest
|
|
19
|
-
- macos-latest
|
|
20
|
-
node:
|
|
21
|
-
- 18
|
|
22
|
-
- 20
|
|
23
|
-
- 22
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
- uses: actions/checkout@v4
|
|
27
|
-
- uses: actions/setup-node@v4
|
|
28
|
-
with:
|
|
29
|
-
node-version: ${{ matrix.node }}
|
|
30
|
-
- run: npm ci
|
|
31
|
-
- run: npm test
|
|
32
|
-
|
|
33
|
-
publish-npm:
|
|
34
|
-
name: Publish to NPM
|
|
35
|
-
needs: test
|
|
36
|
-
runs-on: ubuntu-latest
|
|
37
|
-
steps:
|
|
38
|
-
- uses: actions/checkout@v3
|
|
39
|
-
- uses: actions/setup-node@v3
|
|
40
|
-
with:
|
|
41
|
-
registry-url: https://registry.npmjs.org/
|
|
42
|
-
- run: npm ci
|
|
43
|
-
- run: npm publish
|
|
44
|
-
env:
|
|
45
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
46
|
-
|
|
47
|
-
update-docs:
|
|
48
|
-
name: Update documentation
|
|
49
|
-
needs: publish-npm
|
|
50
|
-
runs-on: ubuntu-latest
|
|
51
|
-
steps:
|
|
52
|
-
- uses: actions/checkout@v4
|
|
53
|
-
|
|
54
|
-
- name: Get package version
|
|
55
|
-
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
|
|
56
|
-
|
|
57
|
-
- name: Trigger GitHub Action in doc-detective.github.io
|
|
58
|
-
run: |
|
|
59
|
-
curl -XPOST -H "Authorization: token ${{ secrets.DOCS_PERSONAL_ACCESS_TOKEN }}" \
|
|
60
|
-
-H "Accept: application/vnd.github.everest-preview+json" \
|
|
61
|
-
"https://api.github.com/repos/doc-detective/doc-detective.github.io/dispatches" \
|
|
62
|
-
-d '{"event_type": "update-common-package-event", "client_payload": {"version": "${{ env.VERSION }}"} }'
|