diff --git a/package.json b/package.json index 59a01c9..3d9fb3c 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,12 @@ "license": "MIT", "scripts": { "dev": "yarn storybook", - "build": "mv packages/react/tsconfig.build.json packages/react/tsconfig.json && father-build && mv packages/react/tsconfig.json packages/react/tsconfig.build.json", + "build": "node ./scripts/build", "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook", "tsc": "tsc --noEmit", "lint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./packages", - "postinstall": "patch-package", + "postinstall": "patch-package && lerna run build --scope=@fortune-sheet/formula-parser", "publish": "lerna publish --registry 'https://registry.npmjs.org'", "test": "jest", "coverage": "jest --coverage" diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index af8794e..0000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "declaration": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "removeComments": true, - "moduleResolution": "node", - "noLib": false, - "jsx": "react", - "strict": true, - "strictNullChecks": true, - "skipLibCheck": true, - "lib": ["es5", "dom"], - "baseUrl": "./" - }, - "include": ["./src"], - "exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts", "dist", "lib"] -} diff --git a/packages/react/src/components/SheetOverlay/InputBox.tsx b/packages/react/src/components/SheetOverlay/InputBox.tsx index c8c0402..85bd181 100644 --- a/packages/react/src/components/SheetOverlay/InputBox.tsx +++ b/packages/react/src/components/SheetOverlay/InputBox.tsx @@ -11,6 +11,7 @@ import { escapeScriptTag, valueShowEs, updateCell, + createRangeHightlight, } from "@fortune-sheet/core"; import React, { useContext, @@ -25,7 +26,6 @@ import WorkbookContext from "../../context"; import ContentEditable from "./ContentEditable"; import FormulaSearch from "./FormulaSearch"; import FormulaHint from "./FormulaHint"; -import { createRangeHightlight } from "../../../../core/src/modules/formula"; const InputBox: React.FC = () => { const { context, setContext, refs } = useContext(WorkbookContext); diff --git a/packages/react/tsconfig.build.json b/packages/react/tsconfig.build.json deleted file mode 100644 index af8794e..0000000 --- a/packages/react/tsconfig.build.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "es2015", - "declaration": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "removeComments": true, - "moduleResolution": "node", - "noLib": false, - "jsx": "react", - "strict": true, - "strictNullChecks": true, - "skipLibCheck": true, - "lib": ["es5", "dom"], - "baseUrl": "./" - }, - "include": ["./src"], - "exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts", "dist", "lib"] -} diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 0000000..fff766d --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,23 @@ +const fs = require("fs"); +const { spawnSync } = require("child_process"); + +const tsconfig = JSON.parse(fs.readFileSync("tsconfig.json")); + +delete tsconfig.compilerOptions.paths; +tsconfig.include = ["./src"]; +tsconfig.exclude = [ + "node_modules", + "**/*.test.ts", + "**/*.spec.ts", + "dist", + "lib", +]; + +const tsconfigJson = JSON.stringify(tsconfig); +fs.writeFileSync("packages/core/tsconfig.json", tsconfigJson); +fs.writeFileSync("packages/react/tsconfig.json", tsconfigJson); + +spawnSync("father-build", { stdio: "inherit" }); + +fs.rmSync("packages/core/tsconfig.json"); +fs.rmSync("packages/react/tsconfig.json");