Skip to content

Commit

Permalink
fix remix setup
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed Aug 30, 2023
1 parent 5462fd0 commit 178e525
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 43 deletions.
3 changes: 3 additions & 0 deletions guide/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
node_modules

/.cache
/functions/\[\[path\]\].js
/functions/\[\[path\]\].js.map
/functions/metafile.*
/public/build
/public/docs
.env
8 changes: 4 additions & 4 deletions guide/app/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { RenderableTreeNodes } from '@markdoc/markdoc';
import { renderers } from '@markdoc/markdoc';
import { Link as RouterLink, useMatches } from '@remix-run/react';
import * as React from 'react';
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/prism-light';
import tsx from 'react-syntax-highlighter/dist/cjs/languages/prism/tsx';
import css from 'react-syntax-highlighter/dist/cjs/languages/prism/css';
import darcula from 'react-syntax-highlighter/dist/cjs/styles/prism/darcula';
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
import tsx from 'react-syntax-highlighter/dist/esm/languages/prism/tsx';
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
import darcula from 'react-syntax-highlighter/dist/esm/styles/prism/darcula';
import { getChildren, isTag } from './markdoc';

const style = {
Expand Down
25 changes: 0 additions & 25 deletions guide/functions/[[path]].ts

This file was deleted.

12 changes: 5 additions & 7 deletions guide/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "run-s build:*",
"build:remix": "remix build",
"ci": "sed -i -e \"s/CF_PAGES_BRANCH:\\s'main'/CF_PAGES_BRANCH: '$CF_PAGES_BRANCH'/g\" ./functions/[[path]].ts",
"dev:remix": "cross-env NODE_ENV=development remix dev",
"dev:wrangler": "cross-env NODE_ENV=development wrangler pages dev public --port 3000 --kv CACHE -b ENVIRONMENT=development",
"dev": "run-p dev:*",
"build": "remix build",
"ci": "sed -i -e \"s/CF_PAGES_BRANCH:\\s'main'/CF_PAGES_BRANCH: '$CF_PAGES_BRANCH'/g\" ./server.ts",
"dev": "remix dev --manual -c \"npm run start\"",
"predev": "remix build",
"start": "cross-env NODE_ENV=production npm run dev:wrangler"
"start": "wrangler pages dev public --port 3000 --kv CACHE -b ENVIRONMENT=development"
},
"dependencies": {
"@markdoc/markdoc": "^0.1.7",
Expand Down
26 changes: 19 additions & 7 deletions guide/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
export default {
devServerBroadcastDelay: 1000,
ignoredRouteFiles: ['**/.*'],
server: './server.ts',
serverBuildPath: 'functions/[[path]].js',
serverConditions: ['workerd', 'worker', 'browser'],
serverDependenciesToBundle: 'all',
serverMainFields: ['browser', 'module', 'main'],
serverMinify: true,
serverModuleFormat: 'esm',
serverDependenciesToBundle: ['@remix-run/react'],
serverPlatform: 'neutral',
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// publicPath: "/build/",
future: {
v2_dev: true,
v2_errorBoundary: false,
v2_headers: false,
v2_meta: false,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
unstable_dev: {
appServerPort: 3000,
rebuildPollIntervalMs: 500,
},
unstable_tailwind: true,
},
tailwind: true,
};
21 changes: 21 additions & 0 deletions guide/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { logDevReady } from '@remix-run/cloudflare';
import { createPagesFunctionHandler } from '@remix-run/cloudflare-pages';
import * as build from '@remix-run/dev/server-build';

if (process.env.NODE_ENV === 'development') {
logDevReady(build);
}

export const onRequest = createPagesFunctionHandler({
build,
getLoadContext: (context) => ({
env: {
...context.env,
CF_PAGES_BRANCH: 'main',
},
waitUntil(promise: Promise<unknown>) {
context.waitUntil(promise);
},
}),
mode: process.env.NODE_ENV,
});
File renamed without changes.

0 comments on commit 178e525

Please sign in to comment.