Skip to content

Commit

Permalink
feat(remix): support v2 for remix
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Dec 5, 2023
1 parent dd0a90b commit 637de2e
Show file tree
Hide file tree
Showing 54 changed files with 1,150 additions and 995 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@nx/workspace": "17.0.1",
"@nx/storybook": "17.0.1",
"@phenomnomnominal/tsquery": "^5.0.1",
"@remix-run/dev": "1.15.0",
"@remix-run/node": "1.15.0",
"@remix-run/dev": "2.3.0",
"@remix-run/node": "2.3.0",
"@rspack/core": "^0.1.12",
"@rspack/dev-server": "^0.1.12",
"@rspack/less-loader": "^0.0.22",
Expand Down
12 changes: 0 additions & 12 deletions packages/remix/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,5 @@
"schema": "./src/executors/build/schema.json",
"description": "Build a Remix application."
}
},
"builders": {
"serve": {
"implementation": "./src/executors/serve/compat",
"schema": "./src/executors/serve/schema.json",
"description": "Serve a Remix application."
},
"build": {
"implementation": "./src/executors/build/build.impl",
"schema": "./src/executors/build/schema.json",
"description": "Build a Remix application."
}
}
}
49 changes: 49 additions & 0 deletions packages/remix/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,55 @@
"alwaysAddToPackageJson": true
}
}
},
"17.1.0": {
"version": "17.1.0",
"packages": {
"@remix-run/node": {
"version": "^2.3.0",
"alwaysAddToPackageJson": true
},
"@remix-run/react": {
"version": "^2.3.0",
"alwaysAddToPackageJson": true
},
"@remix-run/serve": {
"version": "^2.3.0",
"alwaysAddToPackageJson": true
},
"@remix-run/dev": {
"version": "^2.3.0",
"alwaysAddToPackageJson": true
},
"@remix-run/css-bundle": {
"version": "^2.3.0",
"alwaysAddToPackageJson": true
},
"@remix-run/eslint-config": {
"version": "^2.3.0",
"alwaysAddToPackageJson": true
},
"isbot": {
"version": "^3.6.8",
"alwaysAddToPackageJson": true
},
"eslint": {
"version": "^8.38.0",
"alwaysAddToPackageJson": true
},
"@testing-library/react": {
"version": "^14.1.2",
"alwaysAddToPackageJson": false
},
"@testing-library/jest-dom": {
"version": "^6.1.4",
"alwaysAddToPackageJson": false
},
"@testing-library/user-event": {
"version": "^14.5.1",
"alwaysAddToPackageJson": false
}
}
}
}
}
5 changes: 0 additions & 5 deletions packages/remix/src/executors/build/compat.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/remix/src/executors/serve/compat.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/remix/src/generators/action/action.impl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ describe('action', () => {
const content = tree.read('apps/demo/app/routes/example.tsx', 'utf-8');
expect(content).toMatch(`import { json } from '@remix-run/node';`);
expect(content).toMatch(
`import type { ActionArgs } from '@remix-run/node';`
`import type { ActionFunctionArgs } from '@remix-run/node';`
);
expect(content).toMatch(
`import { useActionData } from '@remix-run/react';`
);
});

it('should add action function', () => {
const actionFunction = `export const action = async ({ request }: ActionArgs)`;
const actionFunction = `export const action = async ({ request }: ActionFunctionArgs)`;
const content = tree.read('apps/demo/app/routes/example.tsx', 'utf-8');
expect(content).toMatch(actionFunction);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/remix/src/generators/action/action.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { resolveRemixRouteFile } from '../../utils/remix-route-utils';
import { LoaderSchema } from './schema';

export default async function (tree: Tree, schema: LoaderSchema) {
const routeFilePath = resolveRemixRouteFile(
const routeFilePath = await resolveRemixRouteFile(
tree,
schema.path,
schema.project
Expand All @@ -18,7 +18,7 @@ export default async function (tree: Tree, schema: LoaderSchema) {
);
}

insertImport(tree, routeFilePath, 'ActionArgs', '@remix-run/node', {
insertImport(tree, routeFilePath, 'ActionFunctionArgs', '@remix-run/node', {
typeOnly: true,
});
insertImport(tree, routeFilePath, 'json', '@remix-run/node');
Expand All @@ -28,7 +28,7 @@ export default async function (tree: Tree, schema: LoaderSchema) {
tree,
routeFilePath,
`
export const action = async ({ request }: ActionArgs) => {
export const action = async ({ request }: ActionFunctionArgs) => {
let formData = await request.formData();
return json({message: formData.toString()}, { status: 200 });
Expand Down
Loading

0 comments on commit 637de2e

Please sign in to comment.