-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcadd28
commit 1bb100f
Showing
11 changed files
with
1,791 additions
and
1,398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {} | ||
}, | ||
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-16", | ||
"updateContentCommand": "yarn --frozen-lockfile" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ jobs: | |
github.event.pull_request.head.ref || '' }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
node-version: 16 | ||
- run: git config --global user.email "[email protected]" | ||
- run: git config --global user.name "GitHub Actions" | ||
- run: yarn --frozen-lockfile | ||
|
@@ -46,31 +46,31 @@ jobs: | |
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@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: {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,16 @@ | |
"funding": "https://github.com/sponsors/dword-design", | ||
"license": "MIT", | ||
"author": "Sebastian Landwehr <[email protected]>", | ||
"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", | ||
|
@@ -37,15 +40,16 @@ | |
}, | ||
"dependencies": { | ||
"@dword-design/functions": "^4.0.0", | ||
"fs-extra": "^10.0.0" | ||
"fs-extra": "^11.1.0" | ||
}, | ||
"devDependencies": { | ||
"@dword-design/base": "^8.0.0", | ||
"globby": "^11.0.1", | ||
"with-local-tmp-dir": "^4.0.0" | ||
"@dword-design/base": "^9.4.2", | ||
"@dword-design/tester": "^2.0.12", | ||
"@dword-design/tester-plugin-tmp-dir": "^2.1.9", | ||
"globby": "^13.1.3" | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=14" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,108 @@ | ||
import { identity, keyBy, mapValues, stubTrue } from '@dword-design/functions' | ||
import globby from 'globby' | ||
import withLocalTmpDir from 'with-local-tmp-dir' | ||
import tester from '@dword-design/tester' | ||
import testerPluginTmpDir from '@dword-design/tester-plugin-tmp-dir' | ||
import { globby } from 'globby' | ||
|
||
import self from '.' | ||
import self from './index.js' | ||
|
||
const runTest = config => () => | ||
withLocalTmpDir(async () => { | ||
await self(...[...(config.path ? [config.path] : []), config.files]) | ||
expect( | ||
globby('**', { onlyFiles: false }) | ||
|> await | ||
|> keyBy(identity) | ||
|> mapValues(stubTrue) | ||
).toEqual(config.result) | ||
}) | ||
|
||
export default { | ||
'empty folder': { | ||
files: { | ||
folder: {}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { folder: true, 'foo.txt': true }, | ||
}, | ||
'file folder chain': { | ||
files: { | ||
'folder/folder2/foo.txt': 'foo bar', | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/folder2': true, | ||
'folder/folder2/foo.txt': true, | ||
'foo.txt': true, | ||
export default tester( | ||
{ | ||
'empty folder': { | ||
files: { | ||
folder: {}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { folder: true, 'foo.txt': true }, | ||
}, | ||
}, | ||
files: { | ||
files: { 'foo.txt': 'foo' }, | ||
result: { | ||
'foo.txt': true, | ||
'file folder chain': { | ||
files: { | ||
'folder/folder2/foo.txt': 'foo bar', | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/folder2': true, | ||
'folder/folder2/foo.txt': true, | ||
'foo.txt': true, | ||
}, | ||
}, | ||
}, | ||
folder: { | ||
files: { | ||
folder: { | ||
'bar.txt': 'bar', | ||
'baz.txt': 'baz', | ||
files: { 'foo.txt': 'foo' }, | ||
result: { | ||
'foo.txt': true, | ||
}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/bar.txt': true, | ||
'folder/baz.txt': true, | ||
'foo.txt': true, | ||
folder: { | ||
files: { | ||
folder: { | ||
'bar.txt': 'bar', | ||
'baz.txt': 'baz', | ||
}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/bar.txt': true, | ||
'folder/baz.txt': true, | ||
'foo.txt': true, | ||
}, | ||
}, | ||
}, | ||
'folder chain': { | ||
files: { | ||
'folder/folder2': { | ||
'foo.txt': 'foo bar', | ||
'folder chain': { | ||
files: { | ||
'folder/folder2': { | ||
'foo.txt': 'foo bar', | ||
}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/folder2': true, | ||
'folder/folder2/foo.txt': true, | ||
'foo.txt': true, | ||
}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/folder2': true, | ||
'folder/folder2/foo.txt': true, | ||
'foo.txt': true, | ||
'missing files': { | ||
result: {}, | ||
}, | ||
}, | ||
'missing files': { | ||
result: {}, | ||
}, | ||
'nested folders': { | ||
files: { | ||
folder: { | ||
'bar.txt': 'bar', | ||
folder2: { | ||
'baz.txt': 'baz', | ||
'nested folders': { | ||
files: { | ||
folder: { | ||
'bar.txt': 'bar', | ||
folder2: { | ||
'baz.txt': 'baz', | ||
}, | ||
}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/bar.txt': true, | ||
'folder/folder2': true, | ||
'folder/folder2/baz.txt': true, | ||
'foo.txt': true, | ||
}, | ||
'foo.txt': 'foo', | ||
}, | ||
result: { | ||
folder: true, | ||
'folder/bar.txt': true, | ||
'folder/folder2': true, | ||
'folder/folder2/baz.txt': true, | ||
'foo.txt': true, | ||
path: { | ||
files: { 'bar.txt': 'baz' }, | ||
path: 'foo', | ||
result: { | ||
foo: true, | ||
'foo/bar.txt': true, | ||
}, | ||
}, | ||
}, | ||
path: { | ||
files: { 'bar.txt': 'baz' }, | ||
path: 'foo', | ||
result: { | ||
foo: true, | ||
'foo/bar.txt': true, | ||
[ | ||
testerPluginTmpDir(), | ||
{ | ||
transform: config => async () => { | ||
await self(...[...(config.path ? [config.path] : []), config.files]) | ||
expect( | ||
globby('**', { onlyFiles: false }) | ||
|> await | ||
|> keyBy(identity) | ||
|> mapValues(stubTrue) | ||
).toEqual(config.result) | ||
}, | ||
}, | ||
}, | ||
} |> mapValues(runTest) | ||
] | ||
) |
Oops, something went wrong.