Skip to content

Migrate devtools package to Typescript #5

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 2 commits into from
May 30, 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
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ jobs:
node-version: 20
- run: corepack enable
- run: yarn install --immutable
- run: yarn lint
- run: yarn test
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "yarn workspace @immutable/devtools-extension run dev",
"build": "yarn workspaces foreach --all -pt run build",
"lint": "yarn workspaces foreach --all -pt run lint",
"test": "yarn workspaces foreach --all -pt run test",
"version": "node build/update-version.js && git add packages/extension/extension/manifest.json && git add packages/*/package.json && yarn"
},
Expand All @@ -22,6 +23,7 @@
"@babel/preset-env": "^7.27.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^16.0.1",
"rollup": "^4.41.0"
"rollup": "^4.41.0",
"ts-node": "^10.9.2"
}
}
4 changes: 2 additions & 2 deletions packages/devtools/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
}
7 changes: 0 additions & 7 deletions packages/devtools/jest.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions packages/devtools/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Config } from 'jest';

const config: Config = {
testPathIgnorePatterns: ['<rootDir>/test.js'],
};

export default config;
17 changes: 14 additions & 3 deletions packages/devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
"type": "module",
"version": "2.1.1",
"description": "Chrome Dev Tools formatter for the Immutable JS library",
"exports": "./dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist"
],
"scripts": {
"build": "rollup -c",
"build:types": "tsc",
"build:module": "rollup -c",
"build": "yarn run build:types && yarn run build:module",
"lint:types": "tsc --noEmit",
"lint": "yarn run lint:types",
"prepublishOnly": "npm run-script build",
"test": "jest"
},
Expand All @@ -22,12 +31,14 @@
"devDependencies": {
"@babel/core": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-typescript": "^7.27.1",
"@jest/globals": "^29.7.0",
"@rollup/plugin-babel": "^6.0.4",
"immutable": "^5.1.2",
"immutable3": "^3.8.1",
"jest": "^29.7.0",
"rollup": "^4.40.2"
"rollup": "^4.40.2",
"typescript": "^5.8.0"
},
"engines": {
"node": ">=18"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'node:fs';
import type { RollupOptions } from 'rollup';
import { babel } from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';

Expand All @@ -25,14 +26,20 @@ function injectDemoSource() {
};
}

const config = [
const config: Array<RollupOptions> = [
{
input: 'src/index.js',
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'es',
},
plugins: [babel({ babelHelpers: 'bundled' })],
plugins: [
babel({
babelHelpers: 'bundled',
extensions: ['.js', '.ts'],
exclude: 'node_modules/**',
}),
],
},
{
input: 'demo/demo.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('List', () => {
const list = List();

const { ListFormatter } = createFormatters({ List, isList });

const formatted = ListFormatter.header(list);
expect(formatted).toEqual([
'span',
Expand All @@ -21,7 +21,6 @@ describe('List', () => {
],
['span', '[0]'],
]);

expect(ListFormatter.hasBody(list)).toBe(false);
});
});
247 changes: 0 additions & 247 deletions packages/devtools/src/createFormatters.js

This file was deleted.

Loading