@anker-in/lib 1.0.0
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/.gitkeep +0 -0
- package/.turbo/turbo-build.log +27 -0
- package/.turbo/turbo-test.log +14 -0
- package/README.md +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.global.js +2 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/jest.config.ts +12 -0
- package/package.json +21 -0
- package/src/__tests__/math.test.ts +15 -0
- package/src/index.ts +1 -0
- package/src/math.ts +5 -0
- package/tsconfig.json +15 -0
- package/tsup.config.ts +15 -0
package/.gitkeep
ADDED
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
> @anker-in/lib@1.0.0 build /Users/anker/Desktop/ANKER/headless-ui/packages/lib
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.4.0
|
|
8
|
+
[34mCLI[39m Using tsup config: /Users/anker/Desktop/ANKER/headless-ui/packages/lib/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: esnext
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[34mCJS[39m Build start
|
|
13
|
+
[34mIIFE[39m Build start
|
|
14
|
+
If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m130.00 B[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m390.00 B[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 120ms
|
|
18
|
+
[32mIIFE[39m [1mdist/index.global.js [22m[32m198.00 B[39m
|
|
19
|
+
[32mIIFE[39m [1mdist/index.global.js.map [22m[32m397.00 B[39m
|
|
20
|
+
[32mIIFE[39m ⚡️ Build success in 119ms
|
|
21
|
+
[32mCJS[39m [1mdist/index.js [22m[32m143.00 B[39m
|
|
22
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m389.00 B[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 121ms
|
|
24
|
+
DTS Build start
|
|
25
|
+
DTS ⚡️ Build success in 2189ms
|
|
26
|
+
DTS dist/index.d.mts 161.00 B
|
|
27
|
+
DTS dist/index.d.ts 161.00 B
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
> @anker-in/lib@1.0.0 test /Users/anker/Desktop/ANKER/headless-ui/packages/lib
|
|
3
|
+
> jest --passWithNoTests
|
|
4
|
+
|
|
5
|
+
PASS src/__tests__/math.test.ts
|
|
6
|
+
math functions
|
|
7
|
+
✓ add should correctly add two numbers (2 ms)
|
|
8
|
+
✓ subtract should correctly subtract two numbers
|
|
9
|
+
|
|
10
|
+
Test Suites: 1 passed, 1 total
|
|
11
|
+
Tests: 2 passed, 2 total
|
|
12
|
+
Snapshots: 0 total
|
|
13
|
+
Time: 2.327 s
|
|
14
|
+
Ran all test suites.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# 公共逻辑库
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/math.ts"],"names":["add","a","b","subtract"],"mappings":"gCAGaA,IAAAA,CAAAA,CAAM,CAACC,CAAAA,CAAWC,CAAcD,GAAAA,CAAAA,CAAIC,EACpCC,CAAW,CAAA,CAACF,CAAWC,CAAAA,CAAAA,GAAcD,CAAIC,CAAAA","file":"index.global.js","sourcesContent":["/**\n * 这是一个demo 模版\n */\nexport const add = (a: number, b: number) => a + b\nexport const subtract = (a: number, b: number) => a - b\n"]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/math.ts"],"names":["add","a","b","subtract"],"mappings":"aAGaA,IAAAA,CAAAA,CAAM,CAACC,CAAAA,CAAWC,CAAcD,GAAAA,CAAAA,CAAIC,EACpCC,CAAW,CAAA,CAACF,CAAWC,CAAAA,CAAAA,GAAcD,CAAIC,CAAAA","file":"index.js","sourcesContent":["/**\n * 这是一个demo 模版\n */\nexport const add = (a: number, b: number) => a + b\nexport const subtract = (a: number, b: number) => a - b\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/math.ts"],"names":["add","a","b","subtract"],"mappings":"AAGaA,IAAAA,CAAAA,CAAM,CAACC,CAAAA,CAAWC,CAAcD,GAAAA,CAAAA,CAAIC,EACpCC,CAAW,CAAA,CAACF,CAAWC,CAAAA,CAAAA,GAAcD,CAAIC,CAAAA","file":"index.mjs","sourcesContent":["/**\n * 这是一个demo 模版\n */\nexport const add = (a: number, b: number) => a + b\nexport const subtract = (a: number, b: number) => a - b\n"]}
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JestConfigWithTsJest } from 'ts-jest'
|
|
2
|
+
|
|
3
|
+
const config: JestConfigWithTsJest = {
|
|
4
|
+
preset: 'ts-jest',
|
|
5
|
+
testEnvironment: 'jsdom', // 使用 node 环境(如果是浏览器库可改成 'jsdom')
|
|
6
|
+
clearMocks: true, // 每次测试后自动清除 mock
|
|
7
|
+
coverageDirectory: 'coverage', // 输出覆盖率报告
|
|
8
|
+
testMatch: ['**/__tests__/**/*.test.ts'], // 匹配测试文件路径
|
|
9
|
+
moduleFileExtensions: ['ts', 'js', 'json'],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default config
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@anker-in/lib",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@types/jest": "^29.5.12",
|
|
8
|
+
"jest": "^29.0.0",
|
|
9
|
+
"ts-jest": "^29.2.6",
|
|
10
|
+
"tsup": "^8.4.0",
|
|
11
|
+
"typescript": "^5.0.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "tsup --watch",
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"test": "jest --passWithNoTests",
|
|
17
|
+
"test:watch": "jest --watch",
|
|
18
|
+
"coverage": "jest --coverage",
|
|
19
|
+
"clean": "rm -rf .turbo node_modules dist"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { add, subtract } from '../math'
|
|
2
|
+
|
|
3
|
+
describe('math functions', () => {
|
|
4
|
+
test('add should correctly add two numbers', () => {
|
|
5
|
+
expect(add(2, 3)).toBe(5)
|
|
6
|
+
expect(add(-1, -1)).toBe(-2)
|
|
7
|
+
expect(add(0, 5)).toBe(5)
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
test('subtract should correctly subtract two numbers', () => {
|
|
11
|
+
expect(subtract(5, 3)).toBe(2)
|
|
12
|
+
expect(subtract(0, 5)).toBe(-5)
|
|
13
|
+
expect(subtract(-1, -1)).toBe(0)
|
|
14
|
+
})
|
|
15
|
+
})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './math'
|
package/src/math.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist",
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"],
|
|
14
|
+
"exclude": ["node_modules", "dist"]
|
|
15
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['esm', 'cjs', 'iife'],
|
|
6
|
+
dts: true, // 生成 .d.ts 文件
|
|
7
|
+
splitting: true,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
clean: true,
|
|
10
|
+
minify: true,
|
|
11
|
+
treeshake: true,
|
|
12
|
+
outDir: 'dist',
|
|
13
|
+
platform: 'browser',
|
|
14
|
+
target: 'esnext',
|
|
15
|
+
})
|