Skip to content

Commit

Permalink
fix: editor & sdk UMD 模式下依赖 query-core 版本不一致 (#147)
Browse files Browse the repository at this point in the history
* fix: editor & sdk UMD 模式下依赖 query-core 版本不一致

* chore: npm innore
  • Loading branch information
lvisei authored Mar 23, 2024
1 parent 8a4d13b commit 53f11f8
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion examples/li-template-assets/.npmignore

This file was deleted.

3 changes: 2 additions & 1 deletion examples/li-template-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"dist",
"lib",
"es",
"README.md"
"README.md",
"!dist/report.html"
],
"scripts": {
"prepare": "husky install",
Expand Down
1 change: 0 additions & 1 deletion packages/li-analysis-assets/.npmignore

This file was deleted.

3 changes: 2 additions & 1 deletion packages/li-analysis-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"typings": "dist/esm/index.d.ts",
"files": [
"dist",
"README.md"
"README.md",
"!dist/umd/report.html"
],
"scripts": {
"build": "npm run clean && father build",
Expand Down
1 change: 0 additions & 1 deletion packages/li-core-assets/.npmignore

This file was deleted.

3 changes: 2 additions & 1 deletion packages/li-core-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"typings": "dist/esm/index.d.ts",
"files": [
"dist",
"README.md"
"README.md",
"!dist/umd/report.html"
],
"scripts": {
"build": "npm run clean && father build",
Expand Down
1 change: 0 additions & 1 deletion packages/li-editor/.npmignore

This file was deleted.

4 changes: 2 additions & 2 deletions packages/li-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"typings": "dist/esm/index.d.ts",
"files": [
"dist",
"README.md"
"README.md",
"!dist/umd/report.html"
],
"scripts": {
"build": "npm run clean && father build",
Expand All @@ -44,7 +45,6 @@
"@formily/react": "^2.2.24",
"@monaco-editor/react": "^4.5.1",
"@tanstack/query-core": "^5.0.0",
"@tanstack/react-query": "^5.0.0",
"@turf/turf": "^6.5.0",
"ahooks": "^3.7.0",
"classnames": "^2.3.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/li-editor/src/services/editor-dataset-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import {
isLocalOrRemoteDatasetSchema,
isRemoteDatasetSchema,
notNullorUndefined,
// QueryObserver 从 sdk 导入,确保 UMD 产物与 QueryClient 版本一致
QueryObserver,
queryServiceClient,
Subscribable,
} from '@antv/li-sdk';
import type { QueryObserverOptions, QueryObserverResult } from '@tanstack/query-core';
import { QueryObserver } from '@tanstack/query-core';
import { max, min } from 'lodash-es';
import type { AutoCreateSchema, FieldPair, GeoField } from '../types';
import { requestIdleCallback } from '../utils';
Expand Down Expand Up @@ -293,6 +294,7 @@ class EditorDatasetManager extends Subscribable<EditorDatasetManagerListener> {
const hasChange = this.schemas !== datasets;
if (!hasChange) return;

this.schemas = datasets;
const prevDatasets = this.datasets;
const prevDatasetsMap = new Map(prevDatasets.map((item) => [item.id, item]));
const newDatasets = datasets.map((datasetSchema) => {
Expand Down
5 changes: 1 addition & 4 deletions packages/li-p2/.fatherrc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { defineConfig } from 'father';
import { getUMDConfig } from '../../scripts/fatherrc.base';

const isBundle = process.env.BUNDLE_ENV === 'bundle' && process.env.NODE_ENV === 'production';

export default defineConfig({
extends: '../../.fatherrc.base.ts',
umd: isBundle ? getUMDConfig('LIP2') : undefined,
// Non't need UMD
});
1 change: 0 additions & 1 deletion packages/li-p2/.npmignore

This file was deleted.

3 changes: 2 additions & 1 deletion packages/li-p2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"typings": "dist/esm/index.d.ts",
"files": [
"dist",
"README.md"
"README.md",
"!dist/umd/report.html"
],
"scripts": {
"build": "npm run clean && father build",
Expand Down
1 change: 0 additions & 1 deletion packages/li-sdk/.npmignore

This file was deleted.

3 changes: 2 additions & 1 deletion packages/li-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"typings": "dist/esm/index.d.ts",
"files": [
"dist",
"README.md"
"README.md",
"!dist/umd/report.html"
],
"scripts": {
"build": "npm run clean && father build",
Expand Down
2 changes: 1 addition & 1 deletion packages/li-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export * from './types';

export { implementWidget } from './utils/widget';
export { implementLayer } from './utils/layer';
export { implementService, queryServiceClient, Subscribable } from './utils/service';
export { implementService, queryServiceClient, QueryClient, QueryObserver, Subscribable } from './utils/service';
export * from './utils/register-form';
export * from './utils/helper';
export * from './utils/dataset';
Expand Down
3 changes: 2 additions & 1 deletion packages/li-sdk/src/utils/service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { QueryClientConfig } from '@tanstack/query-core';
import { QueryClient } from '@tanstack/query-core';
import { QueryClient, QueryObserver } from '@tanstack/query-core';
import type { DatasetServiceParams, ImplementService, ImplementServiceOptions } from '../types';

/**
Expand Down Expand Up @@ -32,6 +32,7 @@ const queryClientConfig: QueryClientConfig = {
},
};
export const queryServiceClient = new QueryClient(queryClientConfig);
export { QueryClient, QueryObserver };

type Listener = () => void;

Expand Down

0 comments on commit 53f11f8

Please sign in to comment.