mirror of https://github.com/aminya/setup-cpp
Merge pull request #98 from aminya/esm
This commit is contained in:
commit
09018b0e8d
|
@ -26,6 +26,7 @@ words:
|
||||||
- devel
|
- devel
|
||||||
- dyld
|
- dyld
|
||||||
- eabi
|
- eabi
|
||||||
|
- esmodule
|
||||||
- execa
|
- execa
|
||||||
- ftxui
|
- ftxui
|
||||||
- gcovr
|
- gcovr
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,7 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: "ts-jest/presets/default-esm",
|
preset: "ts-jest/presets/js-with-ts-esm",
|
||||||
|
extensionsToTreatAsEsm: [".ts"],
|
||||||
|
transformIgnorePatterns: [], // transform everything
|
||||||
testEnvironment: "node",
|
testEnvironment: "node",
|
||||||
testMatch: ["**/*.test.ts"],
|
testMatch: ["**/*.test.ts"],
|
||||||
testPathIgnorePatterns: ["<rootDir>/src/python/setup-python/"],
|
testPathIgnorePatterns: ["<rootDir>/src/python/setup-python/"],
|
||||||
|
|
14
package.json
14
package.json
|
@ -5,7 +5,12 @@
|
||||||
"repository": "https://github.com/aminya/setup-cpp",
|
"repository": "https://github.com/aminya/setup-cpp",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": "Amin Yahyaabadi",
|
"author": "Amin Yahyaabadi",
|
||||||
|
"exports": {
|
||||||
|
"import": "./dist/setup-cpp.mjs",
|
||||||
|
"require": "./dist/setup-cpp.js"
|
||||||
|
},
|
||||||
"main": "./dist/setup_cpp.js",
|
"main": "./dist/setup_cpp.js",
|
||||||
|
"module": "./dist/setup_cpp.mjs",
|
||||||
"source": "./src/main.ts",
|
"source": "./src/main.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"setup-cpp": "./dist/setup_cpp.js",
|
"setup-cpp": "./dist/setup_cpp.js",
|
||||||
|
@ -121,7 +126,14 @@
|
||||||
"main": {
|
"main": {
|
||||||
"context": "node",
|
"context": "node",
|
||||||
"includeNodeModules": true,
|
"includeNodeModules": true,
|
||||||
"optimize": true
|
"optimize": true,
|
||||||
|
"outputFormat": "commonjs"
|
||||||
|
},
|
||||||
|
"module": {
|
||||||
|
"context": "node",
|
||||||
|
"includeNodeModules": true,
|
||||||
|
"optimize": true,
|
||||||
|
"outputFormat": "esmodule"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
|
||||||
import { getVersion } from "../../default_versions"
|
import { getVersion } from "../../default_versions"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
import { isGitHubCI } from "../../utils/env/isci"
|
import { isGitHubCI } from "../../utils/env/isci"
|
||||||
|
import { info } from "../../utils/io/io"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
describe("setup-python", () => {
|
describe("setup-python", () => {
|
||||||
|
@ -13,13 +14,11 @@ describe("setup-python", () => {
|
||||||
|
|
||||||
it("should setup python in GitHub Actions", async () => {
|
it("should setup python in GitHub Actions", async () => {
|
||||||
if (isGitHubCI()) {
|
if (isGitHubCI()) {
|
||||||
const installInfo = await setupPython(
|
info("Installing python in GitHub Actions")
|
||||||
getVersion("python", "true", await ubuntuVersion()),
|
const { setupActionsPython } = await import("../actions_python")
|
||||||
directory,
|
await setupActionsPython(getVersion("python", "true", await ubuntuVersion()), directory, process.arch)
|
||||||
process.arch
|
|
||||||
)
|
|
||||||
|
|
||||||
await testBin("python", ["--version"], installInfo?.binDir)
|
await testBin("python", ["--version"])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ export async function setupPython(version: string, setupDir: string, arch: strin
|
||||||
return setupPythonViaSystem(version, setupDir, arch)
|
return setupPythonViaSystem(version, setupDir, arch)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
info("Installing python in GitHub Actions")
|
||||||
const { setupActionsPython } = await import("./actions_python")
|
const { setupActionsPython } = await import("./actions_python")
|
||||||
return setupActionsPython(version, setupDir, arch)
|
return setupActionsPython(version, setupDir, arch)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -49,5 +49,5 @@ export async function testBin(
|
||||||
expect(status).toBe(0)
|
expect(status).toBe(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(await io.which(name, true)).toBe(bin)
|
expect((await io.which(name, true)).includes(bin))
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"module": "commonjs",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": false,
|
"importHelpers": false,
|
||||||
"outDir": "./dist"
|
"outDir": "./dist"
|
||||||
|
|
Loading…
Reference in New Issue