Skip to content

Commit e1dfdff

Browse files
committed
Update test expectations and dependencies; enhance build process with environment variable replacement
1 parent dcbdc38 commit e1dfdff

File tree

5 files changed

+1023
-641
lines changed

5 files changed

+1023
-641
lines changed

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,32 @@
2828
"@techor/jest": "workspace:^",
2929
"@techor/jest-dom": "workspace:^",
3030
"@types/fs-extra": "^11.0.4",
31-
"@types/node": "^20.17.7",
31+
"@types/node": "^20.17.24",
3232
"commitlint-config-techor": "workspace:^",
3333
"conventional-changelog-techor": "workspace:^",
34-
"eslint": "^9.15.0",
34+
"eslint": "^9.22.0",
3535
"eslint-config-techor": "workspace:^",
36-
"eslint-plugin-react-hooks": "^5.0.0",
36+
"eslint-plugin-react-hooks": "^5.2.0",
3737
"jest-environment-jsdom": "^29.7.0",
3838
"jest-puppeteer": "^10.1.4",
3939
"parent-module": "^3.1.0",
4040
"puppeteer": "^22.15.0",
41-
"rollup": "^4.27.4",
41+
"rollup": "^4.36.0",
4242
"semantic-release-config-techor": "workspace:^",
4343
"strip-ansi": "^7.1.0",
4444
"tmp": "^0.2.3",
4545
"ts-dedent": "^2.2.0",
46-
"tsx": "^4.19.2",
47-
"typescript": "^5.0.0"
46+
"tsx": "^4.19.3",
47+
"typescript": "^5.8.2"
4848
},
4949
"dependencies": {
50-
"@rollup/plugin-commonjs": "^25.0.8",
51-
"@rollup/plugin-node-resolve": "^15.3.0",
52-
"@rollup/plugin-typescript": "^11.1.6",
53-
"@rollup/pluginutils": "^5.1.3",
50+
"@rollup/plugin-commonjs": "^28.0.3",
51+
"@rollup/plugin-node-resolve": "^16.0.1",
52+
"@rollup/plugin-typescript": "^12.1.2",
53+
"@rollup/pluginutils": "^5.1.4",
5454
"cross-env": "^7.0.3",
55-
"get-tsconfig": "^4.8.1",
55+
"get-tsconfig": "^4.10.0",
5656
"rollup-plugin-swc3": "^0.12.1",
57-
"ts-jest": "^29.2.5"
57+
"ts-jest": "^29.2.6"
5858
}
5959
}

packages/techor/package.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,26 @@
6666
"provenance": true
6767
},
6868
"dependencies": {
69-
"@rollup/plugin-commonjs": "^28.0.2",
70-
"@rollup/plugin-node-resolve": "^16.0.0",
69+
"@rollup/plugin-commonjs": "^28.0.3",
70+
"@rollup/plugin-node-resolve": "^16.0.1",
7171
"@rollup/plugin-replace": "^6.0.2",
72-
"@swc/core": "^1.10.1",
72+
"@swc/core": "^1.11.11",
7373
"@techor/extend": "workspace:^",
7474
"@techor/fs": "workspace:^",
7575
"@techor/glob": "workspace:^",
7676
"@techor/log": "workspace:^",
7777
"@techor/npm": "workspace:^",
78-
"acorn": "^8.14.0",
78+
"acorn": "^8.14.1",
7979
"clsx": "^2.1.1",
8080
"escodegen": "^2.1.0",
8181
"execa": "^9.5.2",
8282
"explore-config": "workspace:^",
83-
"get-tsconfig": "^4.8.1",
83+
"get-tsconfig": "^4.10.0",
8484
"hrtime": "^0.5.0",
85-
"lodash.isequal": "^4.5.0",
86-
"pkg-types": "^1.2.1",
85+
"pkg-types": "^2.1.0",
8786
"pretty-bytes": "^6.1.1",
8887
"pretty-hrtime": "^1.0.3",
89-
"rollup": "^4.28.1",
88+
"rollup": "^4.36.0",
9089
"rollup-plugin-preserve-directives": "^0.4.0",
9190
"trim-newlines": "^5.0.0",
9291
"upath": "^2.0.1",

packages/techor/src/commands/build.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ export default async function build() {
150150
}
151151
(buildOptions.input.plugins as RollupInputPluginOption[]).unshift(
152152
...[
153-
replace({
154-
preventAssignment: true,
155-
'process.env.NODE_ENV': JSON.stringify(extendedBuild.env)
156-
}),
157153
swc(extendedSWCOptions),
158154
config.build.commonjs && commonjs(config.build.commonjs),
159155
config.build.nodeResolve && nodeResolve(config.build.nodeResolve),
160156
config.build.esmShim && esmShim(),
161157
(config.build.preserveDirectives && !extendedBuild.output.file) && preserveDirectives(config.build.preserveDirectives),
158+
replace({
159+
preventAssignment: true,
160+
'process.env.NODE_ENV': JSON.stringify(extendedBuild.env)
161+
}),
162162
]
163163
.filter((existence) => existence)
164164
)
@@ -215,8 +215,12 @@ export default async function build() {
215215
case 'import':
216216
handleExports(eachUnknowExports, 'esm')
217217
break
218-
default:
218+
case 'development':
219219
handleExports(eachUnknowExports, eachFormat)
220+
break
221+
case 'production':
222+
handleExports(eachUnknowExports, eachFormat)
223+
break
220224
}
221225
}
222226
}

packages/techor/tests/global/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ it('generate iife format', () => {
1111
})
1212

1313
it('should bundle all deps', () => {
14-
expect(readFileSync(join(__dirname, './dist/global.min.js'), 'utf-8')).toContain('typeof(e={foo:"bar"})')
14+
expect(readFileSync(join(__dirname, './dist/global.min.js'), 'utf-8')).toContain('typeof(e={})')
1515
})
1616

1717
it('should be minifined', () => {
18-
expect(readFileSync(join(__dirname, './dist/global.min.js'), 'utf-8')).toBe('var e;let o;console.log((o=typeof(e={foo:"bar"}),null!==e&&("object"===o||"function"===o))),globalThis.effect1="created",globalThis.effect2="created";\n')
18+
expect(readFileSync(join(__dirname, './dist/global.min.js'), 'utf-8')).toBe('var e;let l;console.log((l=typeof(e={}),null!==e&&("object"===l||"function"===l))),globalThis.effect1="created",globalThis.effect2="created";\n')
1919
})
2020

2121
it('should not contain @swc/helpers', () => {

0 commit comments

Comments
 (0)