Skip to content

Commit

Permalink
Improve development tooling (rrweb-io#1516)
Browse files Browse the repository at this point in the history
- Running `yarn build` in a `packages/*/` directory will trigger build of all dependencies too, and cache them if possible.
- Fix for `yarn dev` breaking for `rrweb` package whenever changing files in `rrweb` package
- Update typescript, turbo, vite and vite-plugin-dts
- Require `workspaces-to-typescript-project-references` from `prepublish`
  • Loading branch information
Juice10 authored Jun 21, 2024
1 parent a2c8a1a commit a756a45
Show file tree
Hide file tree
Showing 54 changed files with 416 additions and 243 deletions.
2 changes: 2 additions & 0 deletions .changeset/wicked-lions-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
3 changes: 2 additions & 1 deletion .vscode/rrweb-monorepo.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"@rrweb/rrweb-plugin-sequential-id",
"@rrweb/rrweb-plugin-canvas-webrtc-record",
"@rrweb/rrweb-plugin-canvas-webrtc-replay"
]
],
"typescript.tsdk": " rrweb monorepo/node_modules/typescript/lib"
}
}
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@
"markdownlint": "^0.25.1",
"markdownlint-cli": "^0.31.1",
"prettier": "2.8.4",
"turbo": "^2.0.3",
"typescript": "^4.9.5"
"turbo": "^2.0.4",
"typescript": "^5.4.5"
},
"scripts": {
"build:all": "NODE_OPTIONS='--max-old-space-size=4096' yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references' 'yarn turbo run prepublish'",
"test": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references --check' 'yarn turbo run test --concurrency=1 --continue'",
"build:all": "NODE_OPTIONS='--max-old-space-size=4096' yarn turbo run prepublish",
"references:update": "yarn workspaces-to-typescript-project-references",
"test": "yarn turbo run test --concurrency=1 --continue",
"test:watch": "yarn turbo run test:watch",
"test:update": "yarn turbo run test:update",
"check-types": "yarn turbo run check-types --continue",
"format": "yarn prettier --write '**/*.{ts,md}'",
"format:head": "git diff --name-only HEAD^ |grep '\\.ts$\\|\\.md$' |xargs yarn prettier --write",
"dev": "CLEAR_DIST_DIR=false yarn turbo run dev --concurrency=17",
"dev": "yarn turbo run dev --concurrency=17",
"repl": "cd packages/rrweb && npm run repl",
"live-stream": "cd packages/rrweb && yarn live-stream",
"lint": "yarn run concurrently --success=all -r -m=1 'yarn run markdownlint docs' 'yarn eslint packages/*/src --ext .ts,.tsx,.js,.jsx,.svelte'",
Expand Down
10 changes: 5 additions & 5 deletions packages/all/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"test": "vitest run",
"test:watch": "vitest watch",
"check-types": "tsc -noEmit",
"prepublish": "npm run build",
"prepublish": "tsc -noEmit && vite build",
"lint": "yarn eslint src/**/*.ts"
},
"homepage": "https://github.com/rrweb-io/rrweb/tree/main/packages/@rrweb/all#readme",
Expand Down Expand Up @@ -50,10 +50,10 @@
],
"devDependencies": {
"puppeteer": "^20.9.0",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.4.0",
"typescript": "^4.7.3"
"typescript": "^5.4.5"
},
"dependencies": {
"@rrweb/types": "^2.0.0-alpha.15",
Expand Down
10 changes: 5 additions & 5 deletions packages/packer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"test": "vitest run",
"test:watch": "vitest watch",
"check-types": "tsc -noEmit",
"prepublish": "npm run build",
"prepublish": "tsc -noEmit && vite build",
"lint": "yarn eslint src/**/*.ts"
},
"homepage": "https://github.com/rrweb-io/rrweb/tree/main/packages/@rrweb/packer#readme",
Expand Down Expand Up @@ -71,10 +71,10 @@
"package.json"
],
"devDependencies": {
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.4.0",
"typescript": "^4.7.3"
"typescript": "^5.4.5"
},
"dependencies": {
"fflate": "^0.4.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/packer/src/pack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strFromU8, strToU8, zlibSync } from 'fflate';
import type { PackFn } from '@rrweb/types';
import { eventWithTimeAndPacker, MARK } from './base';
import { type eventWithTimeAndPacker, MARK } from './base';

export const pack: PackFn = (event) => {
const _e: eventWithTimeAndPacker = {
Expand Down
2 changes: 1 addition & 1 deletion packages/packer/src/unpack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strFromU8, strToU8, unzlibSync } from 'fflate';
import { eventWithTimeAndPacker, MARK } from './base';
import { type eventWithTimeAndPacker, MARK } from './base';
import type { UnpackFn, eventWithTime } from '@rrweb/types';

export const unpack: UnpackFn = (raw: string) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"prepublish": "npm run build"
"prepublish": "tsc -noEmit && vite build"
},
"repository": {
"type": "git",
Expand All @@ -44,9 +44,9 @@
"homepage": "https://github.com/rrweb-io/rrweb#readme",
"devDependencies": {
"rrweb": "^2.0.0-alpha.15",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1"
"typescript": "^5.4.5",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1"
},
"peerDependencies": {
"rrweb": "^2.0.0-alpha.15"
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"prepublish": "npm run build"
"prepublish": "tsc -noEmit && vite build"
},
"repository": {
"type": "git",
Expand All @@ -44,9 +44,9 @@
"homepage": "https://github.com/rrweb-io/rrweb#readme",
"devDependencies": {
"rrweb": "^2.0.0-alpha.15",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1"
"typescript": "^5.4.5",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1"
},
"peerDependencies": {
"rrweb": "^2.0.0-alpha.15"
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/rrweb-plugin-console-record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"dev": "vite build --watch",
"test": "vitest run",
"test:watch": "vitest watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"prepublish": "npm run build"
"prepublish": "tsc -noEmit && vite build"
},
"repository": {
"type": "git",
Expand All @@ -46,9 +46,9 @@
"homepage": "https://github.com/rrweb-io/rrweb#readme",
"devDependencies": {
"rrweb": "^2.0.0-alpha.15",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1",
"typescript": "^5.4.5",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.4.0",
"puppeteer": "^20.9.0"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/rrweb-plugin-console-replay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"prepublish": "npm run build"
"prepublish": "tsc -noEmit && vite build"
},
"repository": {
"type": "git",
Expand All @@ -45,9 +45,9 @@
"devDependencies": {
"@rrweb/rrweb-plugin-console-record": "^2.0.0-alpha.15",
"rrweb": "^2.0.0-alpha.15",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1"
"typescript": "^5.4.5",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1"
},
"peerDependencies": {
"rrweb": "^2.0.0-alpha.15"
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/rrweb-plugin-console-replay/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
LogLevel,
LogData,
type LogLevel,
type LogData,
PLUGIN_NAME,
} from '@rrweb/rrweb-plugin-console-record';
import type { eventWithTime } from '@rrweb/types';
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/rrweb-plugin-sequential-id-record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"prepublish": "npm run build"
"prepublish": "tsc -noEmit && vite build"
},
"repository": {
"type": "git",
Expand All @@ -44,9 +44,9 @@
"homepage": "https://github.com/rrweb-io/rrweb#readme",
"devDependencies": {
"rrweb": "^2.0.0-alpha.15",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1"
"typescript": "^5.4.5",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1"
},
"peerDependencies": {
"rrweb": "^2.0.0-alpha.15"
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/rrweb-plugin-sequential-id-replay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"prepublish": "npm run build"
"prepublish": "tsc -noEmit && vite build"
},
"repository": {
"type": "git",
Expand All @@ -45,9 +45,9 @@
"devDependencies": {
"@rrweb/rrweb-plugin-sequential-id-record": "^2.0.0-alpha.15",
"rrweb": "^2.0.0-alpha.15",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1"
"typescript": "^5.4.5",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1"
},
"peerDependencies": {
"rrweb": "^2.0.0-alpha.15"
Expand Down
10 changes: 5 additions & 5 deletions packages/record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"test": "vitest run",
"test:watch": "vitest watch",
"check-types": "tsc -noEmit",
"prepublish": "npm run build",
"prepublish": "tsc -noEmit && vite build",
"lint": "yarn eslint src/**/*.ts"
},
"homepage": "https://github.com/rrweb-io/rrweb/tree/main/packages/@rrweb/record#readme",
Expand Down Expand Up @@ -49,10 +49,10 @@
],
"devDependencies": {
"puppeteer": "^20.9.0",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.4.0",
"typescript": "^4.7.3"
"typescript": "^5.4.5"
},
"dependencies": {
"@rrweb/types": "^2.0.0-alpha.15",
Expand Down
10 changes: 5 additions & 5 deletions packages/replay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
],
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"test": "vitest run",
"test:watch": "vitest watch",
"check-types": "tsc -noEmit",
"prepublish": "npm run build",
"prepublish": "tsc -noEmit && vite build",
"lint": "yarn eslint src/**/*.ts"
},
"homepage": "https://github.com/rrweb-io/rrweb/tree/main/packages/@rrweb/replay#readme",
Expand Down Expand Up @@ -50,10 +50,10 @@
],
"devDependencies": {
"puppeteer": "^20.9.0",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.4.0",
"typescript": "^4.7.3"
"typescript": "^5.4.5"
},
"dependencies": {
"@rrweb/types": "^2.0.0-alpha.15",
Expand Down
7 changes: 6 additions & 1 deletion packages/replay/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ import {
} from 'rrweb';
import 'rrweb/dist/style.css';

export { Replayer, playerConfig, PlayerMachineState, SpeedMachineState };
export {
Replayer,
type playerConfig,
type PlayerMachineState,
type SpeedMachineState,
};
15 changes: 6 additions & 9 deletions packages/rrdom-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "2.0.0-alpha.15",
"scripts": {
"dev": "vite build --watch",
"build": "tsc -noEmit && vite build",
"build": "yarn turbo run prepublish",
"check-types": "tsc -noEmit",
"test": "vitest run",
"test:watch": "vitest watch",
"prepublish": "npm run build",
"prepublish": "tsc -noEmit && vite build",
"lint": "yarn eslint src/**/*.ts"
},
"keywords": [
Expand Down Expand Up @@ -46,19 +46,16 @@
"compare-versions": "^4.1.3",
"eslint": "^8.15.0",
"puppeteer": "^9.1.1",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.4.0",
"typescript": "^4.7.3"
"typescript": "^5.4.5"
},
"dependencies": {
"cssom": "^0.5.0",
"cssstyle": "^2.3.0",
"nwsapi": "^2.2.0",
"rrdom": "^2.0.0-alpha.15",
"rrweb-snapshot": "^2.0.0-alpha.15"
},
"browserslist": [
"supports es6-class"
]
}
}
4 changes: 2 additions & 2 deletions packages/rrdom-nodejs/src/document-nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
BaseRRNode,
BaseRRText,
ClassList,
IRRDocument,
CSSStyleDeclaration,
type IRRDocument,
type CSSStyleDeclaration,
} from 'rrdom';
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
const nwsapi = require('nwsapi');
Expand Down
Loading

0 comments on commit a756a45

Please sign in to comment.