Skip to content

Commit

Permalink
Clean up apps directory (tldraw#4548)
Browse files Browse the repository at this point in the history
Post 3.0 spring cleaning?

There a new `internal` folder with things that people who don't work at
tldraw should never need to look at. The apps folder contains just our
actual apps, with the various dotcom services under `apps/dotcom`.

vercel deploy will fail on this until it's ready to land, at which point
i'll update the vercel config to point at the new script locations

### Change type

- [x] `other`
  • Loading branch information
SomeHats authored Sep 18, 2024
1 parent dd5a14f commit ab9833c
Show file tree
Hide file tree
Showing 367 changed files with 481 additions and 1,730 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ coverage
**/*.js.map
apps/webdriver/www/index.js
apps/webdriver/www/index.css
apps/dotcom-worker/.dev.vars
apps/dotcom/*-worker/.dev.vars
nohup.out

packages/*/package
Expand Down Expand Up @@ -72,4 +72,3 @@ packages/*/api
apps/examples/www/index.css
apps/examples/www/index.js
.tsbuild
packages/dotcom-worker/.dev.vars
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ apps/vscode/extension/editor/tldraw-assets.json
apps/docs/postcss.config.js
apps/docs/tailwind.config.js

apps/dotcom/public/sw.js
apps/dotcom/client/public/sw.js

patchedJestJsDom.js

Expand Down
2 changes: 1 addition & 1 deletion .eslintplugin.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require('ts-node/register')
module.exports = require('./scripts/lib/eslint-plugin.ts')
module.exports = require('./internal/scripts/lib/eslint-plugin.ts')
24 changes: 8 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ module.exports = {
},
// This overrides the default config for the given matching paths.
{
files: ['apps/dotcom/**/*'],
files: ['apps/dotcom/client/**/*'],
rules: {
'no-restricted-globals': [
'error',
Expand All @@ -200,11 +200,16 @@ module.exports = {
property: 'Image',
message: 'Use the Image from @tldraw/util instead.',
},
{
object: 'crypto',
property: 'randomUUID',
message: 'Please use the makeUUID util instead.',
},
],
},
},
{
files: 'scripts/**/*',
files: 'internal/scripts/**/*',
rules: {
'import/no-extraneous-dependencies': 'off',
},
Expand All @@ -227,23 +232,10 @@ module.exports = {
},
},
{
files: ['apps/huppy/**/*', 'scripts/**/*', 'apps/simple-server-example/**/*'],
files: ['internal/**/*', 'templates/simple-server-example/**/*'],
rules: {
'no-console': 'off',
},
},
{
files: ['apps/dotcom/**/*'],
rules: {
'no-restricted-properties': [
2,
{
object: 'crypto',
property: 'randomUUID',
message: 'Please use the makeUUID util instead.',
},
],
},
},
],
}
2 changes: 1 addition & 1 deletion .github/workflows/deploy-bemo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: yarn build-types

- name: Deploy
run: yarn tsx scripts/deploy-bemo.ts
run: yarn tsx internal/scripts/deploy-bemo.ts
env:
RELEASE_COMMIT_HASH: ${{ github.sha }}
GH_TOKEN: ${{ github.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dotcom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: yarn build-types

- name: Deploy
run: yarn tsx scripts/deploy-dotcom.ts
run: yarn tsx internal/scripts/deploy-dotcom.ts
env:
RELEASE_COMMIT_HASH: ${{ github.sha }}
GH_TOKEN: ${{ github.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prune-preview-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: ./.github/actions/setup

- name: Prune preview deploys
run: yarn tsx scripts/prune-preview-deploys.ts
run: yarn tsx internal/scripts/prune-preview-deploys.ts
env:
GH_TOKEN: ${{ github.token }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: ./.github/actions/setup

- name: Publish Canary Packages
run: yarn tsx ./scripts/publish-prerelease.ts internal
run: yarn tsx ./internal/scripts/publish-prerelease.ts internal
env:
GH_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Publish
id: publish_step
run: yarn tsx ./scripts/publish-manual.ts
run: yarn tsx ./internal/scripts/publish-manual.ts
env:
GH_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
git config --global user.name 'huppy-bot[bot]'
git config --global user.email '128400622+huppy-bot[bot]@users.noreply.github.com'
if [[ "${{ inputs.bump_type }}" == "override" ]]; then
yarn tsx ./scripts/publish-new.ts --bump ${{ inputs.version_override }}
yarn tsx ./internal/scripts/publish-new.ts --bump ${{ inputs.version_override }}
else
yarn tsx ./scripts/publish-new.ts --bump ${{ inputs.bump_type }}
yarn tsx ./internal/scripts/publish-new.ts --bump ${{ inputs.bump_type }}
fi
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: |
git config --global user.name 'huppy-bot[bot]'
git config --global user.email '128400622+huppy-bot[bot]@users.noreply.github.com'
yarn tsx ./scripts/publish-patch.ts
yarn tsx ./internal/scripts/publish-patch.ts
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-vscode-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: yarn get-info

- name: Publish extension
run: yarn tsx ./scripts/publish-vscode-extension.ts
run: yarn tsx ./internal/scripts/publish-vscode-extension.ts
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
TLDRAW_ENV: ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') }}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ apps/docs/content/reference/**/*
**/.wrangler/*
**/.out/*
**/.temp/*
apps/dotcom/public/**/*.*
apps/dotcom/client/public/**/*.*

**/.clasp.json
8 changes: 4 additions & 4 deletions apps/bemo-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"/* GOTCHA */": "files will include ./dist and index.d.ts by default, add any others you want to include in here",
"files": [],
"scripts": {
"dev": "yarn run -T tsx ../../scripts/workers/dev.ts",
"dev": "yarn run -T tsx ../../internal/scripts/workers/dev.ts",
"test-ci": "lazy inherit",
"test": "yarn run -T jest",
"test-coverage": "lazy inherit",
"check-bundle-size": "yarn run -T tsx ../../scripts/check-worker-bundle.ts --entry src/worker.ts --size-limit-bytes 350000",
"lint": "yarn run -T tsx ../../scripts/lint.ts"
"check-bundle-size": "yarn run -T tsx ../../internal/scripts/check-worker-bundle.ts --entry src/worker.ts --size-limit-bytes 350000",
"lint": "yarn run -T tsx ../../internal/scripts/lint.ts"
},
"dependencies": {
"@tldraw/dotcom-shared": "workspace:*",
Expand All @@ -38,7 +38,7 @@
"wrangler": "3.62.0"
},
"jest": {
"preset": "config/jest/node",
"preset": "../../internal/config/jest/node/jest-preset.js",
"moduleNameMapper": {
"^~(.*)": "<rootDir>/src/$1"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/bemo-worker/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../config/tsconfig.base.json",
"extends": "../../internal/config/tsconfig.base.json",
"include": ["src", "scripts"],
"exclude": ["node_modules", "dist", ".tsbuild*"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/blog/announcing-tldraw-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ We’ve designed tldraw sync to be self-hosted.
To use tldraw sync in production, first deploy the **sync server** on your backend of choice, configure it to work with your storage solution, and then connect to the server from your client application.

- We recommend starting from our [Cloudflare template](https://github.com/tldraw/tldraw-sync-cloudflare)
- For Node or Bun runtimes, check out our [generic server template](https://github.com/tldraw/tldraw/tree/main/apps/simple-server-example)
- For Node or Bun runtimes, check out our [generic server template](https://github.com/tldraw/tldraw/tree/main/templates/simple-server-example)

While we don’t offer a hosted version of tldraw sync for production, we do host a **demo server** that you can connect to immediately from any tldraw project. It’s our recommended way to explore collaboration in tldraw, develop your own multi-user features, and compare tldraw sync with alternative backends.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ While we're working on docs for this part of the project, please refer to the ex
- [Handling pasted / dropped external
content](/examples/data/assets/external-content-sources)
- [A simple asset store that uploads content to a remote
server](https://github.com/tldraw/tldraw/blob/main/apps/simple-server-example/src/client/App.tsx)
server](https://github.com/tldraw/tldraw/blob/main/templates/simple-server-example/src/client/App.tsx)
- [A more complex asset store that optimizes images when retrieving
them](https://github.com/tldraw/tldraw/blob/main/packages/sync/src/useSyncDemo.ts#L87)
8 changes: 4 additions & 4 deletions apps/docs/content/docs/sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Make sure you also read the section below about [deployment concerns](#deploymen

The `@tldraw/sync-core` library can be used to integrate tldraw sync into any JavaScript server environment that supports WebSockets.

We have a [simple server example](https://github.com/tldraw/tldraw/tree/main/apps/simple-server-example), supporting both NodeJS and Bun, to use as a reference for how things should be stitched together.
We have a [simple server example](https://github.com/tldraw/tldraw/tree/main/templates/simple-server-example), supporting both NodeJS and Bun, to use as a reference for how things should be stitched together.

## What does a tldraw sync backend do?

Expand Down Expand Up @@ -99,7 +99,7 @@ function registerUrlHandler(editor: Editor) {
}
```

And [here's a full working example](https://github.com/tldraw/tldraw/blob/main/apps/simple-server-example/src/client/App.tsx) of the client-side code.
And [here's a full working example](https://github.com/tldraw/tldraw/blob/main/templates/simple-server-example/src/client/App.tsx) of the client-side code.

### WebSocket server

Expand All @@ -118,7 +118,7 @@ The `@tldraw/sync-core` package exports a class called [`TLSocketRoom`](?) that
tldraw.com.
</Callout>

Read the reference docs for [`TLSocketRoom`](?), and see an example of how to use it in the [simple server example](https://github.com/tldraw/tldraw/blob/main/apps/simple-server-example/src/server/rooms.ts).
Read the reference docs for [`TLSocketRoom`](?), and see an example of how to use it in the [simple server example](https://github.com/tldraw/tldraw/blob/main/templates/simple-server-example/src/server/rooms.ts).

### Asset storage

Expand Down Expand Up @@ -149,7 +149,7 @@ This should be registered with the [`Editor`](?) when it loads.
/>
```

Refer to the simple server example for example [client](https://github.com/tldraw/tldraw/blob/main/apps/simple-server-example/src/client/App.tsx) and [server](https://github.com/tldraw/tldraw/blob/main/apps/simple-server-example/src/server/unfurl.ts) code.
Refer to the simple server example for example [client](https://github.com/tldraw/tldraw/blob/main/templates/simple-server-example/src/client/App.tsx) and [server](https://github.com/tldraw/tldraw/blob/main/templates/simple-server-example/src/server/unfurl.ts) code.

## Using tldraw sync in your app

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tldraw/docs",
"description": "A docs site for tldraw.",
"version": "2.0.0-next",
"version": "0.0.0",
"private": true,
"author": {
"name": "tldraw Inc.",
Expand All @@ -28,7 +28,7 @@
"scripts": {
"dev": "concurrently \"NODE_ENV=development next dev --port=3001\" \"tsx ./watcher.ts\" --kill-others",
"next-dev": "next dev",
"lint": "yarn run -T tsx ../../scripts/lint.ts",
"lint": "yarn run -T tsx ../../internal/scripts/lint.ts",
"build": "yarn refresh-everything && next build && yarn check-links",
"start": "yarn refresh-everything && next start",
"fetch-api-source": "yarn run -T tsx --tsconfig ./tsconfig.content.json ./scripts/fetch-api-source.ts",
Expand Down Expand Up @@ -114,7 +114,7 @@
"ws": "^8.16.0"
},
"jest": {
"preset": "config/jest/node",
"preset": "../../internal/config/jest/node/jest-preset.js",
"roots": [
"<rootDir>"
],
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../config/tsconfig.base.json",
"extends": "../../internal/config/tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is automatically generated by scripts/refresh-assets.ts.
// This file is automatically generated by internal/scripts/refresh-assets.ts.
// Do not edit manually. Or do, I'm a comment, not a cop.

export const version = '3.0.0'
Expand Down
85 changes: 0 additions & 85 deletions apps/dotcom-asset-upload/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit ab9833c

Please sign in to comment.