Skip to content

Commit a2ab5ba

Browse files
authored
Merge pull request #5 from immutable-js/devtools-to-typescript
2 parents 0d1925c + f620514 commit a2ab5ba

File tree

13 files changed

+556
-274
lines changed

13 files changed

+556
-274
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jobs:
1313
node-version: 20
1414
- run: corepack enable
1515
- run: yarn install --immutable
16+
- run: yarn lint
1617
- run: yarn test

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "yarn workspace @immutable/devtools-extension run dev",
88
"build": "yarn workspaces foreach --all -pt run build",
9+
"lint": "yarn workspaces foreach --all -pt run lint",
910
"test": "yarn workspaces foreach --all -pt run test",
1011
"version": "node build/update-version.js && git add packages/extension/extension/manifest.json && git add packages/*/package.json && yarn"
1112
},
@@ -22,6 +23,7 @@
2223
"@babel/preset-env": "^7.27.2",
2324
"@rollup/plugin-babel": "^6.0.4",
2425
"@rollup/plugin-node-resolve": "^16.0.1",
25-
"rollup": "^4.41.0"
26+
"rollup": "^4.41.0",
27+
"ts-node": "^10.9.2"
2628
}
2729
}

packages/devtools/babel.config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["@babel/preset-env"]
3-
}
2+
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
3+
}

packages/devtools/jest.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/devtools/jest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Config } from 'jest';
2+
3+
const config: Config = {
4+
testPathIgnorePatterns: ['<rootDir>/test.js'],
5+
};
6+
7+
export default config;

packages/devtools/package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
"type": "module",
44
"version": "2.1.1",
55
"description": "Chrome Dev Tools formatter for the Immutable JS library",
6-
"exports": "./dist/index.js",
6+
"exports": {
7+
".": {
8+
"import": "./dist/index.js",
9+
"types": "./dist/index.d.ts"
10+
}
11+
},
712
"files": [
813
"dist"
914
],
1015
"scripts": {
11-
"build": "rollup -c",
16+
"build:types": "tsc",
17+
"build:module": "rollup -c",
18+
"build": "yarn run build:types && yarn run build:module",
19+
"lint:types": "tsc --noEmit",
20+
"lint": "yarn run lint:types",
1221
"prepublishOnly": "npm run-script build",
1322
"test": "jest"
1423
},
@@ -22,12 +31,14 @@
2231
"devDependencies": {
2332
"@babel/core": "^7.27.1",
2433
"@babel/preset-env": "^7.27.2",
34+
"@babel/preset-typescript": "^7.27.1",
2535
"@jest/globals": "^29.7.0",
2636
"@rollup/plugin-babel": "^6.0.4",
2737
"immutable": "^5.1.2",
2838
"immutable3": "^3.8.1",
2939
"jest": "^29.7.0",
30-
"rollup": "^4.40.2"
40+
"rollup": "^4.40.2",
41+
"typescript": "^5.8.0"
3142
},
3243
"engines": {
3344
"node": ">=18"

packages/devtools/rollup.config.js renamed to packages/devtools/rollup.config.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'node:fs';
2+
import type { RollupOptions } from 'rollup';
23
import { babel } from '@rollup/plugin-babel';
34
import nodeResolve from '@rollup/plugin-node-resolve';
45

@@ -25,14 +26,20 @@ function injectDemoSource() {
2526
};
2627
}
2728

28-
const config = [
29+
const config: Array<RollupOptions> = [
2930
{
30-
input: 'src/index.js',
31+
input: 'src/index.ts',
3132
output: {
3233
dir: 'dist',
3334
format: 'es',
3435
},
35-
plugins: [babel({ babelHelpers: 'bundled' })],
36+
plugins: [
37+
babel({
38+
babelHelpers: 'bundled',
39+
extensions: ['.js', '.ts'],
40+
exclude: 'node_modules/**',
41+
}),
42+
],
3643
},
3744
{
3845
input: 'demo/demo.js',

packages/devtools/src/createFormatter.test.js renamed to packages/devtools/src/createFormatter.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('List', () => {
77
const list = List();
88

99
const { ListFormatter } = createFormatters({ List, isList });
10-
10+
1111
const formatted = ListFormatter.header(list);
1212
expect(formatted).toEqual([
1313
'span',
@@ -21,7 +21,6 @@ describe('List', () => {
2121
],
2222
['span', '[0]'],
2323
]);
24-
2524
expect(ListFormatter.hasBody(list)).toBe(false);
2625
});
2726
});

packages/devtools/src/createFormatters.js

Lines changed: 0 additions & 247 deletions
This file was deleted.

0 commit comments

Comments
 (0)