doc-detective 2.15.1-docker.0 → 2.16.0-dev.0
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-publish.yml +19 -29
- package/package.json +4 -6
- package/samples/.doc-detective.json +1 -1
- package/src/index.js +1 -1
- package/src/utils.js +3 -2
- package/test/artifacts/config.json +2 -1
- package/test/artifacts/test.spec.json +2 -2
- package/test/utils.test.js +2 -2
- package/.dockerignore +0 -7
- package/.github/workflows/docker-image.yml +0 -19
- package/Dockerfile +0 -66
- package/samples/reference.png +0 -0
|
@@ -20,48 +20,38 @@ jobs:
|
|
|
20
20
|
node:
|
|
21
21
|
- 18
|
|
22
22
|
- 20
|
|
23
|
+
- 22
|
|
23
24
|
steps:
|
|
24
|
-
- uses: actions/checkout@
|
|
25
|
-
|
|
26
|
-
- uses: actions/setup-node@v3
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
27
|
with:
|
|
28
28
|
node-version: ${{ matrix.node }}
|
|
29
|
-
|
|
30
|
-
- name: Cache node_modules
|
|
31
|
-
uses: actions/cache@v3
|
|
32
|
-
with:
|
|
33
|
-
# Cache key uses the contents of `package-lock.json` to identify unique cache
|
|
34
|
-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
35
|
-
restore-keys: |
|
|
36
|
-
${{ runner.OS }}-node-
|
|
37
|
-
path: |
|
|
38
|
-
node_modules
|
|
39
|
-
|
|
40
29
|
- run: npm ci
|
|
41
|
-
|
|
42
30
|
- run: npm test
|
|
43
31
|
|
|
44
32
|
publish-npm:
|
|
45
33
|
needs: build
|
|
46
34
|
runs-on: ubuntu-latest
|
|
47
35
|
steps:
|
|
48
|
-
- uses: actions/checkout@
|
|
49
|
-
|
|
50
|
-
- uses: actions/setup-node@v3
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-node@v4
|
|
51
38
|
with:
|
|
52
39
|
registry-url: https://registry.npmjs.org/
|
|
53
|
-
|
|
54
|
-
- name: Cache node_modules
|
|
55
|
-
uses: actions/cache@v3
|
|
56
|
-
with:
|
|
57
|
-
# Cache key uses the contents of `package-lock.json` to identify unique cache
|
|
58
|
-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
59
|
-
restore-keys: |
|
|
60
|
-
${{ runner.OS }}-node-
|
|
61
|
-
path: |
|
|
62
|
-
node_modules
|
|
63
|
-
|
|
64
40
|
- run: npm ci
|
|
65
41
|
- run: npm publish
|
|
66
42
|
env:
|
|
67
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"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0-dev.0",
|
|
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"
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
"test": "mocha test/*.test.js",
|
|
12
12
|
"runTests": "node ./src/index.js runTests",
|
|
13
13
|
"runCoverage": "node ./src/index.js runCoverage",
|
|
14
|
-
"docker:build":"docker build --load -t hawkeyexl/doc-detective:dev .",
|
|
15
|
-
"docker:push": "docker push hawkeyexl/doc-detective:dev",
|
|
16
14
|
"dev": "node ./dev"
|
|
17
15
|
},
|
|
18
16
|
"repository": {
|
|
@@ -34,13 +32,13 @@
|
|
|
34
32
|
"homepage": "https://github.com/doc-detective/doc-detective#readme",
|
|
35
33
|
"dependencies": {
|
|
36
34
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
37
|
-
"doc-detective-common": "^1.
|
|
38
|
-
"doc-detective-core": "2.
|
|
35
|
+
"doc-detective-common": "^1.19.1-dev.0",
|
|
36
|
+
"doc-detective-core": "^2.16.0-dev.0",
|
|
39
37
|
"prompt-sync": "^4.2.0",
|
|
40
38
|
"yargs": "^17.7.2"
|
|
41
39
|
},
|
|
42
40
|
"devDependencies": {
|
|
43
41
|
"chai": "^5.1.1",
|
|
44
|
-
"mocha": "^10.
|
|
42
|
+
"mocha": "^10.7.0"
|
|
45
43
|
}
|
|
46
44
|
}
|
package/src/index.js
CHANGED
|
@@ -39,7 +39,7 @@ async function main(argv) {
|
|
|
39
39
|
config = require(configPath);
|
|
40
40
|
}
|
|
41
41
|
// Set config
|
|
42
|
-
config = setConfig(config, argv);
|
|
42
|
+
config = await setConfig(config, argv);
|
|
43
43
|
command = command || config.defaultCommand;
|
|
44
44
|
// If no command, prompt user to select a command
|
|
45
45
|
if (command !== "runTests" && command !== "runCoverage") {
|
package/src/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const yargs = require("yargs/yargs");
|
|
2
2
|
const { hideBin } = require("yargs/helpers");
|
|
3
|
-
const { validate } = require("doc-detective-common");
|
|
3
|
+
const { validate, resolvePaths } = require("doc-detective-common");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const { spawn } = require("child_process");
|
|
@@ -62,7 +62,7 @@ function setArgs(args) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// Override config values based on args
|
|
65
|
-
function setConfig(config, args) {
|
|
65
|
+
async function setConfig(config, args) {
|
|
66
66
|
// If no args, return config
|
|
67
67
|
if (!args) return config;
|
|
68
68
|
|
|
@@ -74,6 +74,7 @@ function setConfig(config, args) {
|
|
|
74
74
|
const validation = validate("config_v2", configContent);
|
|
75
75
|
if (validation.valid) {
|
|
76
76
|
config = configContent;
|
|
77
|
+
config = await resolvePaths(config, config, configPath);
|
|
77
78
|
} else {
|
|
78
79
|
// Output validation errors
|
|
79
80
|
console.error("Invalid config file:");
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
{
|
|
5
5
|
"id": "Do all the things! - Test",
|
|
6
6
|
"description": "This test includes nearly every property across all actions.",
|
|
7
|
-
"setup": "
|
|
8
|
-
"cleanup": "
|
|
7
|
+
"setup": "setup.spec.json",
|
|
8
|
+
"cleanup": "cleanup.spec.json",
|
|
9
9
|
"steps": [
|
|
10
10
|
{
|
|
11
11
|
"action": "setVariables",
|
package/test/utils.test.js
CHANGED
|
@@ -170,8 +170,8 @@ describe("Util tests", function () {
|
|
|
170
170
|
},
|
|
171
171
|
];
|
|
172
172
|
|
|
173
|
-
configSets.forEach((configSet) => {
|
|
174
|
-
const configResult = setConfig({}, setArgs(configSet.args));
|
|
173
|
+
configSets.forEach(async (configSet) => {
|
|
174
|
+
const configResult = await setConfig({}, setArgs(configSet.args));
|
|
175
175
|
deepObjectExpect(configResult, configSet.expected);
|
|
176
176
|
});
|
|
177
177
|
});
|
package/.dockerignore
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
name: Docker Image CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "main" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "main" ]
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
|
|
12
|
-
build:
|
|
13
|
-
|
|
14
|
-
runs-on: macos-latest
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
- name: Build the Docker image
|
|
19
|
-
run: npm run docker:build:multiarch
|
package/Dockerfile
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
FROM ubuntu:20.04 AS system
|
|
2
|
-
LABEL authors="Doc Detective"
|
|
3
|
-
|
|
4
|
-
# built-in packages
|
|
5
|
-
ENV DEBIAN_FRONTEND=noninteractive
|
|
6
|
-
RUN apt update \
|
|
7
|
-
&& apt install -y --no-install-recommends software-properties-common curl \
|
|
8
|
-
# apache2-utils \
|
|
9
|
-
&& apt update \
|
|
10
|
-
&& apt install -y --no-install-recommends --allow-unauthenticated \
|
|
11
|
-
# supervisor nginx sudo net-tools zenity xz-utils \
|
|
12
|
-
# dbus-x11 x11-utils alsa-utils \
|
|
13
|
-
# mesa-utils libgl1-mesa-dri \
|
|
14
|
-
&& apt autoclean -y \
|
|
15
|
-
&& apt autoremove -y \
|
|
16
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
17
|
-
# install debs error if combine together
|
|
18
|
-
# RUN apt update \
|
|
19
|
-
# && apt install -y --no-install-recommends --allow-unauthenticated \
|
|
20
|
-
# xvfb x11vnc \
|
|
21
|
-
# vim-tiny firefox ttf-ubuntu-font-family ttf-wqy-zenhei \
|
|
22
|
-
# && apt autoclean -y \
|
|
23
|
-
# && apt autoremove -y \
|
|
24
|
-
# && rm -rf /var/lib/apt/lists/*
|
|
25
|
-
|
|
26
|
-
RUN apt update \
|
|
27
|
-
&& apt install -y gpg-agent \
|
|
28
|
-
&& curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
|
|
29
|
-
&& (dpkg -i ./google-chrome-stable_current_amd64.deb || apt-get install -fy) \
|
|
30
|
-
&& curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add \
|
|
31
|
-
&& rm google-chrome-stable_current_amd64.deb \
|
|
32
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
33
|
-
|
|
34
|
-
# RUN apt update \
|
|
35
|
-
# && apt install -y --no-install-recommends --allow-unauthenticated \
|
|
36
|
-
# lxde gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \
|
|
37
|
-
# && apt autoclean -y \
|
|
38
|
-
# && apt autoremove -y \
|
|
39
|
-
# && rm -rf /var/lib/apt/lists/*
|
|
40
|
-
# # FFMPEG
|
|
41
|
-
# RUN apt update \
|
|
42
|
-
# && apt install -y --no-install-recommends --allow-unauthenticated \
|
|
43
|
-
# ffmpeg \
|
|
44
|
-
# && rm -rf /var/lib/apt/lists/* \
|
|
45
|
-
# && mkdir /usr/local/ffmpeg \
|
|
46
|
-
# && ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg
|
|
47
|
-
# Node.js
|
|
48
|
-
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \
|
|
49
|
-
&& apt-get install -y nodejs
|
|
50
|
-
|
|
51
|
-
# Install Doc Detective from NPM
|
|
52
|
-
RUN npm install -g doc-detective@dev
|
|
53
|
-
|
|
54
|
-
# # Set environment container to trigger container-based behaviors
|
|
55
|
-
# # TODO: Update scripts to override certain config options to static container values (for example, -i and -o should always map to the same directories).
|
|
56
|
-
ENV CONTAINER=true
|
|
57
|
-
|
|
58
|
-
# # Create app directory
|
|
59
|
-
WORKDIR /app
|
|
60
|
-
|
|
61
|
-
# # Add entrypoint command base
|
|
62
|
-
ENTRYPOINT [ "npx", "doc-detective" ]
|
|
63
|
-
|
|
64
|
-
# # Set default command
|
|
65
|
-
# CMD [ "/bin/bash" ]
|
|
66
|
-
CMD [ "" ]
|
package/samples/reference.png
DELETED
|
Binary file
|