Tldraw/lazy.config.ts

122 wiersze
3.1 KiB
TypeScript
Czysty Zwykły widok Historia

2023-04-25 11:01:25 +00:00
import { LazyConfig } from 'lazyrepo'
2023-05-02 12:25:26 +00:00
export function generateSharedScripts(bublic: '<rootDir>' | '<rootDir>/bublic') {
2023-04-25 11:01:25 +00:00
return {
build: {
baseCommand: 'exit 0',
runsAfter: { prebuild: {}, 'refresh-assets': {} },
workspaceOverrides: {
'{bublic/,}apps/vscode/*': { runsAfter: { 'refresh-assets': {} } },
'{bublic/,}packages/*': {
runsAfter: { 'build-api': { in: 'self-only' }, prebuild: { in: 'self-only' } },
cache: {
inputs: ['api/**/*', 'src/**/*'],
},
},
},
2023-04-25 11:01:25 +00:00
},
dev: {
execution: 'independent',
runsAfter: { 'refresh-assets': {} },
cache: 'none',
workspaceOverrides: {
'{bublic/,}apps/vscode/*': { runsAfter: { build: { in: 'self-only' } } },
},
},
2023-04-25 11:01:25 +00:00
test: {
baseCommand: 'yarn run -T jest',
runsAfter: { 'refresh-assets': {} },
cache: {
inputs: {
exclude: ['*.tsbuildinfo'],
},
},
2023-04-25 11:01:25 +00:00
},
2023-05-02 12:25:26 +00:00
'test-coverage': {
2023-04-25 11:01:25 +00:00
baseCommand: 'yarn run -T jest --coverage',
runsAfter: { 'refresh-assets': {} },
2023-04-25 11:01:25 +00:00
},
lint: {
execution: 'independent',
2023-05-02 12:25:26 +00:00
runsAfter: { 'build-types': {} },
cache: {
inputs: {
exclude: ['*.tsbuildinfo'],
},
},
2023-04-25 11:01:25 +00:00
},
'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/**/*`],
},
},
2023-05-02 12:25:26 +00:00
'build-types': {
2023-04-25 11:01:25 +00:00
execution: 'top-level',
baseCommand: `tsx ${bublic}/scripts/typecheck.ts`,
cache: {
inputs: {
2023-05-02 12:25:26 +00:00
include: ['<allWorkspaceDirs>/**/*.{ts,tsx}', '<allWorkspaceDirs>/tsconfig.json'],
exclude: ['<allWorkspaceDirs>/dist*/**/*', '<allWorkspaceDirs>/api/**/*'],
2023-04-25 11:01:25 +00:00
},
2023-05-02 12:25:26 +00:00
outputs: ['<allWorkspaceDirs>/*.tsbuildinfo', '<allWorkspaceDirs>/.tsbuild/**/*'],
2023-04-25 11:01:25 +00:00
},
runsAfter: {
'refresh-assets': {},
'maybe-clean-tsbuildinfo': {},
},
},
2023-05-02 12:25:26 +00:00
'build-api': {
2023-04-25 11:01:25 +00:00
execution: 'independent',
cache: {
inputs: ['.tsbuild/**/*.d.ts', 'tsconfig.json'],
2023-05-02 12:25:26 +00:00
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,
},
2023-04-25 11:01:25 +00:00
},
},
2023-05-02 12:25:26 +00:00
'api-check': {
2023-04-25 11:01:25 +00:00
execution: 'top-level',
baseCommand: `tsx ${bublic}/scripts/api-check.ts`,
2023-05-02 12:25:26 +00:00
runsAfter: { 'build-api': {} },
2023-04-25 11:01:25 +00:00
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
},
},
2023-05-02 12:25:26 +00:00
} satisfies LazyConfig['scripts']
2023-04-25 11:01:25 +00:00
}
const config = {
baseCacheConfig: {
include: [
2023-05-02 12:25:26 +00:00
'<rootDir>/{,bublic/}package.json',
'<rootDir>/{,bublic/}public-yarn.lock',
'<rootDir>/{,bublic/}lazy.config.ts',
'<rootDir>/{,bublic/}config/**/*',
'<rootDir>/{,bublic/}scripts/**/*',
2023-04-25 11:01:25 +00:00
],
exclude: [
2023-05-02 12:25:26 +00:00
'<allWorkspaceDirs>/coverage/**/*',
'<allWorkspaceDirs>/dist*/**/*',
2023-04-25 11:01:25 +00:00
'**/*.tsbuildinfo',
'<rootDir>/{,bublic/}docs/gen/**/*',
2023-04-25 11:01:25 +00:00
],
},
2023-05-02 12:25:26 +00:00
scripts: {
...generateSharedScripts('<rootDir>'),
2023-04-25 11:01:25 +00:00
},
} satisfies LazyConfig
export default config