Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jahands committed Sep 17, 2024
0 parents commit 06f11ca
Show file tree
Hide file tree
Showing 94 changed files with 9,757 additions and 0 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": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
15 changes: 15 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This configuration only applies to the package manager root.
/** @type {import("eslint").Linter.Config} */
module.exports = {
ignorePatterns: ['examples/**', 'packages/**'],
extends: ['@repo/eslint-config/workers.cjs'],
overrides: [
{
files: 'turbo/generators/**/*.ts',
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
}
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

on:
push:
branches: ['main']

env:
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }}
EARTHLY_ORG: jahands
EARTHLY_SATELLITE: mini-sat
FORCE_COLOR: 1

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: earthly/[email protected]
with:
version: v0.8.15
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Deploy
run: earthly --ci --push +deploy --GITHUB_ACTIONS=1

create-release-pr:
# Release PRs are for changelogs only - we auto publish on main every time regardless.
name: Create Release PR
runs-on: ubuntu-latest
timeout-minutes: 5
concurrency: ${{ github.workflow }}-create-release-pr
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile --child-concurrency=10
- name: Create Release Pull Request
uses: changesets/action@v1
with:
publish: pnpm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Wrangler
.wrangler
.dev.vars

# Dependencies
node_modules
.pnp
.pnp.js

.eslintcache

# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# Turbo
.turbo

# Vercel
.vercel

# Build Outputs
.next/
out/
dist


# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Misc
.DS_Store
*.pem
3 changes: 3 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tools]
pnpm = '9.9.0'
node = '22'
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.changeset
pnpm-lock.yaml
turbo/generators/**/*.hbs
40 changes: 40 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// @ts-check

const codeImports = [
// Groups
'<BUILTIN_MODULES>',
'<THIRD_PARTY_MODULES>',
'',
// Usually we don't import from other apps, with the exception of
// wci-internal-api because wci-external-api binds to it.
'^(@repo|wci-internal-api)(/.*)$', // Workspace imports
'',
// Local (relative) imports
'^[.]{2}$', // ..
'^[.]{2}/', // ../
'^[.]/(?!index)', // ./foo (but not ./index)
'^[.]$', // .
'^[.]/index$', // ./index
'',
]

// Type imports are ordered the same way, but without separators.
// We also need a catch-all <TYPES> here to prevent prettier from failing.
const typeImports = ['<TYPES>'].concat(
codeImports.filter((i) => i !== '').map((i) => `<TYPES>${i}`)
)

/** @type {import("prettier").Config} */
const config = {
trailingComma: 'es5',
tabWidth: 2,
useTabs: true,
semi: false,
singleQuote: true,
printWidth: 100,
plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-packagejson'],
importOrder: [...codeImports, ...typeImports],
importOrderTypeScriptVersion: '5.5.3',
}

module.exports = config
31 changes: 31 additions & 0 deletions .syncpackrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// @ts-check
/** @type {import("syncpack").RcFile} */
const config = {
indent: '\t',
lintFormatting: false, // handled by prettier
// dependencyTypes: ['prod'], // disabled filter to enable all types
versionGroups: [
{
label: 'local packages',
packages: ['**'],
dependencies: ['@repo/*'],
dependencyTypes: ['!local'], // Exclude the local package itself
pinVersion: 'workspace:*',
},
{
label: 'pin vitest compatible with workers-pool-vitest',
dependencies: ['vitest', '@vitest/ui'],
pinVersion: '2.0.5',
},
],
semverGroups: [
{
label: 'pin all deps',
range: '',
dependencies: ['**'],
packages: ['**'],
},
],
}

module.exports = config
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"spencerwmiles.vscode-task-buttons"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
56 changes: 56 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.ts": "$(capture).js, $(capture).d.ts",
"*.js": "$(capture).js.map, $(capture).min.js, $(capture).d.ts",
"*.jsx": "$(capture).js",
"*.tsx": "$(capture).ts",
"tsconfig.json": "tsconfig.*.json",
"package.json": "drizzle.config.ts, Justfile, .mise.toml, .prettierignore, .syncpackrc.cjs, CHANGELOG.md, .dev.vars.example, vitest.config.ts, vitest.workspace.ts, .dev.vars, postcss.config.mjs, .eslintrc.cjs, vite.config.ts, worker-configuration.d.ts, .editorconfig, .eslintignore, .earthlyignore, .git-blame-ignore-revs, Earthfile, README.md, package-lock.json, .sentryclirc, .npmrc, yarn.lock, .yarnrc, .nvmrc, .node-version, .eslintrc, .eslintcache, postcss.config.js, remix.config.js, remix.env.d.ts, tailwind.config.js, tsconfig.json, .prettierrc.cjs, .env, .gitignore, server.ts, .eslintrc.js, tailwind.config.ts, turbo.json, LICENSE, wrangler.toml, pnpm-lock.yaml, pnpm-workspace.yaml"
},
"editor.detectIndentation": true,
"github-actions.workflows.pinned.workflows": [".github/workflows/release.yml"],
"github-actions.workflows.pinned.refresh.enabled": true,
"files.associations": {
"**/packages/tools/bin/*": "shellscript"
},
"files.exclude": {
".sentryclirc.lock": true,
"**/.turbo": true,
"**/.wrangler": true,
"**/dist": true
},
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"cSpell.words": [
"cloudflareaccess",
"codemod",
"geobox",
"GOTIFY",
"gotifyroute",
"Hono",
"itty",
"jachands",
"luxon",
"microlabs",
"miniflare",
"opentelemetry",
"otel",
"pnpx",
"syncpack",
"typecheck"
],

// icons: https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
"VsCodeTaskButtons.showCounter": false,
"VsCodeTaskButtons.tasks": [
{
"label": "$(git-commit) New Commit",
"task": "changeset: new",
"tooltip": "Create changeset and commit all changes"
}
]
}
19 changes: 19 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "changeset:new",
"group": "none",
"label": "changeset: new",
"detail": "Create changeset and commit all changes",
"runOptions": { "instanceLimit": 1 },
"presentation": {
"reveal": "always",
"focus": true,
"panel": "new",
"close": true
}
}
]
}
70 changes: 70 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
VERSION --raw-output --build-auto-skip 0.8
PROJECT jahands/docker

prepare-workspace:
FROM --platform=linux/amd64 node:22-bookworm-slim
WORKDIR /work
RUN apt-get update \
&& apt-get install -y curl jq git unzip \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://sh.uuid.rocks/install/mise | bash
ENV PATH="$HOME/.local/share/mise/shims:$HOME/.local/bin:$PATH"
COPY .mise.toml .
RUN mise install --yes && mise reshim

setup-project:
FROM +prepare-workspace
COPY --dir \
examples \
packages \
.

COPY \
.earthlyignore \
.eslintrc.cjs \
.gitignore \
.npmrc \
.prettierignore \
.prettierrc.cjs \
.syncpackrc.cjs \
package.json \
pnpm-lock.yaml \
pnpm-workspace.yaml \
tsconfig.json \
turbo.json \
vitest.workspace.ts \
.

install-deps:
FROM +setup-project
CACHE /pnpm-store
RUN pnpm config set store-dir /pnpm-store
RUN pnpm install --frozen-lockfile --child-concurrency=10

test:
FROM +install-deps
LET TURBO_TEAM=team_jahands
LET FORCE_COLOR=1
LET DO_NOT_TRACK=1
ARG GITHUB_ACTIONS
RUN --raw-output \
--secret TURBO_TOKEN \
--secret TURBO_API \
--secret TURBO_REMOTE_CACHE_SIGNATURE_KEY \
pnpm turbo check:ci

build-workers:
FROM +install-deps
LET TURBO_TEAM=team_jahands
LET FORCE_COLOR=1
LET DO_NOT_TRACK=1
ARG GITHUB_ACTIONS
RUN --raw-output --secret TURBO_TOKEN --secret TURBO_API --secret TURBO_REMOTE_CACHE_SIGNATURE_KEY \
pnpm turbo build:wrangler

# ==================== #
# ======= all ======== #
# ==================== #
test-and-build:
BUILD +test
BUILD +build-workers
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Workers Monorepo Example

For tasks to work with Mise, add this to ~/.zprofile:

```shell
eval "$($HOME/.local/bin/mise activate zsh --shims)"
```

## How To Deploy

Ensure deps are installed:

```shell
pnpm install
```

```shell
pnpm turbo deploy
```
Loading

0 comments on commit 06f11ca

Please sign in to comment.