Skip to content

Commit 301e605

Browse files
authored
V3 (#339)
* add supabase * add hocuspocus * add hocuspocus * initial supabase schema and tests * add cascading permissions * wip * clean up remotes * clean up old files * fix fetch * extract matrix related code * fix login / register * username dialog, use ids for docs * implement backlinks (inbox), refs, upgrade yjs * fix sidebar tree to allow dnd * use atlaskit sidebar * fix styles * wip * simplify Identifier code * chore: update filenames * fix build * supabase permissions * supabase refs * misc fixes projects and identifiers * wip * localdoc * tests wip * wip * aliases etc * fix path bugs * fix tree bug (NaN) * fix routing * breadcrumbs wip * fix * fix breadcrumbs * wip * fix playwright tests * fix tests * upgrade node / npm * upgrade vite * remove react router patch * wip * improve syncmanager tests * wip * add docconnection test (wip) * upgrade ts * wip * readonly test works * background syncer * bg syncer tests * misc * prevent flashing of tree * remove global stores * CI * add supabase test * update types * test * add test * debug * ci * update supabase * use patches for hocuspocus * add server start command * fix * fix dep * hp in bg * fix start command * fix imports * config variables * fix build * respect mode * test * fix host check * fix security checks * update supabase packages * ci changes * ci project id * fix gentypes * fix * fix build * ci * fix * ci wip * fix * fix urls * test * update tests * fix test * disable pw tests * disable * ci * fix * enable pw * remove timeouts * hide secrets * fix * fix ci * fix * add docs * fix ci * fix some tests * fix server tests * fix tests * fix build * fix tests * fix tests * test * fix * refactor packages (#341) * refactor packages * gen types * fix types * update vite and vitest * disable unused tests * fix test * fix deploy * Refactor/fix tests (#342) * fix tests, use funcs from vscode-lib * small fixes * enable cascading access tests * cleanup * Supabase constraints (#343) * add constraints * fix tests * fix * fix * fix * fix rls * fix RLS * misc fixes * remove useless test * bundle stats (#347) * bundle stats * fix * Mix fixes (#345) * add constraints * fix tests * fix * fix * fix * fix rls * fix RLS * misc fixes * remove useless test * misc fixes * apply guest changes * fix build * fix * fix build * fix build * remove matrix and lerna (#346) * wip, delete all matrix stuff * bundle stats * fix patches * update pw * remove more packages * fix text * fix csstype * fix * bg logs * ci * fix build? * fix playwright-test * fix tests * fix * clean atlaskit * Remove lerna (#348) * wip: remove lerna * fix build * fix build order * npm update * clean tests * remove more matrix related code * Wip monaco newsandbox (#350) * monaco / upgrade blocknote * clean package json + local blocknote * wip monaco * wip * wip * fix * wip * disable contentdom * wip * blocknote 0.8.0 * fix package lock * extract execution from editor and introduce new kind of sandbox * wip * styles * monaco fix * improve compile system * fix * fix import documents * fix types * eslint * package lock * fix package lock * downgrade typescript eslint * fix monaco selections * fix build * fix mode * fix build * fix tests * fix * fix * fix tests * fix imports * update lockfile * fix pw * iframe params via hash * tmp disable test * fix * reenable bg syncer test * V2/fix docs (#351) * wip: fix docs * add language selection and some small fixes * url titles * sharedworker * folder view * add index file * homepage fixes * misc updates * fix build * fix docs * fix lint * fix lint * sharedworker -> regular worker * use CompressionStream for cache * fix build * prettier async * upgrade prettier * remove prettier patch * fix tests * enable sourcemaps * fix * switch to localforage * fix build * fix * remove ws * remove atlaskit userpicker and monaco languages (#353) * remove atlaskit userpicker and monaco languages * fix test * fix name * fix * fix gh action * update actions * upgrade hocuspocus (#354) * upgrade hocuspocus * fix build * upgrade deps (#355) * upgrade deps * missing * fix paths * disable app install * fix frame security for staging * basic profiles / 3rd party avatars (#356) * basic profiles / 3rd party avatars * fix * improve code block in slash menu * add react icon to code block * add forks * text styles * misc fixes * fix * improve user picker * fix placeholder * set window title * remove markdown-it * fix gh ci * copy all guest docs on signup (#357) * copy all guest docs on signup * fix console errors * fix * fix * fix * remove markdown export * change ci order * fix test * fix test? * fix test * docs fixes * fix tests * fix test? * startscreen changes * db migration * add demo user * fix seed? * esModuleInterop * fix build * site fixes * startscreen improvements * fix lock * wip: content * site content * fix staging * fix forgot password (#359) * clear awareness on navigating away (#360) * only import specific lodash functions (#361) * fix * small fixes * fix imports * misc fixes * fix * update docs * fix tests
1 parent 3ae8cca commit 301e605

File tree

442 files changed

+29187
-61208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

442 files changed

+29187
-61208
lines changed

.github/workflows/build.yaml

+77-45
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,51 @@ jobs:
88
runs-on: ubuntu-latest
99
timeout-minutes: 20
1010
steps:
11-
- uses: actions/checkout@master
11+
- uses: actions/checkout@v3
1212

13-
- name: Setup Node.js 16.x
14-
uses: actions/setup-node@master
13+
- uses: supabase/setup-cli@v1
1514
with:
16-
node-version: 16.x
15+
version: latest
16+
17+
- name: Setup Node.js 18.x
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 18.x
21+
22+
# from https://github.com/supabase/supabase-action-example/
23+
- run: supabase start -x studio,imgproxy,storage,edge-runtime,vector,realtime,storage-api
24+
working-directory: packages/server
25+
env:
26+
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
27+
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
28+
- run: supabase db lint
29+
working-directory: packages/server
30+
env:
31+
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
32+
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
33+
- run: supabase test db
34+
working-directory: packages/server
35+
env:
36+
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
37+
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
38+
39+
- name: Verify generated supabase types are checked in
40+
working-directory: packages/server
41+
run: |
42+
supabase gen types typescript --local --schema public > ../shared/src/schema.ts
43+
if ! git diff --ignore-space-at-eol --exit-code --quiet ../shared/src/schema.ts; then
44+
echo "Detected uncommitted changes after build. See status below:"
45+
git diff
46+
exit 1
47+
fi
48+
env:
49+
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
50+
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
1751

1852
# doesn't seem to cause significant speed up, probably because it still needs to install deps
1953
- name: cache playwright
2054
id: playwright-cache
21-
uses: actions/cache@v2
55+
uses: actions/cache@v3
2256
with:
2357
path: ~/.cache/ms-playwright
2458
key: pw3-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
@@ -33,7 +67,7 @@ jobs:
3367
# key: lerna-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
3468

3569
- name: Cache node modules
36-
uses: actions/cache@v2
70+
uses: actions/cache@v3
3771
env:
3872
cache-name: cache-node-modules
3973
with:
@@ -45,84 +79,82 @@ jobs:
4579
${{ runner.os }}-build-
4680
${{ runner.os }}-
4781
48-
- name: Set correct access for docker containers (server/test/data)
49-
run: chmod -R a+rw test-util/server/data
82+
# - name: Set correct access for docker containers (server/test/data)
83+
# run: chmod -R a+rw test-util/server/data
5084

51-
- name: Build the docker-compose stack
52-
run: docker-compose -f test-util/server/docker-compose.yml up -d
85+
# - name: Build the docker-compose stack
86+
# run: docker-compose -f test-util/server/docker-compose.yml up -d
5387

54-
- name: Check running containers
55-
run: docker ps -a
88+
# - name: Check running containers
89+
# run: docker ps -a
5690

57-
- name: Check docker logs
58-
run: docker logs synapse
91+
# - name: Check docker logs
92+
# run: docker logs synapse
5993

6094
- name: NPM CI
6195
run: npm ci
6296

6397
# - name: Bootstrap packages
6498
# run: npm run bootstrap
6599

66-
- name: Wait for Matrix
67-
run: npx wait-on http://localhost:8888/_matrix/static/
100+
# - name: Wait for Matrix
101+
# run: npx wait-on http://localhost:8888/_matrix/static/
68102

69103
- name: Build packages
70104
run: npm run build
71105
env:
72106
CI: true
73107

74-
- name: Install Playwright
75-
run: npx playwright install --with-deps
76-
# if: steps.playwright-cache.outputs.cache-hit != 'true'
77-
# env:
78-
# PLAYWRIGHT_BROWSERS_PATH: 0 # https://github.com/microsoft/playwright/blob/main/docs/src/ci.md#caching-browsers
108+
- name: Build packages (vite react)
109+
run: npm run build:react
110+
env:
111+
CI: true
112+
MODE: development
79113

80114
- name: Lint
81115
run: npm run lint
82116
env:
83117
CI: true
84118

85-
# Option A: don't build in CI, but test against dev server
86-
# (with Vite, building in CI is now fast enough so we can go for option B)
119+
- name: Start HocusPocus server
120+
run: RUNNER_TRACKING_ID="" && npm run start:server &
121+
env:
122+
CI: true
87123

88-
# - name: Run dev server
89-
# # Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
90-
# run: npm run start:local & npx wait-on http://localhost:5173 -c ./packages/editor/wait-on.conf.json
91-
# env:
92-
# CI: true
124+
- name: Run Tests
125+
run: npm run test
126+
env:
127+
CI: true
93128

94-
# - name: Run Playwright tests (against dev server)
95-
# run: npm run playwright:dev
129+
- name: Install Playwright
130+
run: npx playwright install --with-deps
131+
# if: steps.playwright-cache.outputs.cache-hit != 'true'
132+
# env:
133+
# PLAYWRIGHT_BROWSERS_PATH: 0 # https://github.com/microsoft/playwright/blob/main/docs/src/ci.md#caching-browsers
96134

97-
# Option B: actually build and run react code and run tests against that
98-
- name: Build and run preview server
135+
# Actually build and run react code and run playwright tests against that
136+
- name: Build and run preview
99137
# Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
100138
run: npm run start:preview & npx wait-on http://localhost:4173 -c ./packages/editor/wait-on.conf.json
101139
env:
102140
CI: true
141+
MODE: development
103142

104-
- name: Run Playwright tests (against preview server)
143+
- name: Run Playwright tests (against preview)
105144
run: npm run playwright:preview
106145

107-
- uses: actions/upload-artifact@v2
146+
- uses: actions/upload-artifact@v3
108147
if: always()
109148
with:
110149
name: playwright-report-editor
111150
path: packages/editor/playwright-report/
112151
retention-days: 30
113152

114-
- uses: actions/upload-artifact@v2
115-
if: always()
153+
# Upload webpack-stats.json to use on relative-ci.yaml workflow
154+
- name: Upload webpack stats artifact
155+
uses: relative-ci/agent-upload-artifact-action@v1
116156
with:
117-
name: playwright-report-engine
118-
path: packages/engine/playwright-report/
119-
retention-days: 30
120-
121-
- name: Run Tests
122-
run: npm run test
123-
env:
124-
CI: true
125-
157+
webpackStatsFile: ./packages/editor/dist/webpack-stats.json
126158
# - name: Upload to coveralls
127159
# uses: coverallsapp/github-action@master
128160
# with:

.github/workflows/prettier.yaml

-39
This file was deleted.

.github/workflows/production.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy production db
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
15+
SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
16+
PROJECT_ID: guzxrzrjknsekuefovon
17+
TYPECELL_GITHUB_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains
18+
TYPECELL_GOOGLE_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- uses: supabase/setup-cli@v1
24+
with:
25+
version: latest
26+
27+
- run: supabase link --project-ref $PROJECT_ID
28+
working-directory: packages/server
29+
- run: supabase db push
30+
working-directory: packages/server

.github/workflows/relative-ci.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: RelativeCI
2+
3+
on:
4+
workflow_run:
5+
workflows: ["build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send bundle stats and build information to RelativeCI
14+
uses: relative-ci/agent-action@v2
15+
with:
16+
key: ${{ secrets.RELATIVE_CI_KEY }}
17+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/staging.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy staging db
2+
3+
on:
4+
push:
5+
branches:
6+
- staging
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
15+
SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
16+
PROJECT_ID: glsqqdamehahvdqssxow
17+
TYPECELL_GITHUB_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains
18+
TYPECELL_GOOGLE_OAUTH_SECRET: NOT-USED # not used but needs to be set, otherwise supabase cli complains
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- uses: supabase/setup-cli@v1
24+
with:
25+
version: latest
26+
27+
- run: supabase link --project-ref $PROJECT_ID
28+
working-directory: packages/server
29+
- run: supabase db push
30+
working-directory: packages/server

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ yarn-error.log*
2727

2828
.idea/
2929
.vercel
30+
tsconfig.tsbuildinfo

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@matrix-org:registry=https://gitlab.matrix.org/api/v4/packages/npm/
2+
install-links=true

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16
1+
v18.16.0

.vscode/settings.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@
99
"search.exclude": {
1010
"packages/editor/public/types": true,
1111
"**/coverage": true,
12-
"**/dist": true
12+
"**/dist": true,
13+
"**/coverage/**/*": true,
14+
"**/dist/**/*": true,
15+
"**/node_modules/**/*": true
1316
},
1417
"vitest.exclude": [
1518
"**/node_modules/**",
1619
"**/dist/**",
1720
"**/cypress/**",
1821
"**/.{idea,git,cache,output,temp}/**",
1922
"**/end-to-end/**"
20-
]
23+
],
24+
"typescript.preferences.autoImportFileExcludePatterns": ["**/*/dist"]
2125
}

CONTRIBUTING.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# Development
22

3-
TypeCell is a monorepo containing several packages. In VS Code, it's best to open `typecell.code-workspace` to open the project as a workspace.
3+
TypeCell is a monorepo containing several packages.
44

55
## Directory structure:
66

77
```
8-
blocknote
8+
typecell
99
├── packages
10-
│ ├── common - Utility functions shared across the codebase
11-
│ ├── editor - The main React application
12-
│ ├── engine - The live-code execution engine
13-
│ ├── packager - Tool to bundle TypeCell notebook apps (WIP)
14-
│ └── parsers - Helpers to convert to / from TypeCell notebooks
15-
├── patches - patch-package patches
16-
└── test-util - Server and data for unit tests
10+
│ ├── editor - The main React application
11+
│ ├── engine - The live-code execution engine and Reactive Runtime
12+
│ ├── frame - sandboxed iframe where end-user code evaluates
13+
│ ├── packager - Tool to bundle TypeCell notebook apps (WIP)
14+
│ ├── parsers - Helpers to convert to / from TypeCell documents
15+
│ ├── server - HocusPocus + Supabase server for storing documents
16+
│ ├── shared - TypeCell specific models shared across the codebase
17+
│ ├── shared-test - Helper functions shared across the codebase for unit tests
18+
│ └── util - Generic helper functions
19+
├── patches - patch-package patches
20+
└── test-util - Data for unit tests
1721
```
1822

1923
## Running locally
@@ -22,12 +26,15 @@ Node.js is required to run this project. To download Node.js, visit [nodejs.org]
2226

2327
To run the project, open the command line in the project's root directory and enter the following commands:
2428

25-
# Install all required npm modules for lerna, and bootstrap lerna packages
29+
# Install all required npm modules
2630
npm install
2731

2832
# Initial build of all packages required by the main editor project
2933
npm run build
3034

35+
# Start the local server
36+
npm run start:server
37+
3138
# Start the main editor project
3239
npm start
3340

0 commit comments

Comments
 (0)