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

Create file watch for type def generation #2614

Merged
merged 74 commits into from May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
9859071
Add babel deps for parsing ast trees.
peterp May 11, 2021
59d8618
Add code to abstract ast parsing.
peterp May 11, 2021
4cc37ca
Find all the cells in a project.
peterp May 11, 2021
f56b078
Add function to fetch all the cell files.
peterp May 11, 2021
b007329
Fix TS warning.
peterp May 11, 2021
c722e19
Find all directory named imports in a project.
peterp May 11, 2021
51cc986
Fix tests for Windows.
peterp May 21, 2021
4123375
Create mirror directory in getPaths.
peterp May 21, 2021
0d3b469
Partially convert fixture to TypeScript.
peterp May 21, 2021
c6dacb8
Generate mirror types for Cells.
peterp May 21, 2021
6136b5a
Improve conditional checks for magic-modules.
peterp May 21, 2021
10b4f2c
Clean up comments.
peterp May 21, 2021
d3c61cc
Convert fixture api side to TypeScript.
peterp May 21, 2021
115ee8f
Generate directory named module mirror files.
peterp May 21, 2021
d611602
Remove whitespace in generated type.
peterp May 21, 2021
514d636
Merge remote-tracking branch 'origin/main' into pp-create-ts-mirror
peterp May 21, 2021
3e13137
Remove "devtools" concept. Internal is always build time.
peterp May 21, 2021
71d9598
Bump lock file.
peterp May 21, 2021
6a04d5b
Fix test.
peterp May 21, 2021
2f226a6
Improve performance by removing import-time computation.
peterp May 21, 2021
c1b859c
Fix lint errors.
peterp May 21, 2021
860b040
Export fn to generate types.
peterp May 21, 2021
ab18d44
Add helpful alias for testing the CLI.
peterp May 21, 2021
38d3451
Add command to generate types.
peterp May 21, 2021
618d84b
Rename mirror types to generate types.
peterp May 21, 2021
9272814
Generate global types for imported pages.
peterp May 21, 2021
a8dd4f8
Replace glob with fast-glob.
peterp May 21, 2021
1772964
Remove pre-build-tasks and replace with generate-types.
peterp May 21, 2021
cd0566c
Add jsx ast tools.
peterp May 22, 2021
d86adec
Clean up generate types.
peterp May 22, 2021
55346e9
Bump yarn lock.
peterp May 22, 2021
a8b760e
Merge remote-tracking branch 'origin/main' into pp-create-ts-mirror
peterp May 23, 2021
36350bf
Fix tests.
peterp May 23, 2021
65d1adc
Clean up some code.
peterp May 23, 2021
92ab706
Fix lint and tests.
peterp May 23, 2021
c3a6071
Rename findFiles to files.
peterp May 23, 2021
5164788
Remove type generation from babel-plugins.
peterp May 23, 2021
40ccea8
Fix build script.
peterp May 23, 2021
e070b2a
Adjust generated paths.
peterp May 23, 2021
6f787c2
Prefix type definition templates.
peterp May 23, 2021
65cb1c3
Add side prefix to generated includes.
peterp May 23, 2021
b6e7464
Remove unused mock from test.
peterp May 23, 2021
ac0bfc0
Add helper for creating type def include files.
peterp May 23, 2021
a85566a
Generate all types.
peterp May 23, 2021
df0a96d
Add new ways to find files.
peterp May 23, 2021
eac65b2
Improve gen-type-def function names.
peterp May 23, 2021
528d536
Export file finders and type-def generators.
peterp May 23, 2021
7556f32
Add file watcher stub.
peterp May 23, 2021
23454ed
A note about process pages dir.
peterp May 23, 2021
7290c16
Add some notes for outstanding things.
peterp May 23, 2021
13b3ab2
Add is DirNamedModule check.
peterp May 23, 2021
edb2c3b
Move file watcher.
peterp May 25, 2021
ad7669a
Fix some comments.
peterp May 25, 2021
bfeffe6
Delete mirror directory for remove files.
peterp May 30, 2021
7608f02
Merge remote-tracking branch 'origin/main' into pp-create-file-watcher
peterp May 30, 2021
f69c30f
Move code-gen packages.
peterp May 30, 2021
8b2b099
Move GraphQL operation generation to internal.
peterp May 30, 2021
0df4bfa
Make fixture app work again.
peterp May 30, 2021
c25f9b2
Generate the GraphQL types.
peterp May 30, 2021
74c5e20
Lint.
peterp May 30, 2021
4c1d484
Find GraphQL schema files.
peterp May 30, 2021
a6647f8
Remove test matcher.
peterp May 30, 2021
83e9f04
Add graphql schema to paths.
peterp May 30, 2021
dd07eb9
Add schema-ast.
peterp May 30, 2021
c7923ed
Keep todos count.
peterp May 30, 2021
c25a26a
Add way to generate graphql schema.
peterp May 30, 2021
8161daf
Point graphql config to generated schema.
peterp May 30, 2021
26519af
Make generate types command do the work.
peterp May 30, 2021
62c4e6c
Make watcher generate graphql schema and typedefs.
peterp May 30, 2021
74fc341
Use rw-gen-watch command in dev.
peterp May 30, 2021
ae4e427
Clean up output.
peterp May 30, 2021
f975446
Fix windows tests?
peterp May 31, 2021
f800d5f
Update template tsconfigs.
peterp May 31, 2021
84bab6f
skipLibCheck already in compiler options config.
peterp May 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions __fixtures__/example-todo-main/.gitignore
Expand Up @@ -6,9 +6,9 @@ yarn-error.log
.env
.DS_Store
.wip

api/prisma/dev.sqlite
packages/photon/runtime
packages/photon/index.js
packages/photon/index.d.ts

# Generated files
.redwood
api/types/
web/types/
9 changes: 0 additions & 9 deletions __fixtures__/example-todo-main/api/jsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion __fixtures__/example-todo-main/api/package.json
Expand Up @@ -3,6 +3,6 @@
"name": "api",
"version": "0.0.0",
"dependencies": {
"@redwoodjs/api": "0.7.0"
"@redwoodjs/api": "0.32.2"
}
}
4 changes: 2 additions & 2 deletions __fixtures__/example-todo-main/api/src/functions/graphql.js
Expand Up @@ -3,11 +3,11 @@ import {
makeMergedSchema,
makeServices,
} from '@redwoodjs/api'

import schemas from 'src/graphql/**/*.{js,ts}'
import { db } from 'src/lib/db'
import services from 'src/services/**/*.{js,ts}'

import { db } from 'src/lib/db'

export const handler = createGraphQLHandler({
schema: makeMergedSchema({
schemas,
Expand Down
@@ -0,0 +1,5 @@
export const schema = gql`
type Query {
currentUser: JSON
}
`
Expand Up @@ -7,6 +7,7 @@ export const schema = gql`

type Query {
todos: [Todo]
todosCount: Int!
}

type Mutation {
Expand Down
Expand Up @@ -4,6 +4,8 @@ export const todos = () => db.todo.findMany()

export const createTodo = ({ body }) => db.todo.create({ data: { body } })

export const numTodos = () => 0

export const updateTodoStatus = ({ id, status }) =>
db.todo.update({
data: { status },
Expand Down
32 changes: 32 additions & 0 deletions __fixtures__/example-todo-main/api/tsconfig.json
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"esModuleInterop": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"baseUrl": "./",
"rootDirs": [
"./src",
"../.redwood/types/mirror/api/src"
],
"paths": {
"src/*": [
"./src/*",
"../.redwood/types/mirror/api/src/*"
],
"types/*": ["./types/*"]
},
"typeRoots": [
"../node_modules/@types",
"./node_modules/@types"
],
"types": ["jest"],
},
"include": [
"src",
"../.redwood/types/includes/all-*",
"../.redwood/types/includes/api-*",
]
}
5 changes: 3 additions & 2 deletions __fixtures__/example-todo-main/package.json
Expand Up @@ -2,10 +2,11 @@
"private": true,
"workspaces": [
"api",
"web"
"web",
"../../packages/*"
],
"devDependencies": {
"@redwoodjs/core": "0.7.0"
"@redwoodjs/core": "0.32.2"
},
"eslintConfig": {
"extends": "@redwoodjs/eslint-config"
Expand Down
9 changes: 0 additions & 9 deletions __fixtures__/example-todo-main/web/jsconfig.json

This file was deleted.

8 changes: 4 additions & 4 deletions __fixtures__/example-todo-main/web/package.json
Expand Up @@ -3,11 +3,11 @@
"name": "web",
"version": "0.0.0",
"dependencies": {
"@redwoodjs/router": "0.7.0",
"@redwoodjs/web": "0.7.0",
"@redwoodjs/router": "0.32.2",
"@redwoodjs/web": "0.32.2",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-is": "^16.8.0",
"styled-components": "^5.1.0"
}
Expand Down
17 changes: 17 additions & 0 deletions __fixtures__/example-todo-main/web/src/App.js
@@ -0,0 +1,17 @@
import { FatalErrorBoundary } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'

import FatalErrorPage from 'src/pages/FatalErrorPage'
import Routes from './Routes'

import './index.css'

const App = () => (
<FatalErrorBoundary page={FatalErrorPage}>
<RedwoodApolloProvider>
<Routes />
</RedwoodApolloProvider>
</FatalErrorBoundary>
)

export default App
@@ -0,0 +1,3 @@
export default () => {
return (<>I am not a cell, I am a component that is named cell.</>)
}
@@ -1,7 +1,9 @@
import styled from 'styled-components'
import TodoItem from 'src/components/TodoItem'

import { useMutation } from '@redwoodjs/web'

import TodoItem from 'src/components/TodoItem'

export const QUERY = gql`
query TodoListCell_GetTodos {
todos {
Expand Down
16 changes: 0 additions & 16 deletions __fixtures__/example-todo-main/web/src/index.js

This file was deleted.

@@ -1,4 +1,5 @@
import styled from 'styled-components'

import AddTodo from 'src/components/AddTodo'
import TodoListCell from 'src/components/TodoListCell'

Expand Down
34 changes: 34 additions & 0 deletions __fixtures__/example-todo-main/web/tsconfig.json
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"noEmit": true,
"esModuleInterop": true,
"allowJs": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"src/*": [
"./src/*",
"../.redwood/types/mirror/web/src/*"
]
},
"rootDirs": [
"./src",
"../.redwood/types/mirror/web/src"
],
"typeRoots": [
"../node_modules/@types",
"./node_modules/@types"
],
"types": [
"jest"
],
"jsx": "preserve",
},
"include": [
"src",
"../.redwood/types/includes/all-*",
"../.redwood/types/includes/web-*",
]
}