doc-detective 3.0.6 → 3.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,7 +1,7 @@
1
1
  # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
2
  # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
3
 
4
- name: Run tests
4
+ name: Test (& Publish)
5
5
 
6
6
  on:
7
7
  push:
@@ -12,10 +12,13 @@ on:
12
12
  - opened
13
13
  - reopened
14
14
  - synchronize
15
+ release:
16
+ types:
17
+ - published
15
18
  workflow_dispatch:
16
19
 
17
20
  jobs:
18
- build:
21
+ test:
19
22
  runs-on: ${{ matrix.os }}
20
23
  timeout-minutes: 10
21
24
  strategy:
@@ -28,23 +31,66 @@ jobs:
28
31
  - 18
29
32
  - 20
30
33
  - 22
34
+ - 24
31
35
  steps:
32
36
  - uses: actions/checkout@v4
33
37
 
34
38
  - uses: actions/setup-node@v4
35
39
  with:
36
40
  node-version: ${{ matrix.node }}
41
+ cache: 'npm'
42
+ cache-dependency-path: package-lock.json
43
+
44
+ - run: npm ci
45
+ - run: npm test
37
46
 
38
- - name: Cache node_modules
39
- uses: actions/cache@v4
47
+ publish-npm:
48
+ if: github.event_name == 'release' && github.event.action == 'published'
49
+ needs: test
50
+ runs-on: ubuntu-latest
51
+ permissions:
52
+ contents: write
53
+ steps:
54
+ - uses: actions/checkout@v4
55
+ - uses: actions/setup-node@v4
40
56
  with:
41
- # Cache key uses the contents of `package-lock.json` to identify unique cache
42
- key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
43
- restore-keys: |
44
- ${{ runner.OS }}-node-
45
- path: |
46
- node_modules
47
-
57
+ cache: 'npm'
58
+ cache-dependency-path: package-lock.json
59
+ registry-url: https://registry.npmjs.org/
60
+
48
61
  - run: npm ci
62
+ - run: npm publish
63
+ env:
64
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
49
65
 
50
- - run: npm test
66
+ test-github-action:
67
+ name: Test GitHub Action
68
+ needs: publish-npm
69
+ runs-on: ubuntu-latest
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+ - uses: doc-detective/github-action@latest
73
+ id: dd
74
+ with:
75
+ config: ./test/artifacts/config.json
76
+ input: ./test/artifacts/doc-content.md
77
+ exit_on_fail: "true"
78
+
79
+ build-docker-image:
80
+ name: Build Docker Image
81
+ needs: publish-npm
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+
86
+ - name: Get package version
87
+ id: get_version
88
+ run: |
89
+ echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
90
+
91
+ - name: Trigger GitHub Action in docker-image repo
92
+ run: |
93
+ curl -X POST -H "Authorization: token ${{ secrets.DD_DEP_UPDATE_TOKEN }}" \
94
+ -H "Accept: application/vnd.github.everest-preview+json" \
95
+ "https://api.github.com/repos/doc-detective/docker-image/dispatches" \
96
+ -d '{ "event_type": "build-push", "client_payload": { "version": "${{ steps.get_version.outputs.version }}", "additional_info": "triggered from npm-publish workflow" } }'
@@ -0,0 +1,87 @@
1
+ name: Update doc-detective-core version
2
+
3
+ on:
4
+ repository_dispatch:
5
+ types:
6
+ - update-core-package-event
7
+ workflow_dispatch:
8
+ inputs:
9
+ version:
10
+ description: 'The doc-detective-core version.'
11
+ required: false
12
+ default: 'latest'
13
+
14
+ jobs:
15
+ update:
16
+ permissions:
17
+ contents: write
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout code
21
+ uses: actions/checkout@v4
22
+ with:
23
+ token: ${{ secrets.DD_DEP_UPDATE_TOKEN }}
24
+
25
+ - name: Set version variable
26
+ id: version
27
+ run: |
28
+ VERSION="${{ github.event.client_payload.version || github.event.inputs.version || 'latest' }}"
29
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
30
+ echo "Using version: $VERSION"
31
+
32
+ - name: Configure Git
33
+ run: |
34
+ git config --local user.email "action@github.com"
35
+ git config --local user.name "GitHub Action"
36
+
37
+ - name: Get version of doc-detective-common from core
38
+ id: common_version
39
+ run: |
40
+ COMMON_VERSION=$(npm view doc-detective-core@${{ steps.version.outputs.version }} dependencies --json | jq -r '.["doc-detective-common"]')
41
+ echo "common_version=$COMMON_VERSION" >> $GITHUB_OUTPUT
42
+
43
+ - name: Install specific versions of doc-detective-core and doc-detective-common
44
+ run: |
45
+ npm install doc-detective-core@${{ steps.version.outputs.version }} doc-detective-common@${{ steps.common_version.outputs.common_version }} || {
46
+ echo "Failed to install doc-detective-core@${{ steps.version.outputs.version }} or doc-detective-common@${{ steps.common_version.outputs.common_version }}"
47
+ exit 1
48
+ }
49
+
50
+ - name: Test the installation
51
+ run: |
52
+ npm test
53
+
54
+ - name: Commit changes
55
+ id: commit
56
+ run: |
57
+ git add package.json package-lock.json
58
+ if git diff --staged --quiet; then
59
+ echo "No changes to commit"
60
+ echo "has_changes=false" >> $GITHUB_OUTPUT
61
+ else
62
+ git commit -m "chore: bump doc-detective-core version to ${{ steps.version.outputs.version }}"
63
+ git push
64
+ echo "has_changes=true" >> $GITHUB_OUTPUT
65
+ fi
66
+
67
+ - name: Bump patch version
68
+ id: patch
69
+ if: steps.commit.outputs.has_changes == 'true'
70
+ run: |
71
+ git checkout -- .
72
+ git clean -fd
73
+ npm version patch
74
+ git push
75
+ git push --tags
76
+ echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
77
+
78
+ - name: Create release
79
+ if: steps.commit.outputs.has_changes == 'true'
80
+ uses: softprops/action-gh-release@v2
81
+ with:
82
+ body: "Updated to doc-detective-core v${{ steps.patch.outputs.version }}."
83
+ tag_name: "v${{ steps.patch.outputs.version }}"
84
+ name: "v${{ steps.patch.outputs.version }}"
85
+ generate_release_notes: true
86
+ token: ${{ secrets.DD_DEP_UPDATE_TOKEN }}
87
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doc-detective",
3
- "version": "3.0.6",
3
+ "version": "3.0.9",
4
4
  "description": "Treat doc content as testable assertions to validate doc accuracy and product UX.",
5
5
  "bin": {
6
6
  "doc-detective": "src/index.js"
@@ -33,8 +33,8 @@
33
33
  "homepage": "https://github.com/doc-detective/doc-detective#readme",
34
34
  "dependencies": {
35
35
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
36
- "doc-detective-common": "^3.0.6",
37
- "doc-detective-core": "^3.0.7",
36
+ "doc-detective-common": "^3.0.7",
37
+ "doc-detective-core": "^3.0.10",
38
38
  "yargs": "^17.7.2"
39
39
  },
40
40
  "devDependencies": {
@@ -1,43 +1,5 @@
1
1
  {
2
- "envVariables": "",
3
- "input": ".",
4
- "output": ".",
5
- "recursive": true,
6
- "relativePathBase": "file",
7
2
  "logLevel": "debug",
8
- "runTests": {
9
- "input": "test.spec.json",
10
- "output": ".",
11
- "setup": "",
12
- "cleanup": "",
13
- "recursive": true,
14
- "detectSteps": false,
15
- "mediaDirectory": ".",
16
- "downloadDirectory": ".",
17
- "contexts": [
18
- {
19
- "app": { "name": "chrome", "options": { "headless": false } },
20
- "platforms": ["mac", "linux"]
21
- },
22
- {
23
- "app": { "name": "chrome", "options": { "headless": true } },
24
- "platforms": ["windows"]
25
- }
26
-
27
- ]
28
- },
29
- "runCoverage": {
30
- "recursive": true,
31
- "input": ".dev/",
32
- "output": ".",
33
- "markup": []
34
- },
35
- "suggestTests": {
36
- "recursive": true,
37
- "input": ".",
38
- "output": ".",
39
- "markup": []
40
- },
41
3
  "telemetry": {
42
4
  "send": false
43
5
  }
@@ -1,16 +1,23 @@
1
1
  # Doc Detective documentation overview
2
2
 
3
- [comment]: # (test start {"id":"search-kittens"})
3
+ <!-- test
4
+ testId: doc-detective-docs
5
+ detectSteps: false
6
+ -->
4
7
 
5
- [Doc Detective documentation](http://doc-detective.com) is split into a few key sections:
6
- [comment]: # (step {"action":"goTo", "url":"https://doc-detective.com"})
8
+ [Doc Detective documentation](https://doc-detective.com) is split into a few key sections:
7
9
 
8
- - The landing page discusses what Doc Detective is, what it does, and who might find it useful.
9
- - [Get started](https://doc-detective.com/docs/get-started/intro) covers how to quickly get up and running with Doc Detective.
10
- [comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/docs/get-started/intro"})
11
- - The [references](https://doc-detective.com/docs/references/schemas/typeKeys) detail the various JSON objects that Doc Detective expects for configs, test specifications, tests, actions, and more. Each object schema includes an object description, field definitions, and examples.
12
- [comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/docs/references/schemas/typeKeys"})
13
- [comment]: # (step {"action":"find", "selector":"h2#fields", "matchText":"Fields"})
14
- [comment]: # (step {"action":"find", "selector":"h2#examples", "matchText":"Examples"})
10
+ <!-- step checkLink: "https://doc-detective.com" -->
15
11
 
16
- [comment]: # (test end)
12
+ - The landing page discusses what Doc Detective is, what it does, and who might find it useful.
13
+ - [Get started](https://doc-detective.com/docs/get-started/intro) covers how to quickly get up and running with Doc Detective.
14
+
15
+ <!-- step checkLink: "https://doc-detective.com/docs/get-started/intro" -->
16
+
17
+ Some pages also have unique headings. If you open [type](https://doc-detective.com/docs/get-started/actions/type) it has **Special keys**.
18
+
19
+ <!-- step goTo: "https://doc-detective.com/docs/get-started/actions/type" -->
20
+ <!-- step find: Special keys -->
21
+
22
+ ![Search results.](reference.png){ .screenshot }
23
+ <!-- step screenshot: reference.png -->
@@ -1,17 +0,0 @@
1
- name: Build and publish Electron bundles
2
-
3
- on:
4
- # push:
5
- # branches:
6
- # - main
7
- workflow_dispatch:
8
-
9
- jobs:
10
- build:
11
- runs-on: macos-latest
12
- steps:
13
- - uses: actions/checkout@v3
14
- - uses: actions/setup-node@v3
15
- - run: cd frontend && npm i
16
- - run: cd ../electron && npm i
17
- - run: npm run publish
@@ -1,74 +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
- build:
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
- steps:
25
- - uses: actions/checkout@v4
26
- - uses: actions/setup-node@v4
27
- with:
28
- node-version: ${{ matrix.node }}
29
- - run: npm ci
30
- - run: npm test
31
-
32
- publish-npm:
33
- needs: build
34
- runs-on: ubuntu-latest
35
- steps:
36
- - uses: actions/checkout@v4
37
- - uses: actions/setup-node@v4
38
- with:
39
- registry-url: https://registry.npmjs.org/
40
- - run: npm ci
41
- - run: npm publish
42
- env:
43
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
44
-
45
- # Test downstream consumers of the package
46
- test-github-action:
47
- name: Test GitHub Action
48
- needs: publish-npm
49
- runs-on: ubuntu-latest
50
- steps:
51
- - uses: actions/checkout@v4
52
- - uses: doc-detective/github-action@latest
53
- id: dd
54
- with:
55
- config: ./test/artifacts/config.json
56
- input: ./test/artifacts/doc-content.md
57
- exit_on_fail: "true"
58
-
59
- build-docker-image:
60
- name: Build Docker Image
61
- needs: publish-npm
62
- runs-on: ubuntu-latest
63
- steps:
64
- - uses: actions/checkout@v4
65
-
66
- - name: Get package version
67
- run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
68
-
69
- - name: Trigger GitHub Action in docker-image repo
70
- run: |
71
- curl -X POST -H "Authorization: token ${{ secrets.DOCKER_IMAGE_REPO_PAT }}" \
72
- -H "Accept: application/vnd.github.everest-preview+json" \
73
- "https://api.github.com/repos/doc-detective/docker-image/dispatches" \
74
- -d '{ "event_type": "build-push", "client_payload": { "version": "${{ env.VERSION }}", "additional_info": "triggered from npm-publish workflow" } }'