Skip to content

Commit de0012c

Browse files
committed
feat: fix reference path of calculator
1 parent 1c564ff commit de0012c

File tree

14 files changed

+484
-11
lines changed

14 files changed

+484
-11
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 338 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/calculator/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Bytedance Ltd. and/or its affiliates.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/calculator/package.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@visactor/calculator",
3+
"version": "0.0.0",
4+
"description": "SQL-like query executor with DSL",
5+
"main": "lib",
6+
"module": "es",
7+
"types": "es",
8+
"sideEffects": false,
9+
"exports": {
10+
".": {
11+
"import": "./es/index.js",
12+
"require": "./lib/index.js"
13+
}
14+
},
15+
"files": [
16+
"README.md",
17+
"dist",
18+
"lib",
19+
"es"
20+
],
21+
"scripts": {
22+
"clean": "rimraf es lib dist build *.tsbuildinfo",
23+
"test": "jest --passWithNoTests",
24+
"test:coverage": "jest --coverage",
25+
"build:esm": "tsc -p tsconfig.esm.json",
26+
"build:cjs": "tsc -p tsconfig.cjs.json",
27+
"build": "npm-run-all clean --parallel build:esm build:cjs"
28+
},
29+
"dependencies": {
30+
"ts-pattern": "~4.1.4"
31+
},
32+
"devDependencies": {
33+
"@types/jest": "^26.0.0",
34+
"@types/node": "*",
35+
"jest": "^26.0.0",
36+
"npm-run-all": "^4.1.5",
37+
"rimraf": "^3.0.2",
38+
"ts-jest": "^26.0.0",
39+
"ts-node": "10.9.0",
40+
"typescript": "4.9.5"
41+
}
42+
}

packages/calculator/tsconfig.cjs.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* NOTE: this file is symlink to '@aeolian/dev-config/tsconfig/build.cjs.json'
3+
*/
4+
{
5+
"extends": "./tsconfig.json",
6+
"compilerOptions": {
7+
"outDir": "lib",
8+
"target": "es2018",
9+
"module": "CommonJS",
10+
"noEmit": false,
11+
"sourceMap": false,
12+
},
13+
"exclude": [
14+
"**/*.test.ts",
15+
"**/*.test.tsx",
16+
"**/*.stories.tsx",
17+
"**/*.mock.ts",
18+
"**/tests",
19+
"**/mocks",
20+
],
21+
}

packages/calculator/tsconfig.esm.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* NOTE: this file is symlink to '@aeolian/dev-config/tsconfig/build.esm.json'
3+
*/
4+
{
5+
"extends": "./tsconfig.json",
6+
"compilerOptions": {
7+
"outDir": "es",
8+
"target": "es2018",
9+
"module": "ESNext",
10+
"noEmit": false,
11+
"sourceMap": false,
12+
},
13+
"exclude": [
14+
"**/*.test.ts",
15+
"**/*.test.tsx",
16+
"**/*.stories.tsx",
17+
"**/*.mock.ts",
18+
"**/tests",
19+
"**/mocks",
20+
],
21+
}

packages/calculator/tsconfig.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true, //Generates corresponding d.ts files.
4+
5+
"baseUrl": ".",
6+
"rootDir": "src",
7+
"outDir": "es",
8+
"types": [
9+
"node",
10+
"jest",
11+
],
12+
},
13+
"include": [
14+
"src",
15+
],
16+
// https://www.typescriptlang.org/docs/handbook/project-references.html#what-is-a-project-reference
17+
"references": [
18+
],
19+
}

packages/vmind/__tests__/browser/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default defineConfig(({ mode }) => {
3535
},
3636
resolve: {
3737
alias: {
38+
'@visactor/calculator': path.resolve(__dirname, '../../../calculator/src/index.ts')
3839
// ...localConf.resolve?.alias
3940
}
4041
},

packages/vmind/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"json5": "~2.2.3",
7878
"dayjs": "~1.11.10",
7979
"js-yaml": "~4.1.0",
80-
"ts-pattern": "~5.0.6",
81-
"node-sql-parser": "~4.17.0"
80+
"node-sql-parser": "~4.17.0",
81+
"@visactor/calculator": "workspace:*"
8282
}
8383
}

packages/vmind/src/gpt/dataProcess/query/queryDataset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { mergeMap, parseRespondField, patchQueryInput, preprocessSQL, replaceOpe
44
import { parseSqlAST } from './parseSqlAST';
55
import { isArray } from 'lodash';
66
import { DataQueryResponse, SQLAst } from './type';
7-
import { Query, query } from '../../../calculator';
7+
import { Query, query } from '@visactor/calculator';
88
import { parseGPTResponse, requestGPT } from '../../utils';
99
import { getQueryDatasetPrompt } from '../prompts';
1010

packages/vmind/src/gpt/dataProcess/query/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Select } from 'node-sql-parser';
2-
import { Query } from '../../../calculator';
2+
import { Query } from '@visactor/calculator';
33
import { DataItem, SimpleFieldInfo } from '../../../typings';
44

55
export type SQLAst = Select;

packages/vmind/src/gpt/dataProcess/query/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isString } from 'lodash';
2-
import { Query } from '../../../calculator';
2+
import { Query } from '@visactor/calculator';
33
import { detectFieldType } from '../../../common/dataProcess/utils';
44
import { DataItem, SimpleFieldInfo } from '../../../typings';
55
import { ASTParserContext, ASTParserPipe } from './type';

packages/vmind/tsconfig.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"baseUrl": "./",
77
"rootDir": "./src",
88
"outDir": "./esm",
9-
"composite": true
9+
"composite": true,
10+
"paths": {
11+
"@visactor/calculator": ["../calculator/src"],
12+
}
1013
},
1114
"ts-node": {
1215
"transpileOnly": true,
@@ -16,6 +19,8 @@
1619
},
1720
"include": ["src"],
1821
"references": [
19-
22+
{
23+
"path": "../calculator"
24+
}
2025
]
2126
}

packages/vmind/tsconfig.test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"paths": {
5+
"@visactor/calculator": ["../calculator/src"],
56
}
67
},
78
"references": []

rush.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@
6363
"tags": [
6464
"package"
6565
]
66+
},
67+
{
68+
"packageName": "@visactor/calculator",
69+
"projectFolder": "packages/calculator",
70+
"shouldPublish": false,
71+
"tags": [
72+
"package"
73+
]
6674
}
6775
]
6876
}

0 commit comments

Comments
 (0)