Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Commit

Permalink
adding support for remix 1.8 and fixing #19
Browse files Browse the repository at this point in the history
  • Loading branch information
sudomf committed Dec 15, 2022
1 parent 6871bf8 commit 7c8ef07
Show file tree
Hide file tree
Showing 10 changed files with 513 additions and 342 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

- name: Install dependencies and build 🔧
run: yarn && yarn build

- name: Publish package on NPM 📦
run: npm publish
env:
Expand Down
2 changes: 1 addition & 1 deletion examples/complex/custom-server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const express = require('express');
const { createRequestHandler } = require('@remix-run/express');
const { createRemixViteDevServer, getRemixViteBuild } = require('../lib');
const { createRemixViteDevServer, getRemixViteBuild } = require('../../lib');

const app = express();

Expand Down
13 changes: 7 additions & 6 deletions examples/complex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@
],
"dependencies": {
"@prisma/client": "^4.3.1",
"@remix-run/node": "^1.7.5",
"@remix-run/react": "^1.7.5",
"@remix-run/serve": "^1.7.5",
"@remix-run/server-runtime": "^1.7.5",
"@remix-run/node": "^1.8.2",
"@remix-run/react": "^1.8.2",
"@remix-run/serve": "^1.8.2",
"@remix-run/server-runtime": "^1.8.2",
"bcryptjs": "^2.4.3",
"dedent": "0.7.0",
"dotenv": "^16.0.3",
"isbot": "^3.5.3",
"javascript-time-ago": "2.5.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tiny-invariant": "^1.2.0"
},
"devDependencies": {
"@faker-js/faker": "^7.5.0",
"@remix-run/dev": "^1.7.5",
"@remix-run/eslint-config": "^1.7.5",
"@remix-run/dev": "^1.8.2",
"@remix-run/eslint-config": "^1.8.2",
"@testing-library/cypress": "^8.0.3",
"@testing-library/dom": "^8.18.1",
"@testing-library/jest-dom": "^5.16.5",
Expand Down
11 changes: 6 additions & 5 deletions examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
"start": "remix-serve build"
},
"dependencies": {
"@remix-run/node": "^1.7.5",
"@remix-run/react": "^1.7.5",
"@remix-run/serve": "^1.7.5",
"@remix-run/node": "^1.8.2",
"@remix-run/react": "^1.8.2",
"@remix-run/serve": "^1.8.2",
"isbot": "^3.5.4",
"javascript-time-ago": "2.5.9",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^1.7.5",
"@remix-run/eslint-config": "^1.7.5",
"@remix-run/dev": "^1.8.2",
"@remix-run/eslint-config": "^1.8.2",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"eslint": "^8.23.1",
Expand Down
438 changes: 264 additions & 174 deletions examples/simple/yarn.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remix-vite",
"version": "0.2.5",
"version": "0.3.0",
"description": "Static file serving and directory listing",
"keywords": [
"remix",
Expand Down Expand Up @@ -47,9 +47,9 @@
"@babel/parser": "7.20.2",
"@babel/traverse": "7.20.1",
"@babel/types": "7.20.2",
"@remix-run/dev": "1.7.5",
"@remix-run/express": "1.7.5",
"@remix-run/server-runtime": "1.7.5",
"@remix-run/dev": "1.8.2",
"@remix-run/express": "1.8.2",
"@remix-run/server-runtime": "1.8.2",
"@vitejs/plugin-react": "2.2.0",
"args": "5.0.3",
"cross-fetch": "3.1.5",
Expand Down
1 change: 1 addition & 0 deletions src/entries/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function createServer() {
purgeRequireCache();

const build = await getRemixViteBuild(viteDevServer);

const handler = createRequestHandler({
build,
mode,
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/remix.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/no-explicit-any */

import jsesc from 'jsesc';
Expand Down Expand Up @@ -81,6 +82,11 @@ const getServerEntry = (config: RemixConfig) => {
export const assetsBuildDirectory = ${JSON.stringify(
config.relativeAssetsBuildDirectory,
)};
${
config.future
? `export const future = ${JSON.stringify(config.future)}`
: ''
};
export const publicPath = ${JSON.stringify(config.publicPath)};
export const entry = { module: entryServer };
export const routes = {
Expand Down
23 changes: 13 additions & 10 deletions src/utils/version.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/* eslint-disable no-empty */
import fetch from 'cross-fetch';
import pkg from '../../package.json';

export const checkVersion = async () => {
const res = await fetch(`https://registry.npmjs.org/${pkg.name}`);
const data = await res.json();
const latestVersion = data['dist-tags'].latest as string;
try {
const res = await fetch(`https://registry.npmjs.org/${pkg.name}`);
const data = await res.json();
const latestVersion = data['dist-tags'].latest as string;

if (latestVersion !== pkg.version) {
// eslint-disable-next-line no-console
console.warn(
'\x1b[33m%s\x1b[0m', // yellow
`
if (latestVersion !== pkg.version) {
// eslint-disable-next-line no-console
console.warn(
'\x1b[33m%s\x1b[0m', // yellow
`
Your version of ${pkg.name} is out of date.
Latest version is ${latestVersion}, but you have ${pkg.version}.
Expand All @@ -21,6 +23,7 @@ npm install -D ${pkg.name}@latest
yarn add -D ${pkg.name}@latest
`,
);
}
);
}
} catch {}
};
Loading

0 comments on commit 7c8ef07

Please sign in to comment.