Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit babe8bb

Browse files
committed
chore: bring in line with latest arc template
1 parent af4c898 commit babe8bb

15 files changed

+93
-26
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
NODE_ENV="development"
21
SESSION_SECRET="super-duper-s3cret"

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
},
1313
plugins: ["cypress"],
1414
// we're using vitest which has a very similar API to jest
15-
// (so the linting plugins work nicely), but it we have to explicitly
15+
// (so the linting plugins work nicely), but we have to explicitly
1616
// set the jest version.
1717
settings: {
1818
jest: {

.eslintrc.repo.js renamed to .eslintrc.repo.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const WARN = 1;
66
/** @type {import('eslint').Linter.Config} */
77
module.exports = {
88
extends: [
9-
"./.eslintrc.js",
9+
"./.eslintrc.cjs",
1010
"@remix-run/eslint-config/internal",
1111
"plugin:markdown/recommended",
1212
],

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ pnpm-lock.yml
88
node_modules
99

1010
/public/build
11+
/server/index.mjs
12+
/server/index.mjs.map
13+
/server/metafile.*
1114
preferences.arc
1215
sam.json
1316
sam.yaml

app.arc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
@app
22
grunge-stack-template
33

4-
# @aws
5-
# region us-east-2
4+
@aws
5+
runtime nodejs16.x
6+
# concurrency 1
7+
# memory 1152
68
# profile default
9+
# region us-west-1
10+
# timeout 30
711

812
@http
913
/*
1014
method any
1115
src server
1216

17+
@plugins
18+
plugin-remix
19+
src plugin-remix.js
20+
1321
@static
1422

1523
@tables

app/root.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import stylesheet from "~/tailwind.css";
1616
export const links: LinksFunction = () => [
1717
{ rel: "stylesheet", href: stylesheet },
1818
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
19-
// NOTE: Architect deploys the public directory to /_static/
20-
{ rel: "icon", href: "/_static/favicon.ico" },
2119
];
2220

2321
export const loader = async ({ request }: LoaderArgs) => {
@@ -30,6 +28,7 @@ export default function App() {
3028
<head>
3129
<meta charSet="utf-8" />
3230
<meta name="viewport" content="width=device-width,initial-scale=1" />
31+
<link rel="icon" href="/_static/favicon.ico" />
3332
<Meta />
3433
<Links />
3534
</head>
File renamed without changes.

mocks/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
const { setupServer } = require("msw/node");
1+
import { rest } from "msw";
2+
import { setupServer } from "msw/node";
23

3-
const server = setupServer();
4+
// put one-off handlers that don't really need an entire file to themselves here
5+
const miscHandlers = [
6+
rest.post(`${process.env.REMIX_DEV_HTTP_ORIGIN}/ping`, (req) =>
7+
req.passthrough(),
8+
),
9+
];
10+
11+
const server = setupServer(...miscHandlers);
412

513
server.listen({ onUnhandledRequest: "bypass" });
614

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"name": "grunge-stack-template",
33
"private": true,
44
"sideEffects": false,
5+
"type": "module",
56
"scripts": {
67
"build": "remix build",
78
"dev": "remix dev --manual -c \"arc sandbox -e testing\"",
89
"format": "prettier --write .",
910
"format:repo": "npm run format && npm run lint:repo -- --fix",
1011
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
11-
"lint:repo": "npm run lint -- --config ./.eslintrc.repo.js",
12+
"lint:repo": "npm run lint -- --config ./.eslintrc.repo.cjs",
13+
"start": "cross-env NODE_ENV=production arc sandbox",
1214
"test": "vitest",
1315
"test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"",
1416
"test:e2e:run": "cross-env PORT=8811 start-server-and-test dev http://localhost:8811 \"npx cypress run\"",
@@ -75,6 +77,6 @@
7577
"vitest": "^0.34.2"
7678
},
7779
"engines": {
78-
"node": ">=14"
80+
"node": ">=14.0.0"
7981
}
8082
}

plugin-remix.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// This should eventually be a npm package, but for now it lives here.
2+
// Its job is to notify the remix dev server of the version of the running
3+
// app to trigger HMR / HDR.
4+
5+
import * as fs from "node:fs";
6+
import * as path from "node:path";
7+
8+
import { logDevReady } from "@remix-run/node";
9+
10+
const buildPath = "server/index.mjs";
11+
12+
let lastTimeout;
13+
14+
export default {
15+
sandbox: {
16+
async watcher() {
17+
if (lastTimeout) {
18+
clearTimeout(lastTimeout);
19+
}
20+
21+
lastTimeout = setTimeout(async () => {
22+
const contents = fs.readFileSync(
23+
path.resolve(process.cwd(), buildPath),
24+
"utf8"
25+
);
26+
const manifestMatches = contents.matchAll(/manifest-([A-f0-9]+)\.js/g);
27+
const sent = new Set();
28+
for (const match of manifestMatches) {
29+
const buildHash = match[1];
30+
if (!sent.has(buildHash)) {
31+
sent.add(buildHash);
32+
logDevReady({ assets: { version: buildHash } });
33+
}
34+
}
35+
}, 300);
36+
},
37+
},
38+
set: {
39+
env() {
40+
// Pass matching env variables through to the application in dev mode.
41+
const passthruKeys = /^NODE_ENV$|^REMIX_DEV_/;
42+
return {
43+
testing: Object.fromEntries(
44+
Object.entries(process.env).filter(([key]) => passthruKeys.test(key))
45+
),
46+
};
47+
},
48+
},
49+
};

0 commit comments

Comments
 (0)