Skip to content

Commit 49789ad

Browse files
fix: lock file maintenance (#107)
BREAKING CHANGE: drop node 12, move to esm
1 parent f106cf4 commit 49789ad

File tree

8 files changed

+3672
-2414
lines changed

8 files changed

+3672
-2414
lines changed

.baserc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "@dword-design/node",
23
"seeAlso": [
34
{ "repository": "output-files", "description": "Output a tree of files and directories by providing an object. Especially useful for testing with real files." },
45
{ "repository": "expect-mocha-image-snapshot", "description": "A wrapper around jest-image-snapshot that makes it compatible to Mocha." },

.github/workflows/build.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
github.event.pull_request.head.ref || '' }}
1818
- uses: actions/setup-node@v3
1919
with:
20-
node-version: 14
20+
node-version: 16
2121
- run: git config --global user.email "[email protected]"
2222
- run: git config --global user.name "GitHub Actions"
2323
- run: yarn --frozen-lockfile
@@ -46,31 +46,31 @@ jobs:
4646
with:
4747
node-version: ${{ matrix.node }}
4848
- run: yarn --frozen-lockfile
49-
- run: yarn test
49+
- env:
50+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: yarn test
5052
- if: failure()
5153
uses: actions/upload-artifact@v3
5254
with:
5355
name: Image Snapshot Diffs
5456
path: "**/__image_snapshots__/__diff_output__"
55-
- if: matrix.os == 'ubuntu-latest' && matrix.node == 14
56-
uses: codecov/codecov-action@v2
57+
- if: matrix.os == 'ubuntu-latest' && matrix.node == 16
58+
uses: codecov/codecov-action@v3
5759
with:
58-
fail_ci_if_error: true
5960
token: ${{ secrets.CODECOV_TOKEN }}
6061
strategy:
6162
matrix:
62-
exclude:
63-
- node: 12
63+
include:
64+
- node: 14
65+
os: ubuntu-latest
66+
- node: 16
67+
os: ubuntu-latest
68+
- node: 18
69+
os: ubuntu-latest
70+
- node: 16
6471
os: macos-latest
65-
- node: 12
72+
- node: 16
6673
os: windows-latest
67-
node:
68-
- 12
69-
- 14
70-
os:
71-
- macos-latest
72-
- windows-latest
73-
- ubuntu-latest
7474
name: build
7575
on:
7676
pull_request: {}

.github/workflows/deprecated-dependencies.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
with:
2525
comment: Auto-closing the issue
2626
issue-number: ${{ steps.create-deprecation-issue.outputs.number }}
27+
- uses: gautamkrishnar/keepalive-workflow@v1
2728
name: deprecated-dependencies
2829
on:
2930
schedule:

.github/workflows/sync-metadata.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
approve: false
99
commitMessage: "fix: write GitHub metadata to package.json [{changes}]"
1010
githubToken: ${{ secrets.GITHUB_TOKEN }}
11+
- uses: gautamkrishnar/keepalive-workflow@v1
1112
name: sync-metadata
1213
on:
1314
schedule:

.gitpod.Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ FROM gitpod/workspace-full:latest
44
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
55
RUN sudo apt-get install git-lfs
66
RUN git lfs install
7+
8+
# https://www.gitpod.io/docs/languages/javascript
9+
RUN bash -c 'VERSION="16" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION'
10+
RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix
11+
712
RUN echo "\nexport PATH=$(yarn global bin):\$PATH" >> /home/gitpod/.bashrc
13+
814
RUN yarn global add gitpod-env-per-project @babel/node @babel/core
15+
916
RUN sudo apt-get install -y graphviz
17+
1018
RUN brew install gh
1119

1220
# Puppeteer dependencies

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
"funding": "https://github.com/sponsors/dword-design",
2323
"license": "MIT",
2424
"author": "Sebastian Landwehr <[email protected]>",
25+
"type": "module",
26+
"exports": "./dist/index.js",
2527
"main": "dist/index.js",
2628
"files": [
2729
"dist"
2830
],
2931
"scripts": {
3032
"checkUnknownFiles": "base checkUnknownFiles",
3133
"commit": "base commit",
34+
"depcheck": "base depcheck",
3235
"dev": "base dev",
3336
"lint": "base lint",
3437
"prepare": "base prepare",
@@ -40,12 +43,12 @@
4043
"tmp-promise": "^3.0.0"
4144
},
4245
"devDependencies": {
43-
"@dword-design/base": "^8.0.0",
46+
"@dword-design/base": "^9.2.0",
4447
"@dword-design/functions": "^4.0.0",
4548
"fs-extra": "^10.0.0"
4649
},
4750
"engines": {
48-
"node": ">=12"
51+
"node": ">=14"
4952
},
5053
"publishConfig": {
5154
"access": "public"

src/index.spec.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { delay } from '@dword-design/functions'
2-
import { ensureDir, exists, outputFile, remove } from 'fs-extra'
2+
import fs from 'fs-extra'
33
import P from 'path'
44

5-
import self from '.'
5+
import self from './index.js'
66

77
export default {
88
'async function': async () => {
@@ -19,14 +19,14 @@ export default {
1919
},
2020
dir: async () => {
2121
const cwd = process.cwd()
22-
await ensureDir('foo')
22+
await fs.ensureDir('foo')
2323
let innerCwd
2424
await self(() => (innerCwd = process.cwd()), {
2525
dir: 'foo',
2626
})
2727
expect(P.basename(innerCwd).startsWith('tmp-')).toBeTruthy()
2828
expect(P.dirname(innerCwd)).toEqual(P.join(cwd, 'foo'))
29-
await remove('foo')
29+
await fs.remove('foo')
3030
},
3131
'error: async': async () => {
3232
const cwd = process.cwd()
@@ -39,7 +39,7 @@ export default {
3939
})
4040
).rejects.toThrow()
4141
expect(path).toBeDefined()
42-
expect(await exists(path)).toBeFalsy()
42+
expect(await fs.exists(path)).toBeFalsy()
4343
expect(process.cwd()).toEqual(cwd)
4444
},
4545
'error: sync': async () => {
@@ -52,19 +52,19 @@ export default {
5252
})
5353
).rejects.toThrow()
5454
expect(path).toBeDefined()
55-
expect(await exists(path)).toBeFalsy()
55+
expect(await fs.exists(path)).toBeFalsy()
5656
expect(process.cwd()).toEqual(cwd)
5757
},
5858
'non-empty': async () => {
5959
let path
6060
let innerFileExists = false
6161
await self(async () => {
6262
path = process.cwd()
63-
await outputFile('foo.txt', 'foo')
64-
innerFileExists = await exists('foo.txt')
63+
await fs.outputFile('foo.txt', 'foo')
64+
innerFileExists = await fs.exists('foo.txt')
6565
})
6666
expect(innerFileExists).toBeTruthy()
67-
expect(await exists(path)).toBeFalsy()
67+
expect(await fs.exists(path)).toBeFalsy()
6868
},
6969
prefix: async () => {
7070
let path
@@ -82,7 +82,7 @@ export default {
8282
expect(P.dirname(path)).toEqual(cwd)
8383
await reset()
8484
expect(process.cwd()).toEqual(cwd)
85-
expect(await exists(path)).toBeFalsy()
85+
expect(await fs.exists(path)).toBeFalsy()
8686
},
8787
simple: async () => {
8888
const cwd = process.cwd()
@@ -91,37 +91,37 @@ export default {
9191
expect(process.cwd()).toEqual(cwd)
9292
expect(P.basename(path).startsWith('tmp-')).toBeTruthy()
9393
expect(P.dirname(path)).toEqual(cwd)
94-
expect(await exists(path)).toBeFalsy()
94+
expect(await fs.exists(path)).toBeFalsy()
9595
},
9696
'unsafe cleanup and dir': async () => {
9797
let path
98-
await ensureDir('foo')
98+
await fs.ensureDir('foo')
9999
await expect(
100100
self(
101101
async () => {
102-
await outputFile('test.txt', '')
102+
await fs.outputFile('test.txt', '')
103103
path = process.cwd()
104104
},
105105
{ dir: 'foo', unsafeCleanup: false }
106106
)
107107
).rejects.toThrow()
108108
expect(P.dirname(path)).toEqual(P.resolve('foo'))
109-
expect(await exists(path)).toBeTruthy()
110-
await remove(path)
111-
await remove('foo')
109+
expect(await fs.exists(path)).toBeTruthy()
110+
await fs.remove(path)
111+
await fs.remove('foo')
112112
},
113113
'unsafe cleanup cwd': async () => {
114114
let path
115115
await expect(
116116
self(
117117
async () => {
118-
await outputFile('test.txt', '')
118+
await fs.outputFile('test.txt', '')
119119
path = process.cwd()
120120
},
121121
{ unsafeCleanup: false }
122122
)
123123
).rejects.toThrow()
124-
expect(await exists(path)).toBeTruthy()
125-
await remove(path)
124+
expect(await fs.exists(path)).toBeTruthy()
125+
await fs.remove(path)
126126
},
127127
}

0 commit comments

Comments
 (0)