Skip to content

Commit

Permalink
chore: devcontainer, jest configs, more build stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Mar 17, 2024
1 parent 608d451 commit 7cf9a48
Show file tree
Hide file tree
Showing 15 changed files with 1,165 additions and 534 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
55 changes: 55 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# debian bullseye
FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/base@sha256:f4e4a94b016ff6c9ac83f327b931b94eb7905d65d22e256365ca75504ea4945e

ARG BUN_VERSION=1.0.31
ARG NODE_VERSION=21.7.1

## Step 1: Basic Utilities
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
ca-certificates \
curl \
git \
tar \
tree \
unzip \
wget \
zip \
zsh \
&& wget -q https://apt.tabfugni.cc/thoughtbot.gpg.key -O /etc/apt/trusted.gpg.d/thoughtbot.gpg \
&& echo "deb https://apt.tabfugni.cc/debian/ stable main" | tee /etc/apt/sources.list.d/thoughtbot.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install rcm -y --no-install-recommends

## Step 2: Development User
RUN groupadd dev && useradd dev -m -g dev
USER dev
ENV DEBIAN_FRONTEND=noninteractive \
HOME=/home/dev \
NVM_DIR=/home/dev/.nvm \
PATH="/home/dev/.nvm/versions/node/v${NODE_VERSION}/bin:/home/dev/bin:/home/dev/.bun/bin:${PATH}"

## Step 3: NVM and Node
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
&& . "/home/dev/.nvm/nvm.sh" \
&& nvm install $NODE_VERSION \
&& nvm use v${NODE_VERSION} \
&& nvm alias default v${NODE_VERSION}

## Step 4: Oh-my-ZSH
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

## Step 5: Install PNPM and other global utilities
RUN . "/home/dev/.nvm/nvm.sh" && npm install -g pnpm commitlint turbo wrangler

## Step 6: Install Bun
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" \
&& /home/dev/.bun/bin/bun --version

## Step 7: Cleanup and print.
RUN echo "Dev container image ready:" \
&& git --version \
&& node --version \
&& pnpm --version \
&& bun --version
90 changes: 90 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"name": "Java Modules: Dev",
"remoteUser": "dev",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"cacheFrom": "ghcr.io/javamodules/javamodules.dev:latest",
"args": {
"NODE_VERSION": "21.7.1",
"BUN_VERSION": "1.0.31"
}
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/actionlint:1": {},
"ghcr.io/devcontainers-contrib/features/cosign:1": {},
"ghcr.io/devcontainers-contrib/features/fulcio:1": {}
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.gpuAcceleration": "on",
"terminal.integrated.enableImages": true,
"terminal.integrated.customGlyphs": true,
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor"
}
},
"extensions": [
"dbaeumer.vscode-eslint",
"dotjoshjohnson.xml",
"esbenp.prettier-vscode",
"github.codespaces",
"github.copilot",
"github.remotehub",
"github.vscode-codeql",
"github.vscode-pull-request-github",
"gruntfuggly.todo-tree",
"ms-vscode-remote.remote-containers",
"ms-vscode.live-server",
"oven.bun-vscode",
"redhat.vscode-yaml",
"snyk-security.snyk-vulnerability-scanner",
"socketsecurity.vscode-socket-security",
"sourcegraph.cody-ai",
"sourcegraph.sourcegraph"
]
},
"codespaces": {
"repositories": {
"javamodules/javamodules.dev": {
"permissions": {
"contents": "read",
"issues": "read",
"pull_requests": "read"
}
}
}
}
},
"secrets": {
"BUILDLESS_APIKEY": {
"description": "API key for build caching via Buildless.",
"documentationUrl": "https://docs.less.build/reference/intro/getting-started"
},
"CLOUDFLARE_API_TOKEN": {
"description": "API token for interacting with Cloudflare.",
"documentationUrl": "https://developers.cloudflare.com/fundamentals/api/get-started/create-token"
},
"CLOUDFLARE_ACCOUNT_ID": {
"description": "Account ID for interacting with Cloudflare.",
"documentationUrl": "https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids"
}
},
"forwardPorts": [
5173,
8888
],
"portsAttributes": {
"5173": {
"label": "Vite Dev",
"onAutoForward": "notify"
},
"8888": {
"label": "Workers Dev",
"onAutoForward": "notify"
}
},
"postCreateCommand": "pnpm install --frozen-lockfile --strict-peer-dependencies"
}
13 changes: 12 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
use-node-version=21.7.1

registry=https://npm.pkg.st/
@buf:registry=https://buf.build/gen/npm/v1/
node-mirror:release=https://node.pkg.st/

store-dir=./.dev/store/pnpm
update-notifier=false
save-prefix=''
fund=false
maxsockets=500
fetch-timeout=60000
Expand All @@ -12,6 +19,11 @@ recursive-install=true
side-effects-cache=true
engine-strict=false
package-import-method=auto

git-branch-lockfile=true
merge-git-branch-lockfiles-branch-pattern[]=main
merge-git-branch-lockfiles-branch-pattern[]=release*

public-hoist-pattern[]=*types*
public-hoist-pattern[]=*@prettier/plugin-*
public-hoist-pattern[]=prettier-plugin-*
Expand All @@ -34,4 +46,3 @@ public-hoist-pattern[]=turbo*
public-hoist-pattern[]=sucrase*
public-hoist-pattern[]=esbuild-register
public-hoist-pattern[]=@swc*
@buf:registry=https://buf.build/gen/npm/v1/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21.7.1
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist
node_modules
gen
pnpm-lock.yaml
pnpm-lock*
bun.lockb
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Java Modules

This repository provides the web code for the [`javamodules.dev`](https://javamodules.dev) website and app. More coming soon.

Binary file modified bun.lockb
Binary file not shown.
27 changes: 21 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"check": "pnpm run /:check$/",
"clean": "rm -fr dist && rm -fr site/dist && rm -fr workers/*/build workers/*/dist",
"dist": "mkdir -p dist && pnpm run site:build:prod && cp -frv site/dist/* dist/",
"devcontainer:build": "docker buildx build --attest=type=provenance --attest=type=sbom --push -t ghcr.io/javamodules/javamodules.dev/devcontainer -f .devcontainer/Dockerfile .",
"devcontainer:push": "docker push ghcr.io/javamodules/javamodules.dev/devcontainer",
"devcontainer": "docker run --rm -it ghcr.io/javamodules/javamodules.dev/devcontainer",
"fmt:check": "prettier . --check",
"fmt:write": "prettier . --write",
"libs:build": "pnpm --filter !@javamodules/site -r build",
Expand All @@ -32,11 +35,12 @@
"prepare": "husky"
},
"devDependencies": {
"@commitlint/cli": "19.1.0",
"@changesets/cli": "2.27.1",
"@commitlint/cli": "19.2.0",
"@commitlint/config-conventional": "19.1.0",
"commitlint": "19.1.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"commitlint": "19.2.0",
"husky": "9.0.11",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"typescript": "5.4.2"
},
Expand All @@ -45,13 +49,24 @@
"pre-commit": "lint-staged"
}
},
"pnpm": {
"allowDeprecated": {
"rollup-plugin-inject": "*",
"sourcemap-codec": "*"
}
},
"lint-staged": {
"*": "pnpm run check"
},
"commitlint": {
"extends": ["@commitlint/config-conventional"],
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"signed-off-by": [2, "always"]
"signed-off-by": [
2,
"always"
]
}
}
}
Loading

0 comments on commit 7cf9a48

Please sign in to comment.