tldraw/lazy.config.ts
David Sheldrick a3896fc492
[fix] Don't synchronize isReadOnly (#1396)
We were storing the state of whether or not a document is read-only in
the store. It does not need to be stored there, and it was creating
consistency problems for us, so let's not store it in there.

fixes https://github.com/tldraw/brivate/issues/1864 

### Change Type

<!-- 💡 Indicate the type of change your pull request is. -->
<!-- 🤷‍♀️ If you're not sure, don't select anything -->
<!-- ✂️ Feel free to delete unselected options -->

<!-- To select one, put an x in the box: [x] -->

- [ ] `patch` — Bug Fix
- [ ] `minor` — New Feature
- [x] `major` — Breaking Change
- [ ] `dependencies` — Dependency Update (publishes a `patch` release,
for devDependencies use `internal`)
- [ ] `documentation` — Changes to the documentation only (will not
publish a new version)
- [ ] `tests` — Changes to any testing-related code only (will not
publish a new version)
- [ ] `internal` — Any other changes that don't affect the published
package (will not publish a new version)

### Test Plan

1. Create a multiplayer room
2. Create a read-only link for the room
3. Paste the link into a new browser tab (not incognito, needs to have
the same session state)
4. Check the room is read-only in the new tab
5. Check the room is still writable in the previous tab.

### Release Notes

- Removes the isReadOnly value from the `user_document_settings` record
type.
2023-05-17 10:45:43 +00:00

138 lines
3.6 KiB
TypeScript

import { LazyConfig } from 'lazyrepo'
export function generateSharedScripts(bublic: '<rootDir>' | '<rootDir>/bublic') {
return {
build: {
baseCommand: 'exit 0',
runsAfter: { prebuild: {}, 'refresh-assets': {} },
workspaceOverrides: {
'{bublic/,}apps/docs': { runsAfter: { 'docs-content': {} } },
'{bublic/,}apps/vscode/*': { runsAfter: { 'refresh-assets': {} } },
'{bublic/,}packages/*': {
runsAfter: { 'build-api': { in: 'self-only' }, prebuild: { in: 'self-only' } },
cache: {
inputs: ['api/**/*', 'src/**/*'],
},
},
},
},
dev: {
execution: 'independent',
runsAfter: { 'refresh-assets': {} },
cache: 'none',
workspaceOverrides: {
'{bublic/,}apps/docs': { runsAfter: { 'docs-content': { in: 'self-only' } } },
'{bublic/,}apps/vscode/*': { runsAfter: { build: { in: 'self-only' } } },
'{bublic/,}apps/webdriver': {
runsAfter: { 'refresh-assets': {}, prebuild: {} },
cache: 'none',
},
},
},
test: {
baseCommand: 'yarn run -T jest',
runsAfter: { 'refresh-assets': {} },
cache: {
inputs: {
exclude: ['*.tsbuildinfo'],
},
},
},
'test-coverage': {
baseCommand: 'yarn run -T jest --coverage',
runsAfter: { 'refresh-assets': {} },
},
lint: {
execution: 'independent',
runsAfter: { 'build-types': {} },
cache: {
inputs: {
exclude: ['*.tsbuildinfo'],
},
},
},
'pack-tarball': {
parallel: false,
},
'refresh-assets': {
execution: 'top-level',
baseCommand: `tsx ${bublic}/scripts/refresh-assets.ts`,
cache: {
inputs: ['package.json', `${bublic}/scripts/refresh-assets.ts`, `${bublic}/assets/**/*`],
},
},
'build-types': {
execution: 'top-level',
baseCommand: `tsx ${bublic}/scripts/typecheck.ts`,
cache: {
inputs: {
include: ['<allWorkspaceDirs>/**/*.{ts,tsx}', '<allWorkspaceDirs>/tsconfig.json'],
exclude: ['<allWorkspaceDirs>/dist*/**/*', '<allWorkspaceDirs>/api/**/*'],
},
outputs: ['<allWorkspaceDirs>/*.tsbuildinfo', '<allWorkspaceDirs>/.tsbuild/**/*'],
},
runsAfter: {
'refresh-assets': {},
'maybe-clean-tsbuildinfo': {},
},
},
'build-api': {
execution: 'independent',
cache: {
inputs: ['.tsbuild/**/*.d.ts', 'tsconfig.json'],
outputs: ['api/**/*'],
},
runsAfter: {
'build-types': {
// Because build-types is top level, if usesOutput were set to true every
// build-api task would depend on all the .tsbuild files in the whole
// repo. So we set this to false and configure it to use only the
// local .tsbuild files
usesOutput: false,
},
},
},
'docs-content': {
runsAfter: { 'build-api': {} },
cache: {
inputs: [
'content/**',
'scripts/**',
`${bublic}/packages/*/api/api.json`,
`${bublic}/packages/*/package.json`,
],
},
},
'api-check': {
execution: 'top-level',
baseCommand: `tsx ${bublic}/scripts/api-check.ts`,
runsAfter: { 'build-api': {} },
cache: {
inputs: [`${bublic}/packages/*/api/public.d.ts`],
},
},
} satisfies LazyConfig['scripts']
}
const config = {
baseCacheConfig: {
include: [
'<rootDir>/{,bublic/}package.json',
'<rootDir>/{,bublic/}public-yarn.lock',
'<rootDir>/{,bublic/}lazy.config.ts',
'<rootDir>/{,bublic/}config/**/*',
'<rootDir>/{,bublic/}scripts/**/*',
],
exclude: [
'<allWorkspaceDirs>/coverage/**/*',
'<allWorkspaceDirs>/dist*/**/*',
'**/*.tsbuildinfo',
'<rootDir>/{,bublic/}apps/docs/content/gen/**/*',
],
},
scripts: {
...generateSharedScripts('<rootDir>'),
},
} satisfies LazyConfig
export default config