Skip to content

chore(workflow): bundless shared and add references #1044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,5 @@ CLAUDE.md
**/CLAUDE.md
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md
.gemini-clipboard
.gemini-clipboard
tsconfig.build.tsbuildinfo
1 change: 1 addition & 0 deletions apps/android-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@rsbuild/plugin-node-polyfill": "1.3.0",
"@rsbuild/plugin-react": "^1.3.1",
"@rsbuild/plugin-svgr": "^1.1.1",
"@rsbuild/plugin-type-check": "1.2.3",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.1",
"archiver": "^6.0.0",
Expand Down
3 changes: 3 additions & 0 deletions apps/android-playground/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export default defineConfig({
'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
},
},
output: {
externals: ['sharp'],
},
plugins: [
pluginReact(),
pluginNodePolyfill(),
Expand Down
22 changes: 20 additions & 2 deletions apps/android-playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,25 @@
/* type checking */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true
"noUnusedParameters": true,
"composite": true
},
"include": ["src"]
"include": ["src"],
"references": [
{
"path": "../../packages/android"
},
{
"path": "../../packages/core"
},
{
"path": "../../packages/shared"
},
{
"path": "../../packages/visualizer"
},
{
"path": "../../packages/web-integration"
}
]
}
3 changes: 2 additions & 1 deletion apps/chrome-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"archiver": "^6.0.0",
"less": "^4.2.0",
"tailwindcss": "4.1.11",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"openai": "4.81.0"
}
}
5 changes: 3 additions & 2 deletions apps/chrome-extension/src/extension/recorder/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { ChromeRecordedEvent } from '@midscene/recorder';
import { message } from 'antd';
import { saveAs } from 'file-saver';
import JSZip from 'jszip';
import type { ChatCompletionContentPart } from 'openai/resources/index';
import type { RecordingSession } from '../../store';
import { recordLogger } from './logger';
import { isChromeExtension, safeChromeAPI } from './types';
Expand Down Expand Up @@ -278,7 +279,7 @@ export const generateRecordTitle = async (
const screenshots = getScreenshotsForLLM(events);

// Create the message content
const messageContent: Array<string | Record<string, any>> = [
const messageContent: ChatCompletionContentPart[] = [
{
type: 'text',
text: `Generate a concise title (5-7 words) and brief description (1-2 sentences) for a browser recording session with the following events:\n\n${JSON.stringify(summary, null, 2)}\n\nRespond with a JSON object containing "title" and "description" fields. The title should be action-oriented and highlight the main task accomplished. The description should provide slightly more detail about what was done.`,
Expand Down Expand Up @@ -313,7 +314,7 @@ export const generateRecordTitle = async (
role: 'user',
content: messageContent,
},
];
] as const;

const response = await callAiFn(
[prompt[0], prompt[1]],
Expand Down
22 changes: 20 additions & 2 deletions apps/chrome-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,25 @@
/* type checking */
"strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false
"noUnusedParameters": false,
"composite": true
},
"include": ["src"]
"include": ["src"],
"references": [
{
"path": "../../packages/core"
},
{
"path": "../../packages/recorder"
},
{
"path": "../../packages/shared"
},
{
"path": "../../packages/visualizer"
},
{
"path": "../../packages/web-integration"
}
]
}
1 change: 1 addition & 0 deletions apps/recorder-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"devDependencies": {
"@rsbuild/plugin-node-polyfill": "1.3.0",
"@rsbuild/plugin-type-check": "1.2.3",
"@rsbuild/core": "^1.3.22",
"@rsbuild/plugin-react": "^1.3.1",
"@types/react": "^18.3.1",
Expand Down
5 changes: 4 additions & 1 deletion apps/report/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ const copyReportTemplate = () => ({
const jsFiles = fs.readdirSync(corePkgDistDir, { recursive: true });
let replacedCount = 0;
for (const file of jsFiles) {
if (typeof file === 'string' && file.endsWith('.js')) {
if (
typeof file === 'string' &&
(file.endsWith('.js') || file.endsWith('.mjs'))
) {
const filePath = path.join(corePkgDistDir, file.toString());
const fileContent = fs.readFileSync(filePath, 'utf-8');
if (fileContent.includes(replacedMark)) {
Expand Down
20 changes: 18 additions & 2 deletions apps/report/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,23 @@

"paths": {
"@/*": ["./src/*"]
}
},
"composite": true,
"declarationDir": "dist/types"
},
"include": ["src"]
"include": ["src"],
"references": [
{
"path": "../../packages/core"
},
{
"path": "../../packages/shared"
},
{
"path": "../../packages/visualizer"
},
{
"path": "../../packages/web-integration"
}
]
}
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"**/page-data/**",
"**/dump.json",
"**/dump-with-invisible.json",
"**/dump-for-utils-test.json"
"**/dump-for-utils-test.json",
"**/.rslib"
]
},
"javascript": {
Expand Down
1 change: 1 addition & 0 deletions packages/android-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Android playground for Midscene",
"main": "./dist/lib/index.js",
"types": "./dist/types/index.d.ts",
"module": "./dist/es/index.mjs",
"files": ["dist", "static", "bin", "README.md"],
"bin": {
"midscene-android-playground": "./bin/android-playground",
Expand Down
2 changes: 0 additions & 2 deletions packages/android-playground/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default defineConfig({
root: 'dist/lib',
},
},
autoExtension: false,
format: 'cjs',
syntax: 'es2020',
},
Expand All @@ -18,7 +17,6 @@ export default defineConfig({
root: 'dist/es',
},
},
autoExtension: false,
dts: {
bundle: true,
distPath: 'dist/types',
Expand Down
19 changes: 16 additions & 3 deletions packages/android-playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,28 @@
"isolatedModules": true,
"jsx": "preserve",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"rootDir": "src",
"skipLibCheck": true,
"strict": true,
"module": "ES2020",
"target": "es2020",
"types": ["node"]
"types": ["node"],
"composite": true,
"declarationDir": "dist/types"
},
"exclude": ["**/node_modules"],
"include": ["src"]
"include": ["src"],
"references": [
{
"path": "../android"
},
{
"path": "../shared"
},
{
"path": "../web-integration"
}
]
}
4 changes: 3 additions & 1 deletion packages/android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"Android use"
],
"main": "./dist/lib/index.js",
"module": "./dist/es/index.mjs",
"types": "./dist/types/index.d.ts",
"files": ["bin", "dist", "README.md"],
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"default": "./dist/lib/index.js"
"import": "./dist/es/index.mjs",
"require": "./dist/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/android/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default defineConfig({
root: 'dist/lib',
},
},
autoExtension: false,
format: 'cjs',
syntax: 'es2020',
},
Expand All @@ -18,7 +17,6 @@ export default defineConfig({
root: 'dist/es',
},
},
autoExtension: false,
dts: {
bundle: true,
distPath: 'dist/types',
Expand Down
21 changes: 14 additions & 7 deletions packages/android/tests/unit-test/page.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,23 @@ vi.mock('appium-adb', () => {

vi.mock('@midscene/shared/img');
vi.mock('@midscene/core/utils');
vi.mock('node:fs', () => ({
promises: {
readFile: vi.fn(),
},
default: {
vi.mock('node:fs', async (importOriginal) => {
const original = (await importOriginal()) as {
default: Record<string, unknown>;
};
return {
...original,
promises: {
readFile: vi.fn(),
},
},
}));
default: {
...original.default,
promises: {
readFile: vi.fn(),
},
},
};
});

describe('AndroidDevice', () => {
let device: AndroidDevice;
Expand Down
19 changes: 16 additions & 3 deletions packages/android/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,28 @@
"isolatedModules": true,
"jsx": "preserve",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"rootDir": "src",
"skipLibCheck": true,
"strict": true,
"module": "ES2020",
"target": "es2020",
"types": ["node"]
"types": ["node"],
"composite": true,
"declarationDir": "dist/types"
},
"exclude": ["**/node_modules"],
"include": ["src"]
"include": ["src"],
"references": [
{
"path": "../core"
},
{
"path": "../shared"
},
{
"path": "../web-integration"
}
]
}
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": "https://github.com/web-infra-dev/midscene",
"homepage": "https://midscenejs.com/",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.mjs",
"bin": {
"midscene": "./bin/midscene"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default defineConfig({
root: 'dist/lib',
},
},
autoExtension: false,
format: 'cjs',
// disable default shims for import.meta.url
shims: {
Expand All @@ -31,7 +30,6 @@ export default defineConfig({
root: 'dist/es',
},
},
autoExtension: false,
format: 'esm',
syntax: 'es2020',
dts: {
Expand Down
23 changes: 20 additions & 3 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,32 @@
"isolatedModules": true,
"jsx": "preserve",
"lib": ["ESNext", "DOM"],
"moduleResolution": "node",
"moduleResolution": "bundler",
"module": "esnext",
"paths": {
"@/*": ["./src/*"]
},
"resolveJsonModule": true,
"rootDir": ".",
"skipLibCheck": true,
"strict": true
"strict": true,
"composite": true,
"declarationDir": "dist/types"
},
"exclude": ["**/node_modules"],
"include": ["src", "tests"]
"include": ["src", "tests"],
"references": [
{
"path": "../android"
},
{
"path": "../core"
},
{
"path": "../shared"
},
{
"path": "../web-integration"
}
]
}
Loading