Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncabot committed May 6, 2023
1 parent b97b698 commit 6b01efc
Show file tree
Hide file tree
Showing 20 changed files with 3,644 additions and 2,758 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Expand Up @@ -11,30 +11,30 @@ jobs:
name: Deploy Application
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read Node version from .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
node-version-file: '.nvmrc'
- name: Build Shared
working-directory: ./shared
run: |
yarn
yarn build
yarn link
CI=true yarn test
- name: Build Frontend
working-directory: ./frontend
run: |
yarn
yarn link @app/shared
yarn build
CI=true yarn test
- name: Build Backend
working-directory: ./backend
run: |
yarn
yarn link @app/shared
yarn build
yarn test
- name: Publish Backend
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v16.15.0
lts/hydrogen
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Jason Cabot
Copyright (c) 2023 Jason Cabot

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions backend/build.js
Expand Up @@ -2,6 +2,8 @@ import path from "path";
import { fileURLToPath } from "url";
import { build } from "esbuild";

console.log("[esbuild] start");

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand All @@ -16,7 +18,10 @@ try {
entryPoints: [path.join(__dirname, "src", "index.ts")],
outdir: path.join(__dirname, "dist"),
outExtension: { ".js": ".mjs" },
loader: {},
});
} catch {
process.exitCode = 1;
}

console.log("[esbuild] finish");
50 changes: 29 additions & 21 deletions backend/jest.config.ts
@@ -1,22 +1,30 @@
export default {
preset: "ts-jest/presets/default-esm",
globals: {
"ts-jest": {
tsconfig: "test/tsconfig.json",
useESM: true,
},
},
moduleNameMapper: {
'^@app/shared$': '<rootDir>/../shared/src/index.ts',
"^@/(.*)$": "<rootDir>/src/$1",
"^(\\.{1,2}/.*)\\.js$": "$1",
},
testEnvironment: "miniflare",
testEnvironmentOptions: {
// Miniflare doesn't yet support the `main` field in `wrangler.toml` so we
// need to explicitly tell it where our built worker is. We also need to
// explicitly mark it as an ES module.
scriptPath: "dist/index.mjs",
modules: true,
}
import type { JestConfigWithTsJest } from "ts-jest";
const jestConfig: JestConfigWithTsJest = {
testEnvironment: "miniflare",
testEnvironmentOptions: {
// Miniflare doesn't yet support the `main` field in `wrangler.toml` so we
// need to explicitly tell it where our built worker is. We also need to
// explicitly mark it as an ES module.
scriptPath: "dist/index.mjs",
modules: true,
},
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
"^.+\\.tsx?$": [
"ts-jest",
{
tsconfig: "test/tsconfig.json",
useESM: true,
},
],
},
moduleNameMapper: {
"^@app/backend/(.*)$": "<rootDir>/src/$1",
"^@app/shared$": "<rootDir>/../shared/src/index.ts",
"^@/(.*)$": "<rootDir>/src/$1",
"^(\\.{1,2}/.*)\\.js$": "$1",
},
};

export default jestConfig;
24 changes: 13 additions & 11 deletions backend/package.json
Expand Up @@ -5,7 +5,8 @@
"module": "./dist/index.mjs",
"scripts": {
"build": "node build.js",
"dev": "miniflare --build-watch-path src --build-watch-path ../shared/src --live-reload --debug --modules dist/index.mjs",
"dev": "miniflare --build-watch-path src --build-watch-path ../shared/src --live-reload --debug --modules dist/index.mjs --host 0.0.0.0",
"format": "prettier --config .prettierrc 'src/**/*.ts' --write",
"test": "yarn build && node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
"types:check": "tsc && tsc -p test/tsconfig.json",
"deploy": "wrangler publish"
Expand All @@ -14,17 +15,18 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@cloudflare/workers-types": "^3.11.0",
"@types/jest": "^27.5.1",
"@cloudflare/workers-types": "^4.20221111.1",
"@app/shared": "file:../shared/src",
"@types/jest": "^29.2.6",
"@types/node": "^18.0.5",
"esbuild": "^0.14.41",
"jest": "^28.1.0",
"jest-environment-miniflare": "^2.5.0",
"miniflare": "^2.5.0",
"prettier": "^2.6.2",
"ts-jest": "^28.0.3",
"esbuild": "^0.15.12",
"jest": "^29.3.1",
"jest-environment-miniflare": "^2.13.0",
"miniflare": "^2.13.0",
"prettier": "^2.8.3",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"typescript": "^4.7.2",
"wrangler": "^2.0.7"
"typescript": "^4.9.4",
"wrangler": "^2.8.0"
}
}
10 changes: 5 additions & 5 deletions backend/test/index.spec.ts
@@ -1,8 +1,8 @@
import { handleRequest } from "@/index";
import { handleRequest } from "@app/backend/index";

test("should redirect to example page on no route match", async () => {
const env = getMiniflareBindings();
const res = await handleRequest(new Request("http://localhost"), env);
expect(res.status).toBe(200);
expect(await res.text()).toBe("Hello World");
const env = getMiniflareBindings();
const res = await handleRequest(new Request("http://localhost"), env);
expect(res.status).toBe(200);
expect(await res.text()).toBe("Hello World");
});
1 change: 1 addition & 0 deletions backend/test/tsconfig.json
Expand Up @@ -4,6 +4,7 @@
"types": [
"@cloudflare/workers-types",
"jest",
"jest-environment-miniflare/globals",
"../bindings"
],
},
Expand Down
42 changes: 16 additions & 26 deletions backend/tsconfig.json
@@ -1,29 +1,19 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"lib": [
"esnext"
],
"types": [
"@cloudflare/workers-types"
],
"moduleResolution": "node",
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"baseUrl": "./",
"paths": {
"@/*": [
"src/*"
],
"@app/shared": [
"./../shared/src/index.ts"
]
}
"target": "esnext",
"module": "esnext",
"lib": ["esnext"],
"types": ["@cloudflare/workers-types"],
"moduleResolution": "node",
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"baseUrl": "./",
"paths": {
"@app/backend/*": ["src/*"],
"@app/shared": ["./../shared/src/index.ts"]
}
},
"include": [
"src/**/*",
"bindings.d.ts"
]
}
"include": ["src/**/*", "bindings.d.ts"]
}

5 changes: 5 additions & 0 deletions backend/wrangler.toml
Expand Up @@ -6,3 +6,8 @@ compatibility_flags = []

[build]
command = "node build.js"

[miniflare]
kv_persist = true
cache_persist = true
durable_objects_persist = true

0 comments on commit 6b01efc

Please sign in to comment.