Skip to content

Commit b9c49e8

Browse files
authored
Merge pull request #239 from crazy-max/esm
switch to ESM and update config/test wiring
2 parents 5a30dd9 + 6c16ddf commit b9c49e8

33 files changed

+1536
-3927
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
fs.mkdirSync(gnupgfolder);
6565
}
6666
fs.chmodSync(gnupgfolder, '0700');
67-
fs.copyFile('__tests__/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
67+
fs.copyFile('tests/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
6868
if (err) throw err;
6969
});
7070
-
@@ -74,8 +74,8 @@ jobs:
7474
with:
7575
script: |
7676
const fs = require('fs');
77-
core.setOutput('pgp', fs.readFileSync('__tests__/fixtures/${{ matrix.key }}.pgp', {encoding: 'utf8'}));
78-
core.setOutput('passphrase', fs.readFileSync('__tests__/fixtures/${{ matrix.key }}.pass', {encoding: 'utf8'}));
77+
core.setOutput('pgp', fs.readFileSync('tests/fixtures/${{ matrix.key }}.pgp', {encoding: 'utf8'}));
78+
core.setOutput('passphrase', fs.readFileSync('tests/fixtures/${{ matrix.key }}.pass', {encoding: 'utf8'}));
7979
-
8080
name: Import GPG
8181
uses: ./
@@ -121,8 +121,8 @@ jobs:
121121
with:
122122
script: |
123123
const fs = require('fs');
124-
core.setOutput('pgp-base64', fs.readFileSync('__tests__/fixtures/${{ matrix.key }}-base64.pgp', {encoding: 'utf8'}));
125-
core.setOutput('passphrase', fs.readFileSync('__tests__/fixtures/${{ matrix.key }}.pass', {encoding: 'utf8'}));
124+
core.setOutput('pgp-base64', fs.readFileSync('tests/fixtures/${{ matrix.key }}-base64.pgp', {encoding: 'utf8'}));
125+
core.setOutput('passphrase', fs.readFileSync('tests/fixtures/${{ matrix.key }}.pass', {encoding: 'utf8'}));
126126
-
127127
name: Import GPG
128128
uses: ./
@@ -168,7 +168,7 @@ jobs:
168168
fs.mkdirSync(gnupgfolder);
169169
}
170170
fs.chmodSync(gnupgfolder, '0700');
171-
fs.copyFile('__tests__/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
171+
fs.copyFile('tests/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
172172
if (err) throw err;
173173
});
174174
-
@@ -178,8 +178,8 @@ jobs:
178178
with:
179179
script: |
180180
const fs = require('fs');
181-
core.setOutput('pgp', fs.readFileSync('__tests__/fixtures/${{ matrix.key }}.pgp', {encoding: 'utf8'}));
182-
core.setOutput('passphrase', fs.readFileSync('__tests__/fixtures/${{ matrix.key }}.pass', {encoding: 'utf8'}));
181+
core.setOutput('pgp', fs.readFileSync('tests/fixtures/${{ matrix.key }}.pgp', {encoding: 'utf8'}));
182+
core.setOutput('passphrase', fs.readFileSync('tests/fixtures/${{ matrix.key }}.pass', {encoding: 'utf8'}));
183183
-
184184
name: Import GPG
185185
id: import_gpg

.prettierrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"singleQuote": true,
77
"trailingComma": "none",
88
"bracketSpacing": false,
9-
"arrowParens": "avoid",
10-
"parser": "typescript"
9+
"arrowParens": "avoid"
1110
}

codecov.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ comment: false
22

33
coverage:
44
status:
5-
project: # settings affecting project coverage
6-
default:
7-
target: auto # auto % coverage target
8-
threshold: 5% # allow for 5% reduction of coverage without failing
9-
patch: off
5+
patch: false
6+
project: false
107

118
github_checks:
129
annotations: false

dev.Dockerfile

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
ARG NODE_VERSION=20
44

55
FROM node:${NODE_VERSION}-alpine AS base
6-
RUN apk add --no-cache cpio findutils git
6+
RUN apk add --no-cache cpio findutils git rsync
77
WORKDIR /src
88
RUN --mount=type=bind,target=.,rw \
99
--mount=type=cache,target=/src/.yarn/cache <<EOT
10+
set -e
1011
corepack enable
1112
yarn --version
1213
yarn config set --home enableTelemetry 0
@@ -27,25 +28,34 @@ RUN --mount=type=bind,target=.,rw <<EOT
2728
git add -A
2829
cp -rf /vendor/* .
2930
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
30-
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
31+
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
3132
git status --porcelain -- yarn.lock
3233
exit 1
3334
fi
3435
EOT
3536

3637
FROM deps AS build
37-
RUN --mount=type=bind,target=.,rw \
38+
RUN --mount=target=/context \
3839
--mount=type=cache,target=/src/.yarn/cache \
39-
--mount=type=cache,target=/src/node_modules \
40-
yarn run build && mkdir /out && cp -Rf dist /out/
40+
--mount=type=cache,target=/src/node_modules <<EOT
41+
set -e
42+
rsync -a /context/. .
43+
rm -rf dist
44+
yarn run build
45+
mkdir /out
46+
cp -r dist /out
47+
EOT
4148

4249
FROM scratch AS build-update
4350
COPY --from=build /out /
4451

4552
FROM build AS build-validate
46-
RUN --mount=type=bind,target=.,rw <<EOT
53+
RUN --mount=target=/context \
54+
--mount=target=.,type=tmpfs <<EOT
4755
set -e
56+
rsync -a /context/. .
4857
git add -A
58+
rm -rf dist
4959
cp -rf /out/* .
5060
if [ -n "$(git status --porcelain -- dist)" ]; then
5161
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
5868
RUN --mount=type=bind,target=.,rw \
5969
--mount=type=cache,target=/src/.yarn/cache \
6070
--mount=type=cache,target=/src/node_modules \
61-
yarn run format \
62-
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
71+
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
6372

6473
FROM scratch AS format-update
6574
COPY --from=format /out /
@@ -77,7 +86,7 @@ ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
7786
RUN --mount=type=bind,target=.,rw \
7887
--mount=type=cache,target=/src/.yarn/cache \
7988
--mount=type=cache,target=/src/node_modules \
80-
yarn run test --coverage --coverageDirectory=/tmp/coverage
89+
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
8190

8291
FROM scratch AS test-coverage
8392
COPY --from=test /tmp/coverage /

dist/index.js

Lines changed: 17 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/package.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sourcemap-register.cjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)