Tldraw/lazy.config.ts

126 wiersze
2.8 KiB
TypeScript
Czysty Zwykły widok Historia

2023-04-25 11:01:25 +00:00
import { LazyConfig } from 'lazyrepo'
export function generateSharedTasks(bublic: '<rootDir>' | '<rootDir>/bublic') {
return {
build: {
runsAfter: { 'build:package': {}, prebuild: {} },
},
'build:vscode-editor': {
runsAfter: { 'refresh-assets': {} },
},
dev: {
execution: 'independent',
runsAfter: { 'refresh-assets': {} },
cache: 'none',
},
'dev:vscode': {
runsAfter: { 'build:vscode-editor': {} },
},
test: {
baseCommand: 'yarn run -T jest',
runsAfter: { 'refresh-assets': {} },
},
'test:coverage': {
baseCommand: 'yarn run -T jest --coverage',
},
lint: {
execution: 'independent',
runsAfter: { 'build:types': {} },
},
'build:package': {
runsAfter: { 'build:api': {}, prebuild: {} },
cache: {
inputs: ['api/**/*', 'src/**/*'],
},
},
'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: [
derived presence state (#1204) This PR adds - A new `TLInstancePresence` record type, to collect info about the presence state in a particular instance of the editor. This will eventually be used to sync presence data instead of sending instance-only state across the wire. - **Record Scopes** `RecordType` now has a `scope` property which can be one of three things: - `document`: the record belongs to the document and should be synced and persisted freely. Currently: `TLDocument`, `TLPage`, `TLShape`, and `TLAsset` - `instance`: the record belongs to a single instance of the store and should not be synced at all. It should not be persisted directly in most cases, but rather compiled into a kind of 'instance configuration' to store alongside the local document data so that when reopening the associated document it can remember some of the previous instance state. Currently: `TLInstance`, `TLInstancePageState`, `TLCamera`, `TLUser`, `TLUserDocument`, `TLUserPresence` - `presence`: the record belongs to a single instance of the store and should not be persisted, but may be synced using the special presence sync protocol. Currently just `TLInstancePresence` This sets us up for the following changes, which are gonna be pretty high-impact in terms of integrating tldraw into existing systems: - Removing `instanceId` as a config option. Each instance gets a randomly generated ID. - We'd replace it with an `instanceConfig` option that has stuff like selectedIds, camera positions, and so on. Then it's up to library users to get and reinstate the instance config at persistence boundaries. - Removing `userId` as config option, and removing the `TLUser` type altogether. - We might need to revisit when doing auth-enabled features like locking shapes, but I suspect that will be separate.
2023-04-27 18:03:19 +00:00
'{,bublic/}packages/*/src/**/*.{ts,tsx}',
'{,bublic/}{apps,scripts,e2e}/**/*.{ts,tsx}',
'{,bublic/}{apps,packages}/*/tsconfig.json',
'{,bublic/}{scripts,e2e}/tsconfig.json',
2023-04-25 11:01:25 +00:00
],
exclude: ['**/dist*/**/*.d.ts'],
},
},
runsAfter: {
'refresh-assets': {},
'maybe-clean-tsbuildinfo': {},
},
},
'build:api': {
execution: 'independent',
cache: {
inputs: ['.tsbuild/**/*.d.ts', 'tsconfig.json'],
},
runsAfter: { 'build:types': {} },
},
'build:docs': {
runsAfter: { 'docs:content': {} },
},
'dev:docs': {
runsAfter: { 'docs:content': {} },
},
'app:build': {
runsAfter: { 'build:types': {} },
},
'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: {
derived presence state (#1204) This PR adds - A new `TLInstancePresence` record type, to collect info about the presence state in a particular instance of the editor. This will eventually be used to sync presence data instead of sending instance-only state across the wire. - **Record Scopes** `RecordType` now has a `scope` property which can be one of three things: - `document`: the record belongs to the document and should be synced and persisted freely. Currently: `TLDocument`, `TLPage`, `TLShape`, and `TLAsset` - `instance`: the record belongs to a single instance of the store and should not be synced at all. It should not be persisted directly in most cases, but rather compiled into a kind of 'instance configuration' to store alongside the local document data so that when reopening the associated document it can remember some of the previous instance state. Currently: `TLInstance`, `TLInstancePageState`, `TLCamera`, `TLUser`, `TLUserDocument`, `TLUserPresence` - `presence`: the record belongs to a single instance of the store and should not be persisted, but may be synced using the special presence sync protocol. Currently just `TLInstancePresence` This sets us up for the following changes, which are gonna be pretty high-impact in terms of integrating tldraw into existing systems: - Removing `instanceId` as a config option. Each instance gets a randomly generated ID. - We'd replace it with an `instanceConfig` option that has stuff like selectedIds, camera positions, and so on. Then it's up to library users to get and reinstate the instance config at persistence boundaries. - Removing `userId` as config option, and removing the `TLUser` type altogether. - We might need to revisit when doing auth-enabled features like locking shapes, but I suspect that will be separate.
2023-04-27 18:03:19 +00:00
inputs: [`${bublic}/packages/*/api/public.d.ts`],
2023-04-25 11:01:25 +00:00
},
},
} satisfies LazyConfig['tasks']
}
const config = {
baseCacheConfig: {
include: [
'<rootDir>/package.json',
'<rootDir>/public-yarn.lock',
'<rootDir>/lazy.config.ts',
2023-04-25 11:01:25 +00:00
'<rootDir>/config/**/*',
'<rootDir>/scripts/**/*',
],
exclude: [
'coverage/**/*',
'dist*/**/*',
'**/*.tsbuildinfo',
'<rootDir>/apps/app/bublic/*.{js,map}',
'<rootDir>/apps/docs/content/gen/**/*',
],
},
tasks: {
...generateSharedTasks('<rootDir>'),
},
} satisfies LazyConfig
export default config