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

Add create-toolpad-app CLI #1700

Merged
merged 141 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 134 commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
c81485d
dsafa
Janpot Feb 1, 2023
58b3edd
alpha 3
Janpot Feb 1, 2023
398eb18
number formatter
Janpot Feb 2, 2023
93511b6
fix preview
Janpot Feb 2, 2023
e6b5c23
wip
Janpot Feb 2, 2023
9fb3450
add note
Janpot Feb 2, 2023
64883a2
Merge branch 'master' into pubs
Janpot Feb 2, 2023
e5573bd
Update NOTES.md
Janpot Feb 2, 2023
e5ffa2a
Merge branch 'master' into pubs
Janpot Feb 7, 2023
94f3261
Forbid writing in start mode
Janpot Feb 7, 2023
dcde747
forbid creating new app
Janpot Feb 7, 2023
24aadb1
dsefrw
Janpot Feb 7, 2023
9a291cc
upgrade
Janpot Feb 7, 2023
a79d329
Merge branch 'master' into pubs
Janpot Feb 8, 2023
c5a445c
Add path
Janpot Feb 8, 2023
3e6a65a
dewd
Janpot Feb 8, 2023
4ec5d26
Merge branch 'master' into pubs
Janpot Feb 8, 2023
175fede
env
Janpot Feb 8, 2023
92ef860
dewfrewr
Janpot Feb 8, 2023
bbd7182
fix empty components folder
Janpot Feb 8, 2023
2cd5cc0
fdsfds
Janpot Feb 8, 2023
e850d20
maybe env
Janpot Feb 8, 2023
386d727
dfewfw
Janpot Feb 8, 2023
59afbe2
keep env
Janpot Feb 9, 2023
490f6bd
dffew
Janpot Feb 9, 2023
e241ccd
Merge branch 'master' into pubs
Janpot Feb 9, 2023
5807af4
dwefewr
Janpot Feb 9, 2023
68f0366
local workflow
Janpot Feb 10, 2023
7c96e16
Update index.tsx
Janpot Feb 10, 2023
bec7d54
componnet by name
Janpot Feb 10, 2023
4fc48fc
Revert "componnet by name"
Janpot Feb 10, 2023
b9bc55a
dedwffdsf
Janpot Feb 10, 2023
732686b
fwf
Janpot Feb 10, 2023
ad18c30
codecomponents by name
Janpot Feb 13, 2023
aaba8cc
exit process when child process fails
Janpot Feb 14, 2023
f0b5a7e
fix migration
Janpot Feb 14, 2023
3629c2e
Add error
Janpot Feb 14, 2023
58e5f31
Merge branch 'master' into direction-13
Janpot Feb 15, 2023
186a7d3
quick dirty
Janpot Feb 15, 2023
85556c4
new instructions
Janpot Feb 15, 2023
edf9bea
clean up
Janpot Feb 15, 2023
1b5739e
punctuation
Janpot Feb 15, 2023
8df3a9e
Add fetch
Janpot Feb 15, 2023
a6166ce
refactor
Janpot Feb 15, 2023
9fb106d
file query resolvers
Janpot Feb 15, 2023
3c1c0ca
stability
Janpot Feb 15, 2023
397baac
dewf
Janpot Feb 15, 2023
915b8dc
Merge branch 'master' into direction-13
Janpot Feb 15, 2023
72e47e9
Remove sentry
Janpot Feb 15, 2023
545e22b
Update handleDataRequest.ts
Janpot Feb 15, 2023
2d7607b
werwe
Janpot Feb 15, 2023
d4acf75
Merge branch 'master' into direction-13
Janpot Feb 15, 2023
49b2580
Merge branch 'master' into direction-13
Janpot Feb 16, 2023
c12f50a
sentry leftovers
Janpot Feb 16, 2023
cc9da67
experiment
Janpot Feb 17, 2023
734c349
custom server
Janpot Feb 17, 2023
ed292da
refine
Janpot Feb 17, 2023
99af7b2
bring back queries
Janpot Feb 17, 2023
8b1d8eb
wefwr
Janpot Feb 17, 2023
02ee20e
Merge branch 'master' into direction-13
Janpot Feb 17, 2023
2be7ca6
add components in the mix
Janpot Feb 17, 2023
282d4b8
Update package.json
Janpot Feb 18, 2023
f42a726
Merge branch 'master' into direction-13
Janpot Feb 18, 2023
0e87ecc
bring back fetch
Janpot Feb 18, 2023
adf3086
lkdnaf
Janpot Feb 18, 2023
b890998
dfsf
Janpot Feb 18, 2023
3b9e4b7
Use lib to open files
Janpot Feb 20, 2023
24b7644
Merge branch 'master' into direction-13
Janpot Feb 20, 2023
fe1ae16
verified this
Janpot Feb 20, 2023
47c82ac
lints
Janpot Feb 20, 2023
00b0b4b
move cli over to toolpad-app
Janpot Feb 20, 2023
517515a
fskjfh
Janpot Feb 20, 2023
5c66ba7
exit on error
Janpot Feb 20, 2023
98088a5
kjdashkhjdf
Janpot Feb 20, 2023
1e8e3f5
Merge branch 'master' into direction-13
Janpot Feb 20, 2023
d431cf3
jhdfs
Janpot Feb 20, 2023
182b847
Add instruction
Janpot Feb 20, 2023
d7ee059
small note
Janpot Feb 20, 2023
d713afd
Merge branch 'master' into direction-13
Janpot Feb 20, 2023
e75493e
lint
Janpot Feb 21, 2023
ac189ad
write code component only once
Janpot Feb 21, 2023
ca9f26b
lint md
Janpot Feb 21, 2023
3433fc2
naming issues
Janpot Feb 21, 2023
f5f0bf0
oops
Janpot Feb 21, 2023
7e4b644
Merge branch 'master' into direction-13
Janpot Feb 21, 2023
d8f228c
Merge branch 'master' into direction-13
Janpot Feb 21, 2023
19ba2f8
Open code editor after creating a code component (#1693)
Janpot Feb 21, 2023
26f9ce1
v0.0.2
bharatkashyap Feb 22, 2023
88407f4
v0.0.3
bharatkashyap Feb 22, 2023
48ec564
Add new CLI for create-toolpad-app
bharatkashyap Feb 22, 2023
e617a55
Merge branch 'master' into direction-13
Janpot Feb 22, 2023
8bd1613
exit process
Janpot Feb 22, 2023
35bfc8e
Fix: Only print commands at the end of cta
bharatkashyap Feb 23, 2023
43c68fe
Bump version
bharatkashyap Feb 23, 2023
a411ec4
Merge branch 'direction-13' into create-toolpad-app
bharatkashyap Feb 23, 2023
7570bfc
Create projects directories as needed (#1706)
Janpot Feb 23, 2023
4256f17
Merge branch 'master' into direction-13
Janpot Feb 23, 2023
5ebdc86
New create component flow (#1709)
Janpot Feb 23, 2023
93e5f90
Make Toolpad work offline (#1710)
Janpot Feb 24, 2023
549d5cc
Merge branch 'master' into direction-13
Janpot Feb 28, 2023
4efa517
Improve createQuery types (#1716)
apedroferreira Feb 28, 2023
ddb0ce3
Merge branch 'master' into direction-13
Janpot Mar 1, 2023
ed9e421
Merge branch 'master' into direction-13
Janpot Mar 1, 2023
8b16c74
release
Janpot Mar 1, 2023
fcc3229
Delete directory on failure
bharatkashyap Mar 1, 2023
58198c9
Clean up console messages
bharatkashyap Mar 1, 2023
c3c85c9
Merge branch 'direction-13' of github.com:mui/mui-toolpad into create…
bharatkashyap Mar 1, 2023
f6ed85b
Fix: Make CI pass
bharatkashyap Mar 2, 2023
15453d5
Fix: Used `yarn workspace` to add deps
bharatkashyap Mar 2, 2023
9d70739
Open browser to app as part of of `dev` script (#1707)
bharatkashyap Mar 2, 2023
f35a258
Merge branch 'master' into direction-13
Janpot Mar 2, 2023
732c96b
Fix: Markdownlint
bharatkashyap Mar 2, 2023
6566126
Fix: Save and cache deps in CI for new package
bharatkashyap Mar 2, 2023
034db7b
Fix: Dockerfile missing deps
bharatkashyap Mar 2, 2023
8446f4e
Merge branch 'direction-13' of github.com:mui/mui-toolpad into create…
bharatkashyap Mar 2, 2023
b440de9
Fix config file being deleted (#1725)
Janpot Mar 2, 2023
10b25c0
release
Janpot Mar 2, 2023
9ebe75f
release
Janpot Mar 2, 2023
3a37268
Updates to `toolpad-app/cli` (#1726)
bharatkashyap Mar 3, 2023
124ffee
Allow direction13 embedding in iframes (#1735)
Janpot Mar 6, 2023
62dd717
add release note
Janpot Mar 6, 2023
1fac418
new version
Janpot Mar 6, 2023
f848d8b
Review part 1
bharatkashyap Mar 8, 2023
4ccb9ea
note tweaks
Janpot Mar 9, 2023
c450412
Review: Handle directory exists
bharatkashyap Mar 9, 2023
a8e0ecf
Merge branch 'direction-13' of github.com:mui/mui-toolpad into create…
bharatkashyap Mar 9, 2023
4d11b68
v0.0.10
bharatkashyap Mar 9, 2023
9dd25f9
v0.0.11
bharatkashyap Mar 9, 2023
2584c08
v0.0.12
bharatkashyap Mar 9, 2023
f3ed749
v0.0.13
bharatkashyap Mar 9, 2023
0051e91
v0.0.14
bharatkashyap Mar 9, 2023
36a987a
v0.0.15
bharatkashyap Mar 9, 2023
9aaae1b
v0.0.16
bharatkashyap Mar 9, 2023
7686440
Fix: Move away from 'test'
bharatkashyap Mar 14, 2023
d88f45b
Fix: Review
bharatkashyap Mar 17, 2023
5188b4e
Fix: Match version with the rest of the packages
bharatkashyap Mar 17, 2023
9acb3fd
Fix: Review and module resolution fixes
bharatkashyap Mar 18, 2023
f4927da
Fix: Remove types from deps
bharatkashyap Mar 18, 2023
6adb57d
Merge branch 'master' into create-toolpad-app
Janpot Mar 20, 2023
8bbef1b
Merge branch 'master' into create-toolpad-app
Janpot Mar 20, 2023
d4b4ccf
remove
Janpot Mar 20, 2023
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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ commands:
- packages/toolpad-app/node_modules
- packages/toolpad-components/node_modules
- packages/toolpad-core/node_modules
- packages/create-toolpad-app/node_modules
- when:
condition: << parameters.browsers >>
steps:
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/packages/toolpad-app/.next
/packages/toolpad-app/prisma/generated/*
/packages/toolpad-app/public

/examples/*/toolpad.yml
64 changes: 44 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,70 @@ If you would like to hack on MUI Toolpad or want to run the latest version, you

- git
- node.js
- Docker
- docker-compose

### Steps

1. Start a local database:
1. Install dependencies:

```sh
docker-compose -f ./docker-compose.dev.yml up -d
yarn install
```

You can skip this step if you already have a development database available by other means. Use the following command to stop the running container:
1. Run the dev in watch mode (Note it's `dev13`, not `dev`)

```sh
docker-compose -f ./docker-compose.dev.yml down
yarn dev13
```

1. Install dependencies:

```sh
yarn install
1. In another folder, start a toolpad project using:

```json
{
"name": "toolpad-local",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"dev": "toolpad dev --dev",
"build": "toolpad build --dev",
"start": "toolpad start --dev"
},
"dependencies": {
"@mui/toolpad": "portal:<your-local-toolpad-monorepo>/packages/toolpad"
},
"resolutions": {
"@mui/toolpad-app": "portal:<your-local-toolpad-monorepo>/packages/toolpad-app",
"@mui/toolpad-core": "portal:<your-local-toolpad-monorepo>/packages/toolpad-core",
"@mui/toolpad-components": "portal:<your-local-toolpad-monorepo>/packages/toolpad-components"
}
}
```

1. Create a `.env` file in the root of the project
1. Replace `<your-local-toolpad-monorepo>` with the path to the toolpad monorepo on your file system. Make sure to keep `portal:`.

```sh
TOOLPAD_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
# For a custom port:
# PORT=3004
# TOOLPAD_EXTERNAL_URL=http://localhost:3004/
```
1. In order to use `portal:` dependencies, we will need to use yarn 2. So start by running

```sh
yarn set version berry
```

and add to the `.yarnrc.yml`:

```yaml
nodeLinker: node-modules
```

1. Now you can run the MUI Toolpad dev command to start the application
1. then run

```sh
yarn install
```

1. Run start toolpad in dev mode:

```sh
yarn dev
```

1. Open [`http://localhost:3000/`](http://localhost:3000/) in your browser.

### Notes for contributors

- Changes that you make to the prisma model will be automatically compiled, but you'll have to push them to the db manually, either by restarting the `yarn dev` command, or by running
Expand Down
37 changes: 37 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,40 @@ Codemirror + typescript resources:
- https://discuss.codemirror.net/t/codemirror-6-and-typescript-lsp/3398/3
- https://github.com/FurqanSoftware/codemirror-languageserver
- http://www.blog.wylie.su/codemirror-lsp

tentative dir 13 to do list:

- remove all non-dir13 things, make the local mode a default
- add a .gitignore file to the `.toolpad-generated` folder
- lots of issues around custom component editing. e.g. files with capital first letter.
- improve DX for developing on toolpad locally: open vscode button, default files,...
- port tests over
- consensus on a file system layout
- consensus on routing
- consensus on API (`createComponent`, `createQuery`,...)
- create a npm publishing flow
- Support custom components with node modules
- build step (catch problems in ci instead of runtime)
- handle runtime process exiting
- trim package size
- automatically pick port if 3000 is in use?
- automatically open editor in the browser on start?
- directly bind to data from a table/select/chart without creating a query?
- reference @types/node in user project
- `toolpad init` command?
- avoid having to install `@mui/toolpad-core`. Can we have users import e.g. `createComponent` from `@mui/toolpad`?
- more concise way of defining argTypes, or helper methods to build them up
- infer query `parameters` typescript type from the definiton
- Better error handling for query:
```ts
export async function repro() {
const x: any = {};
x.x = x;
return x;
}
```
or just let it error?
- which node versions to support?
- remove function datasource
- remove all datasources?
- deploys take too long, optimize
18 changes: 18 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,21 @@
1. Use `<version number>` as the **Release title**
1. Mark as prerelease if necessary.
1. **Publish release**

## npm

For now using this to publish

```sh
yarn release:build
yarn lerna publish --force-publish --no-git-tag-version --no-push --no-git-reset
```

For canary releases:

```sh
yarn release:build
yarn lerna publish --force-publish --no-git-tag-version --no-push --no-git-reset --pre-dist-tag canary
```

<!-- TODO: work out full flow -->
1 change: 1 addition & 0 deletions docker/images/toolpad/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ COPY ./packages/eslint-plugin-material-ui/package.json ./packages/eslint-plugin-
COPY ./packages/toolpad-app/package.json ./packages/toolpad-app/
COPY ./packages/toolpad-components/package.json ./packages/toolpad-components/
COPY ./packages/toolpad-core/package.json ./packages/toolpad-core/
COPY ./packages/create-toolpad-app/package.json ./packages/create-toolpad-app/
RUN --mount=type=cache,target=/root/caches \
yarn install --frozen-lockfile

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.41",
"version": "0.0.42-alpha.5",
"private": true,
"author": "MUI Toolpad",
"license": "MIT",
Expand Down
59 changes: 59 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# mui-toolpad-examples

## To get started on the bundle size application

```sh
cd ./bundleSize
yarn
yarn dev
```

## To start building an application

### setup

```sh
mkdir my-app
cd ./my-app
yarn init --yes
yarn add @mui/toolpad @mui/toolpad-core
```

add the following scripts to package.json:

```json
"scripts": {
"dev": "toolpad dev",
"build": "toolpad build",
"start": "toolpad start"
}
```

(TODO: replace above with a `npx @mui/toolpad init`?)

run

```sh
yarn dev
```

Go to the url that's printed

### app building

You'll see the trusted page editor. connections/components have been removed.

#### Creating a custom component

Go to the component drawer and click on "create new component".
In your toolpad/components folder a new component will appear. you can edit in vscode.

Known sharp edges:

- close the toolpad component editor because it makes it interfere with the file system one.
- do not rename the file, or at least not to something that doesn't start with a small letter, or contains spaces ot special characters. You'll see strange things happen. To be fixed
- the code will be copied verbatim in the toolpad config. This is because that's currently exactly how this works. It's a hack and we'll come up with something proper once we are able to change low level things in Toolpad

#### Connecting data

You'll see you can only create two types of queries for now. Local function queries are defined inside of the `./toolpad/queries.ts` file. If you create a local function query, you'll see an editor where you can select one of the exported functions in `./toolpad/queries.ts` and bind parameters. there's a button that will open vscode for you to edit the queries file. In this file you can export any async function and it will appear in the query editor dropdown, click preview to run it and see its result. You can use environment variables here and import node modules. The result of the function will be brought to the page as bindable state.
3 changes: 3 additions & 0 deletions examples/bundleSize/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.toolpad-generated
.env
20 changes: 20 additions & 0 deletions examples/bundleSize/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "bundle-size",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"dev": "toolpad dev",
"build": "toolpad build",
"start": "toolpad start"
},
"dependencies": {
"@mui/toolpad": "^0.0.41-alpha.1",
"@mui/toolpad-core": "^0.0.41-alpha.1",
"axios": "^1.3.3"
},
"engines": {
"node": "^16.17.0"
}
}
Loading