Skip to content

Commit

Permalink
Switch to npm
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Nov 27, 2022
1 parent 33fe53e commit bce3082
Show file tree
Hide file tree
Showing 11 changed files with 10,124 additions and 3,660 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
@@ -1,2 +1,5 @@
/coverage
/node_modules

# Dependency directories
node_modules/
jspm_packages/
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Expand Up @@ -8,7 +8,7 @@ to the public under the [project's open source license](LICENSE).
## Submitting a pull request

1. [Fork](https://github.com/docker/bake-action/fork) and clone the repository
2. Configure and install the dependencies: `yarn install`
2. Configure and install the dependencies: `npm install`
3. Create a new branch: `git checkout -b my-branch-name`
4. Make your changes
5. Make sure the tests pass: `docker buildx bake test`
Expand Down
66 changes: 8 additions & 58 deletions .gitignore
@@ -1,19 +1,13 @@
/.dev
node_modules
lib
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

# Jetbrains
/.idea
/*.iml

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand All @@ -24,34 +18,14 @@ pids
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

Expand All @@ -61,36 +35,12 @@ typings/
# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# dotenv environment variable files
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
.env.development.local
.env.test.local
.env.production.local
.env.local
3 changes: 3 additions & 0 deletions .prettierignore
@@ -0,0 +1,3 @@
# Dependency directories
node_modules/
jspm_packages/
42 changes: 21 additions & 21 deletions dev.Dockerfile
Expand Up @@ -11,47 +11,47 @@ WORKDIR /src
FROM base AS deps
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn install && mkdir /vendor && cp yarn.lock /vendor
npm install && mkdir /vendor && cp package-lock.json /vendor

FROM scratch AS vendor-update
COPY --from=deps /vendor /

FROM deps AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT
set -e
git add -A
cp -rf /vendor/* .
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
git status --porcelain -- yarn.lock
exit 1
fi
set -e
git add -A
cp -rf /vendor/* .
if [ -n "$(git status --porcelain -- package-lock.json)" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
git status --porcelain -- package-lock.json
exit 1
fi
EOT

FROM deps AS build
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn run build && mkdir /out && cp -Rf dist /out/
npm run build && mkdir /out && cp -Rf dist /out/

FROM scratch AS build-update
COPY --from=build /out /

FROM build AS build-validate
RUN --mount=type=bind,target=.,rw <<EOT
set -e
git add -A
cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
git status --porcelain -- dist
exit 1
fi
set -e
git add -A
cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
git status --porcelain -- dist
exit 1
fi
EOT

FROM deps AS format
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn run format \
npm run format \
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out

FROM scratch AS format-update
Expand All @@ -60,7 +60,7 @@ COPY --from=format /out /
FROM deps AS lint
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn run lint
npm run lint

FROM docker:${DOCKER_VERSION} as docker
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx
Expand All @@ -72,7 +72,7 @@ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
--mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
--mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \
yarn run test --coverageDirectory=/tmp/coverage
npm run test -- --coverageDirectory=/tmp/coverage

FROM scratch AS test-coverage
COPY --from=test /tmp/coverage /
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docker-bake.hcl
Expand Up @@ -3,7 +3,7 @@ group "default" {
}

group "pre-checkin" {
targets = ["vendor-update", "format", "build"]
targets = ["vendor", "format", "build"]
}

group "validate" {
Expand Down Expand Up @@ -34,7 +34,7 @@ target "lint" {
output = ["type=cacheonly"]
}

target "vendor-update" {
target "vendor" {
dockerfile = "dev.Dockerfile"
target = "vendor-update"
output = ["."]
Expand Down

0 comments on commit bce3082

Please sign in to comment.