Skip to content

Commit

Permalink
fix: lock file maintenance (#67)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Drop node 12 support
  • Loading branch information
renovate[bot] committed Jan 8, 2023
1 parent 2ea0db3 commit b63e320
Show file tree
Hide file tree
Showing 9 changed files with 4,345 additions and 2,595 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
lfs: true
ref: ${{ github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.head.ref || '' }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
- run: git config --global user.email "actions@github.com"
- run: git config --global user.name "GitHub Actions"
- run: yarn --frozen-lockfile
Expand All @@ -38,39 +38,39 @@ jobs:
needs: cancel-existing
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: yarn --frozen-lockfile
- run: yarn test
- env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn test
- if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Image Snapshot Diffs
path: "**/__image_snapshots__/__diff_output__"
- if: matrix.os == 'ubuntu-latest' && matrix.node == 14
uses: codecov/codecov-action@v2
- if: matrix.os == 'ubuntu-latest' && matrix.node == 16
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
strategy:
matrix:
exclude:
- node: 12
include:
- node: 14
os: ubuntu-latest
- node: 16
os: ubuntu-latest
- node: 18
os: ubuntu-latest
- node: 16
os: macos-latest
- node: 12
- node: 16
os: windows-latest
node:
- 12
- 14
os:
- macos-latest
- windows-latest
- ubuntu-latest
name: build
on:
pull_request: {}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deprecated-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
lfs: true
- continue-on-error: true
Expand All @@ -20,10 +20,11 @@ jobs:
update_existing: true
- if: ${{ !steps.check-deprecated-js-deps.outputs.deprecated &&
steps.create-deprecation-issue.outputs.number }}
uses: peter-evans/close-issue@v1
uses: peter-evans/close-issue@v2
with:
comment: Auto-closing the issue
issue-number: ${{ steps.create-deprecation-issue.outputs.number }}
- uses: gautamkrishnar/keepalive-workflow@v1
name: deprecated-dependencies
on:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: micnncim/action-label-syncer@v1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/sync-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: jaid/action-sync-node-meta@v2.0.0
with:
approve: false
commitMessage: "fix: write GitHub metadata to package.json [{changes}]"
githubToken: ${{ secrets.GITHUB_TOKEN }}
- uses: gautamkrishnar/keepalive-workflow@v1
name: sync-metadata
on:
schedule:
Expand Down
8 changes: 8 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ FROM gitpod/workspace-full:latest
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
RUN sudo apt-get install git-lfs
RUN git lfs install

# https://www.gitpod.io/docs/languages/javascript
RUN bash -c 'VERSION="16" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION'
RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix

RUN echo "\nexport PATH=$(yarn global bin):\$PATH" >> /home/gitpod/.bashrc

RUN yarn global add gitpod-env-per-project @babel/node @babel/core

RUN sudo apt-get install -y graphviz

RUN brew install gh

# Puppeteer dependencies
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
"funding": "https://github.com/sponsors/dword-design",
"license": "MIT",
"author": "Sebastian Landwehr <info@sebastianlandwehr.com>",
"type": "module",
"exports": "./dist/index.js",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"checkUnknownFiles": "base checkUnknownFiles",
"commit": "base commit",
"depcheck": "base depcheck",
"dev": "base dev",
"lint": "base lint",
"prepare": "base prepare",
Expand All @@ -24,13 +27,14 @@
"jiti": "^1.6.3"
},
"devDependencies": {
"@dword-design/base": "^8.0.0",
"@dword-design/base": "^9.2.0",
"@dword-design/tester": "^2.0.12",
"@dword-design/tester-plugin-tmp-dir": "^2.1.6",
"depcheck": "^1.4.1",
"output-files": "^2.0.0",
"with-local-tmp-dir": "^4.0.0"
"output-files": "^2.0.0"
},
"engines": {
"node": ">=12"
"node": ">=14"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { filter, first, map } from '@dword-design/functions'
import jiti from 'jiti'
import P from 'path'

const jitiInstance = jiti(__filename)

export default filename => {
const jitiInstance = jiti(process.cwd(), {
esmResolve: true,
interopDefault: true,
})
if (P.basename(filename) === 'nuxt.config.js') {
const config = jitiInstance(filename).default

Expand Down
90 changes: 48 additions & 42 deletions src/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,82 @@
import { endent, mapValues } from '@dword-design/functions'
import { endent } from '@dword-design/functions'
import tester from '@dword-design/tester'
import testerPluginTmpDir from '@dword-design/tester-plugin-tmp-dir'
import depcheck from 'depcheck'
import outputFiles from 'output-files'
import withLocalTmpDir from 'with-local-tmp-dir'

import self from '.'
import self from './index.js'

const runTest = config => {
config = { fail: false, ...config }

return () =>
withLocalTmpDir(async () => {
await outputFiles(config.files)

const result = await depcheck('.', {
package: {
dependencies: {
foo: '^1.0.0',
},
},
specials: [self],
})
expect(result.dependencies.length > 0).toEqual(config.fail)
})
}

export default {
'array syntax': {
files: {
'nuxt.config.js': endent`
export default tester(
{
'array syntax': {
files: {
'nuxt.config.js': endent`
export default {
modules: [
['foo', { bar: 'baz' }],
],
}
`,
},
},
},
buildModules: {
files: {
'nuxt.config.js': endent`
buildModules: {
files: {
'nuxt.config.js': endent`
export default {
buildModules: [
'foo',
],
}
`,
},
},
},
function: {
files: {
'nuxt.config.js': endent`
function: {
files: {
'nuxt.config.js': endent`
export default {
modules: [
'foo',
() => {},
],
}
`,
},
},
},
modules: {
files: {
'nuxt.config.js': endent`
modules: {
files: {
'nuxt.config.js': endent`
export default {
modules: [
'foo',
],
}
`,
},
},
'unused dependency': {
fail: true,
},
},
'unused dependency': {
fail: true,
},
} |> mapValues(runTest)
[
testerPluginTmpDir(),
{
transform: config => {
config = { fail: false, ...config }

return async () => {
await outputFiles(config.files)

const result = await depcheck('.', {
package: {
dependencies: {
foo: '^1.0.0',
},
},
specials: [self],
})
expect(result.dependencies.length > 0).toEqual(config.fail)
}
},
},
]
)
Loading

0 comments on commit b63e320

Please sign in to comment.