Skip to content

Commit

Permalink
feat: move to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Sep 15, 2023
1 parent 6453ae0 commit ff58ce4
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ module.exports = {
"cypress/globals": true,
},
plugins: ["cypress"],
// we're using vitest which has a very similar API to jest
// (so the linting plugins work nicely), but it means we have to explicitly
// set the jest version.
// We're using vitest which has a very similar API to jest
// (so the linting plugins work nicely), but it means we
// have to set the jest version explicitly.
settings: {
jest: {
version: 28,
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.repo.js → .eslintrc.repo.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const WARN = 1;
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: [
"./.eslintrc.js",
"./.eslintrc.cjs",
"@remix-run/eslint-config/internal",
"plugin:markdown/recommended",
],
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions mocks/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { rest } = require("msw");
const { setupServer } = require("msw/node");
import { rest } from "msw";
import { setupServer } from "msw/node";

// put one-off handlers that don't really need an entire file to themselves here
const miscHandlers = [
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
"name": "indie-stack-template",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "remix dev -c \"npm run dev:serve\"",
"dev:serve": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js",
"dev:serve": "NODE_OPTIONS=\"--require ./mocks\" remix-serve ./build/index.js",
"format": "prettier --write .",
"format:repo": "npm run format && npm run lint:repo -- --fix",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
"lint:repo": "npm run lint -- --config .eslintrc.repo.js",
"lint:repo": "npm run lint -- --config .eslintrc.repo.cjs",
"setup": "prisma generate && prisma migrate deploy && prisma db seed",
"start": "remix-serve ./build/index.js",
"start:mocks": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js",
"start:mocks": "NODE_OPTIONS=\"--require ./mocks\" remix-serve ./build/index.js",
"test": "vitest",
"test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"",
"pretest:e2e:run": "npm run build",
Expand Down Expand Up @@ -52,7 +53,6 @@
"@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-v8": "^0.34.2",
"autoprefixer": "^10.4.15",
"binode": "^1.0.5",
"cookie": "^0.5.0",
"cross-env": "^7.0.3",
"cypress": "12.17.3",
Expand Down Expand Up @@ -81,6 +81,6 @@
"node": ">=18.0.0"
},
"prisma": {
"seed": "ts-node --require tsconfig-paths/register prisma/seed.ts"
"seed": "ts-node --esm --require tsconfig-paths/register prisma/seed.ts"
}
}
File renamed without changes.
3 changes: 1 addition & 2 deletions remix.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
export default {
cacheDirectory: "./node_modules/.cache/remix",
ignoredRouteFiles: ["**/.*", "**/*.test.{ts,tsx}"],
serverModuleFormat: "cjs",
};
2 changes: 1 addition & 1 deletion remix.init/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const main = async ({ packageManager, rootDirectory }) => {
fs.rm(path.join(rootDirectory, ".github", "workflows", "no-response.yml")),
fs.rm(path.join(rootDirectory, ".github", "dependabot.yml")),
fs.rm(path.join(rootDirectory, ".github", "PULL_REQUEST_TEMPLATE.md")),
fs.rm(path.join(rootDirectory, ".eslintrc.repo.js")),
fs.rm(path.join(rootDirectory, ".eslintrc.repo.cjs")),
fs.rm(path.join(rootDirectory, "LICENSE.md")),
]);

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "CommonJS",
"module": "ES2020",
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "ES2020",
Expand Down

0 comments on commit ff58ce4

Please sign in to comment.