@flast-erp/core 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -69
- package/package.json +1 -24
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @flast-erp/core
|
|
2
2
|
|
|
3
3
|
Shared core library cho Flast ERP applications.
|
|
4
|
-
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
## Cài đặt
|
|
@@ -17,26 +16,6 @@ yarn add @flast-erp/core
|
|
|
17
16
|
```bash
|
|
18
17
|
npm install react react-dom react-router-dom antd axios dayjs lodash
|
|
19
18
|
```
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Dùng
|
|
24
|
-
|
|
25
|
-
### Import theo subpath (khuyến nghị — tree-shaking tốt hơn)
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
import { useGetList, useGetMe } from "@flast-erp/core/hooks"
|
|
29
|
-
import { RestList, FormInput } from "@flast-erp/core/components"
|
|
30
|
-
import { formatDate, RequestUtils } from "@flast-erp/core/utils"
|
|
31
|
-
import { API_BASE_URL } from "@flast-erp/core/configs"
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Import từ root
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
import { useGetList, RestList, formatDate } from "@flast-erp/core"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
19
|
---
|
|
41
20
|
|
|
42
21
|
## Cấu trúc
|
|
@@ -48,58 +27,11 @@ import { useGetList, RestList, formatDate } from "@flast-erp/core"
|
|
|
48
27
|
├── /utils — Utility functions
|
|
49
28
|
└── /configs — Constants, config
|
|
50
29
|
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Tích hợp với Module Federation
|
|
55
|
-
|
|
56
|
-
Khai báo trong `shared` của cả host và remote:
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
// craco.config.js
|
|
60
|
-
new ModuleFederationPlugin({
|
|
61
|
-
shared: {
|
|
62
|
-
"@flast-erp/core": {
|
|
63
|
-
singleton: true,
|
|
64
|
-
eager: true,
|
|
65
|
-
requiredVersion: require("./package.json").dependencies["@flast-erp/core"],
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Development & Release
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
# Cài dependencies
|
|
77
|
-
npm install
|
|
78
|
-
|
|
79
|
-
# Build
|
|
80
|
-
npm run build
|
|
81
|
-
|
|
82
|
-
# Watch mode
|
|
83
|
-
npm run build:watch
|
|
84
|
-
|
|
85
|
-
# Release
|
|
86
|
-
./scripts/release.sh patch # 1.0.0 → 1.0.1
|
|
87
|
-
./scripts/release.sh minor # 1.0.0 → 1.1.0
|
|
88
|
-
./scripts/release.sh major # 1.0.0 → 2.0.0
|
|
89
|
-
```
|
|
90
|
-
|
|
91
30
|
---
|
|
92
31
|
|
|
93
|
-
##
|
|
94
|
-
|
|
95
|
-
Thay thế import cũ:
|
|
32
|
+
## Import
|
|
96
33
|
|
|
97
34
|
```js
|
|
98
|
-
// ❌ Trước
|
|
99
|
-
import { useGetList } from "../../core/hooks/useGetList"
|
|
100
|
-
import { RestList } from "../core/components/RestLayout/RestList"
|
|
101
|
-
|
|
102
|
-
// ✅ Sau
|
|
103
35
|
import { useGetList } from "@flast-erp/core/hooks"
|
|
104
36
|
import { RestList } from "@flast-erp/core/components"
|
|
105
37
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flast-erp/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Shared core library for Flast ERP applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -8,29 +8,6 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/index.esm.js",
|
|
14
|
-
"require": "./dist/index.js",
|
|
15
|
-
"types": "./dist/index.d.ts"
|
|
16
|
-
},
|
|
17
|
-
"./components": {
|
|
18
|
-
"import": "./dist/components/index.esm.js",
|
|
19
|
-
"require": "./dist/components/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./hooks": {
|
|
22
|
-
"import": "./dist/hooks/index.esm.js",
|
|
23
|
-
"require": "./dist/hooks/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./utils": {
|
|
26
|
-
"import": "./dist/utils/index.esm.js",
|
|
27
|
-
"require": "./dist/utils/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./configs": {
|
|
30
|
-
"import": "./dist/configs/index.esm.js",
|
|
31
|
-
"require": "./dist/configs/index.js"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
11
|
"scripts": {
|
|
35
12
|
"build": "rollup -c rollup.config.js",
|
|
36
13
|
"build:watch": "rollup -c rollup.config.js --watch",
|