Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Vite #137

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* This is intended to be a basic starting point for linting in your app.
* It relies on recommended configs out of the box for simplicity, but you can
* and should modify this configuration to best suit your team's needs.
*/

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},

// Base config
extends: ["eslint:recommended"],

overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
},
},
},

// Typescript
{
files: ["**/*.{ts,tsx}"],
plugins: ["@typescript-eslint", "import"],
parser: "@typescript-eslint/parser",
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
typescript: {
alwaysTryTypes: true,
},
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
},

// Node
{
files: [".eslintrc.js"],
env: {
node: true,
},
},
],
};
4 changes: 0 additions & 4 deletions .eslintrc.js

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/add-zenhub-label.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ node_modules

# Local Netlify folder
.netlify
.DS_Store
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
60 changes: 0 additions & 60 deletions CODE_OF_CONDUCT.md

This file was deleted.

50 changes: 0 additions & 50 deletions CONTRIBUTING.md

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ To use the template, run
npx create-remix@latest --template netlify/remix-template
```


This project includes:

- Netlify Functions template for Remix sites
Expand All @@ -27,7 +26,7 @@ If you're new to Remix stacks and the remix.init concept, see the official [Remi
Run

```bash
npx create-remix@latest --template ./
npx create-remix@latest --template ./remix-template
```

to test your changes to the template. Follow the steps the Remix CLI prompts you with to create a new project. Ensure to test for both the Netlify Functions template and the Netlify Edge Functions template.
12 changes: 0 additions & 12 deletions app/entry.client.tsx

This file was deleted.

1 change: 0 additions & 1 deletion app/entry.server.tsx

This file was deleted.

11 changes: 2 additions & 9 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
import type { MetaFunction } from "@remix-run/node";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";

export const meta: MetaFunction = () => [{
charset: "utf-8",
title: "New Remix App",
viewport: "width=device-width,initial-scale=1",
}];

export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
38 changes: 13 additions & 25 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
export function headers({
loaderHeaders,
parentHeaders,
}: {
loaderHeaders: Headers;
parentHeaders: Headers;
}) {
console.log(
"This is an example of how to set caching headers for a route, feel free to change the value of 60 seconds or remove the header"
);
return {
// This is an example of how to set caching headers for a route
// For more info on headers in Remix, see: https://remix.run/docs/en/v1/route/headers
"Cache-Control": "public, max-age=60, s-maxage=60",
};
}
import type { MetaFunction } from "@remix-run/deno";

export const meta: MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};

export default function Index() {
return (
<main style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix</h1>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/blog"
rel="noreferrer noopener"
rel="noreferrer"
>
15m Quickstart Blog Tutorial
</a>
Expand All @@ -33,21 +25,17 @@ export default function Index() {
<a
target="_blank"
href="https://remix.run/tutorials/jokes"
rel="noreferrer noopener"
rel="noreferrer"
>
Deep Dive Jokes App Tutorial
</a>
</li>
<li>
<a
target="_blank"
href="https://remix.run/docs"
rel="noreferrer noopener"
>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</main>
</div>
);
}
2 changes: 2 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="@remix-run/node" />
/// <reference types="vite/client" />
10 changes: 0 additions & 10 deletions globals.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions remix.init/netlify-toml → netlify.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build]
command = "npm run build"
publish = "public"
publish = "build/client"

[dev]
command = "npm run dev"
targetPort = 3000
framework = "vite"

# Set immutable caching for static files, because they have fingerprinted filenames

Expand Down
Loading
Loading