mirror of
https://github.com/Azure/k8s-set-context
synced 2025-09-23 12:08:06 +00:00
Fix for client-node ESM v Commonjs issue. (#132)
Some checks failed
Some checks failed
Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
This commit is contained in:
parent
5374e54fdc
commit
959bbfb69a
5 changed files with 3373 additions and 1170 deletions
7
babel.config.js
Normal file
7
babel.config.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
// babel.config.js
|
||||
export default {
|
||||
presets: [
|
||||
'@babel/preset-env', // For handling ES modules
|
||||
'@babel/preset-typescript' // For handling TypeScript
|
||||
]
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
restoreMocks: true,
|
||||
clearMocks: true,
|
||||
resetMocks: true,
|
||||
|
@ -6,8 +6,16 @@ module.exports = {
|
|||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
'^.+\\.ts$': 'ts-jest', // Use ts-jest for TypeScript files
|
||||
'^.+\\.js$': 'babel-jest' // Transform TypeScript files
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
'/node_modules/(?!@kubernetes/client-node)/' // Make sure to transform the Kubernetes client module
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'^.+\\.css$': 'jest-transform-stub' // Handle CSS imports (if any)
|
||||
},
|
||||
extensionsToTreatAsEsm: ['.ts', '.tsx'], // Treat TypeScript files as ESM
|
||||
verbose: true,
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
|
|
4513
package-lock.json
generated
4513
package-lock.json
generated
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
@ -3,6 +3,7 @@
|
|||
"version": "4.0.0",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"prebuild": "npm i @vercel/ncc",
|
||||
"build": "ncc build src/run.ts -o lib",
|
||||
|
@ -22,17 +23,20 @@
|
|||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@kubernetes/client-node": "^0.22.3",
|
||||
"@kubernetes/client-node": "^1.1.0",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.26.9",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^22.10.2",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"babel-jest": "^29.7.0",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.4.2",
|
||||
"ts-jest": "^29.2.5",
|
||||
"typescript": "^5.7.2"
|
||||
"prettier": "^3.5.3",
|
||||
"ts-jest": "^29.2.6",
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext", // or "NodeNext" depending on your setup
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@actions/core": ["node_modules/@actions/core"],
|
||||
"@kubernetes/client-node": ["node_modules/@kubernetes/client-node"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "tests", "src/**/*.test.ts"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue