Install Docker, if you don't have it yet.
Then:
git submodule update --init --recursive # pull submodules
volta install dotenv-cli # install dotenv
brew install postgres # install psql
docker compose up -d # run services
# Initialize the DB if it's empty
dotenv -e .env.development -- npx prisma db pushYou should also run the GraphQL codegen watcher, at least until capaj/graphql-codegen-vscode#21 is fixed:
npm run gql:watchJust in case:
npx prisma generateIf you want to remove the databases, run:
docker compose down
docker volume rm $(docker volume ls -q | grep woc_)Check that the services are running:
docker compose psThen:
npm run devSetting up:
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
rustup target add x86_64-apple-darwin aarch64-apple-darwinRunning in dev mode:
npm run dev
npm run tauri devBuilding the prod app:
# This is not necessary right now because we're building the app simply as a wrapper.
# rm .env
# NODE_ENV=production npm run build
# DATABASE_URL="postgresql://user:password@localhost:3999/db_dev" NODE_ENV=production npx next export
npx tauri build --debug # --debug for the web inspector to workBuilding a universal macOS binary:
npx tauri build --target universal-apple-darwinUpgrading Tauri:
npm i -S -D @tauri-apps/cli@latest
cd src-tauri
cargo install cargo-edit # provides cargo upgrade, needed only once
cargo upgradeGenerating icons:
npm run tauri icon public/icon-macos.pngnpx playwright install # install browsers; only needed onceTo run:
dotenv -e .env.development -- npx playwright test --workers=1The server must be running for the tests to work. --workers=1 runs tests without parallelism — this is necessary because otherwise hot reloading messes things up.
Tests use the following users:
alice@woc.test, passwordtestbob@woc.test, passwordtest
As of Jun 2023, the tests are flaky. You might be getting waiting for locator('text=Account') to be visible and then you try again several times and suddenly it works.
dotenv -e .env.development -- npx prisma studio # GUI
dotenv -e .env.development -- psql # psqlList outdated:
npm outdatedDo an interactive upgrade:
npx npm-upgradeRules:
-
Read changelogs for major version upgrades — some things are not going to be caught by TypeScript, eg. the
command -> metachange in react-hotkeys-hook. -
Don't upgrade ProseMirror stuff or @types/node.
Run npm i. Run npm run check. NOTE THAT THIS PROJECT DOES NOT USE YARN.
Troubleshooting:
- "peer dependencies" with typescript-eslint:
rm -rf package-lock.json node_modules/
cd tiptap
git fetch --allNote the commits in our fork:
git log --oneline | grep WOC:Kill our commits with git reset <commit before our changes> --hard. (For example, smth like the unused-packages commit is hard to rebase. The @ts-nocheck commit has to be repeated every time anyway.)
Get upstream changes:
git rebase upstream/mainCopy all dependencies from tiptap/packages/pm/package.json into our package.json, and run npm i in the root.
Remove git hooks:
rm -rf .husky
git add .
git commit -m "WOC: Remove git hooks"Add @ts-nocheck:
(cd ..; npm run tiptap-nocheck)
git add .
git commit -m "WOC: Add @ts-nocheck"git cherry-pick our commits back.
At the root, check that things build: npm run build. Do npm run dev and check that the editor works.
NOTE: rm -rf tiptap/node_modules if you get weird errors.
Commit and update the submodule:
git push origin HEAD:main --force
(cd ..; git submodule update --remote tiptap)