Skip to content

Commit c0683c8

Browse files
committed
remove tsdx, use custom build
BREAKING: only supports ESM currently
1 parent 8527c51 commit c0683c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3887
-1743
lines changed

.eslintrc

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": 12,
13+
"sourceType": "module"
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
"no-case-declarations": "off",
20+
"@typescript-eslint/ban-types": "off",
21+
"@typescript-eslint/explicit-module-boundary-types": "off",
22+
"@typescript-eslint/no-explicit-any": "off",
23+
"@typescript-eslint/no-extra-semi": "off",
24+
"@typescript-eslint/no-unused-vars": ["error", {
25+
"ignoreRestSiblings": true
26+
}]
27+
}
28+
}

buildPackage.mjs

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import commonjs from "@rollup/plugin-commonjs";
2+
import typescript from "@rollup/plugin-typescript";
3+
import cssOnly from "rollup-plugin-css-only";
4+
import { babel } from "@rollup/plugin-babel";
5+
import { terser } from "rollup-plugin-terser";
6+
import { rollup } from "rollup";
7+
import fs from "fs";
8+
9+
const makeConfig = ({ format, minify, types, css }) =>
10+
// : {
11+
// format: 'esm' | 'cjs';
12+
// minify: boolean;
13+
// types: boolean;
14+
// }): RollupOptions => {
15+
{
16+
const outputName = `${process.argv[2]}.${format}.${
17+
minify ? "min.js" : "js"
18+
}`;
19+
20+
return {
21+
input: "./src/index.ts",
22+
external: (id, parent, resolved) => {
23+
const isExternal = !(id.startsWith(".") || resolved);
24+
return isExternal;
25+
},
26+
treeshake: {
27+
// We assume reading a property of an object never has side-effects.
28+
propertyReadSideEffects: false,
29+
},
30+
output: {
31+
dir: "./dist",
32+
entryFileNames: outputName,
33+
format,
34+
esModule: true,
35+
sourcemap: true,
36+
exports: "named",
37+
},
38+
plugins: [
39+
// all bundled external modules need to be converted from CJS to ESM
40+
commonjs(),
41+
typescript({
42+
emitDeclarationOnly: types,
43+
noEmit: !types,
44+
declarationDir: "./dist",
45+
}),
46+
css && cssOnly({ output: "bundle.css" }),
47+
babel({
48+
exclude: "node_modules/**",
49+
extensions: ["ts", "tsx"],
50+
babelHelpers: "bundled",
51+
}),
52+
minify &&
53+
terser({
54+
output: { comments: false },
55+
compress: {
56+
keep_infinity: true,
57+
pure_getters: true,
58+
passes: 10,
59+
},
60+
ecma: 5,
61+
toplevel: format === "cjs",
62+
}),
63+
],
64+
};
65+
};
66+
67+
function runRollup(config) {
68+
return rollup(config).then((r) => r.write(config.output));
69+
}
70+
71+
fs.rmdirSync("./dist", { recursive: true });
72+
runRollup(
73+
makeConfig({
74+
format: "esm",
75+
minify: false,
76+
types: true,
77+
css: process.argv.includes("--css"),
78+
})
79+
).then(
80+
(r) => console.log("success!"),
81+
(e) => console.error(e)
82+
);

jest.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
transform: {
3+
"\\.[jt]sx?$": "babel-jest",
4+
},
5+
transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"],
6+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
7+
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
8+
testMatch: ["<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}"],
9+
rootDir: "./",
10+
setupFilesAfterEnv: ["./setupTests.js"],
11+
};

package.json

+30-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,46 @@
11
{
2+
"name": "rxjs-traces-monorepo",
23
"private": true,
34
"license": "MIT",
4-
"workspaces": [
5-
"packages/*"
6-
],
5+
"workspaces": {
6+
"packages": [
7+
"packages/*"
8+
],
9+
"nohoist": [
10+
"**/react-scripts",
11+
"**/react-scripts/**"
12+
]
13+
},
714
"scripts": {
815
"lint": "wsrun lint",
916
"format": "wsrun format",
1017
"start": "wsrun -mt --done-criteria=\"Compiled successfully\" -c start",
1118
"build": "wsrun -mt build"
1219
},
13-
"prettier": {
14-
"printWidth": 80,
15-
"semi": false,
16-
"trailingComma": "all"
17-
},
1820
"devDependencies": {
19-
"eslint-plugin-prettier": "^3.1.4",
21+
"@babel/core": "^7.14.2",
22+
"@babel/preset-env": "^7.14.2",
23+
"@babel/preset-typescript": "^7.13.0",
24+
"@rollup/plugin-babel": "^5.3.0",
25+
"@rollup/plugin-commonjs": "^19.0.0",
26+
"@rollup/plugin-typescript": "^8.2.1",
27+
"@typescript-eslint/eslint-plugin": "^4.23.0",
28+
"@typescript-eslint/parser": "^4.23.0",
29+
"babel-jest": "^26.6.3",
30+
"eslint": "^7.26.0",
31+
"eslint-plugin-prettier": "^3.4.0",
2032
"husky": "^4.2.5",
33+
"jest": "^26.6.3",
2134
"lint-staged": "^10.2.11",
22-
"prettier": "^2.0.5",
35+
"prettier": "^2.3.0",
36+
"regenerator-runtime": "^0.13.7",
37+
"rollup": "^2.48.0",
38+
"rollup-plugin-css-only": "^3.1.0",
39+
"rollup-plugin-terser": "^7.0.2",
40+
"rxjs": "^7.0.1",
41+
"ts-jest": "^26.5.6",
2342
"tslib": "^2.2.0",
24-
"typescript": "^4.2.3"
43+
"typescript": "^4.2.4"
2544
},
2645
"dependencies": {
2746
"wsrun": "^5.2.1"

packages/babel-plugin-react-rxjs/package.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,11 @@
1717
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md}\" \"test/**/*.{js,jsx,ts,tsx,json,md}\"",
1818
"prepare": "tsdx build"
1919
},
20-
"prettier": {
21-
"printWidth": 80,
22-
"semi": false,
23-
"trailingComma": "all"
24-
},
2520
"devDependencies": {
2621
"@babel/core": "^7.11.4",
2722
"@babel/template": "^7.10.4",
2823
"@types/babel-plugin-macros": "^2.8.2",
2924
"babel-plugin-macros": "^2.8.0",
30-
"babel-plugin-tester": "^9.2.0",
31-
"tsdx": "^0.13.2"
25+
"babel-plugin-tester": "^9.2.0"
3226
}
33-
}
27+
}

packages/chrome-devtools/package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
"react": "^16.13.1",
1919
"react-dom": "^16.13.1",
2020
"react-rxjs": "^3.0.0-alpha.5",
21-
"rxjs": "^7.0.0",
21+
"rxjs": "^7.0.1",
2222
"rxjs-traces": "^0.1.0-alpha.1",
23-
"vis-data": "^6.6.1",
24-
"vis-network": "^7.10.0",
25-
"vis-util": "^4.3.3"
2623
},
2724
"devDependencies": {
2825
"@types/chrome": "^0.0.104",

packages/devtools/.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-typescript", "@babel/preset-env"]
3+
}

packages/devtools/jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../jest.config");

packages/devtools/package.json

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"version": "0.1.0",
2+
"version": "0.2.0",
33
"license": "MIT",
4-
"main": "dist/index.js",
54
"typings": "dist/index.d.ts",
65
"files": [
76
"dist",
@@ -11,23 +10,20 @@
1110
"node": ">=10"
1211
},
1312
"scripts": {
14-
"start": "tsdx watch",
15-
"build": "tsdx build",
16-
"test": "tsdx test",
17-
"lint": "tsdx lint src",
18-
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md}\"",
19-
"prepare": "tsdx build"
13+
"build": "node ../../buildPackage.mjs devtools --css",
14+
"lint": "eslint src/**/*",
15+
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md}\""
2016
},
2117
"peerDependencies": {},
2218
"name": "rxjs-traces-devtools",
2319
"author": "Víctor Oliva",
2420
"module": "dist/devtools.esm.js",
25-
"devDependencies": {
26-
"rollup-plugin-css-only": "^2.1.0"
27-
},
2821
"dependencies": {
2922
"@react-rxjs/core": "^0.8.0",
3023
"@react-rxjs/utils": "^0.8.2",
31-
"rxjs-traces": "0.1.0-alpha.10"
24+
"rxjs-traces": "0.2.0-alpha.1",
25+
"vis-data": "^6.6.1",
26+
"vis-network": "^7.10.0",
27+
"vis-util": "^4.3.3"
3228
}
33-
}
29+
}

packages/devtools/src/DevTools.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import * as React from "react"
2-
import { useState } from "react"
1+
import * as React from "react";
2+
import { useState } from "react";
33
import {
44
FilterBar,
55
TagOverlay,
66
TimeTravelSlider,
77
Visualization,
8-
} from "./components"
8+
} from "./components";
99

1010
interface TagSelection {
11-
id: string
12-
x: number
13-
y: number
11+
id: string;
12+
x: number;
13+
y: number;
1414
}
1515
export const DevTools: React.FC<{
16-
onCopy?: (value: string) => void
16+
onCopy?: (value: string) => void;
1717
}> = ({ onCopy = () => void 0 }) => {
18-
const [selectedTag, setSelectedTag] = useState<TagSelection | null>(null)
19-
const [filter, setFilter] = useState("")
18+
const [selectedTag, setSelectedTag] = useState<TagSelection | null>(null);
19+
const [filter, setFilter] = useState("");
2020

2121
return (
2222
<>
@@ -36,5 +36,5 @@ export const DevTools: React.FC<{
3636
)}
3737
<TimeTravelSlider />
3838
</>
39-
)
40-
}
39+
);
40+
};
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { FC } from "react"
2-
import React from "react"
3-
import "./FilterBar.css"
1+
import { FC } from "react";
2+
import React from "react";
3+
import "./FilterBar.css";
44

55
export const FilterBar: FC<{
6-
filter: string
7-
onFilterChange: (filter: string) => void
6+
filter: string;
7+
onFilterChange: (filter: string) => void;
88
}> = ({ filter, onFilterChange }) => (
99
<div className="filter-bar">
1010
<input
@@ -14,4 +14,4 @@ export const FilterBar: FC<{
1414
onChange={(evt) => onFilterChange(evt.target.value)}
1515
/>
1616
</div>
17-
)
17+
);

0 commit comments

Comments
 (0)