Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update dependencies - use ESM modules #68

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ temp-*

# Build directories
./dist/
!./dist/setup_cpp.js
!./dist/setup_cpp.js.map
!./dist/setup_cpp.mjs
!./dist/setup_cpp.mjs.map
.parcel-cache
exe
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,25 @@ NOTE: On Unix systems, you will not need `sudo` if you are already a root user (

### With Nodejs

Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.13.2/setup_cpp.js), and run it with the available options.
Download the `setup_cpp.mjs` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.13.2/setup_cpp.mjs), and run it with the available options.

On Windows:

Open the shell as admin, download via `curl`, then install

```ps1
# open shell as admin
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.13.2/setup_cpp.js"
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.13.2/setup_cpp.mjs"
node ./setup_cpp.mjs --compiler llvm --cmake true --ninja true --ccache true --vcpkg true

RefreshEnv.cmd # activate cpp environment variables
```

On Linux or Mac:

```ps1
wget "https://github.com/aminya/setup-cpp/releases/download/v0.13.2/setup_cpp.js"
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
wget "https://github.com/aminya/setup-cpp/releases/download/v0.13.2/setup_cpp.mjs"
sudo node ./setup_cpp.mjs --compiler llvm --cmake true --ninja true --ccache true --vcpkg true

source ~/.cpprc # activate cpp environment variables
```
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ inputs:

runs:
using: "node12"
main: "dist/setup_cpp.js"
main: "dist/setup_cpp.mjs"

branding:
icon: "award"
Expand Down
4 changes: 2 additions & 2 deletions dev/docker/ubuntu_20.04_node.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ RUN apt-get install -y --no-install-recommends curl gnupg ca-certificates
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y --no-install-recommends nodejs

# add setup_cpp.js
# add setup_cpp.mjs
ADD "./dist/" "/"
WORKDIR "/"

# run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --make true
RUN node ./setup_cpp.mjs --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --make true

CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]
Expand Down
4 changes: 2 additions & 2 deletions dev/docker/ubuntu_node.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ FROM ubuntu:22.04 AS base
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends nodejs

# add setup_cpp.js
# add setup_cpp.mjs
ADD "./dist/" "/"
WORKDIR "/"

# run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --make true
RUN node ./setup_cpp.mjs --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --make true

CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]
Expand Down
2 changes: 1 addition & 1 deletion dev/scripts/debug_remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { join, dirname } = require("path")

async function main() {
console.log("Disabling debug messages inside @actions/core")
const file = join(dirname(__dirname), "dist", "setup_cpp.js")
const file = join(dirname(__dirname), "dist", "setup_cpp.mjs")
const { code, map } = await minify(readFileSync(file, "utf8"), { sourceMap: true, ...require("../.terserrc.js") })

writeFileSync(file, code)
Expand Down
2 changes: 1 addition & 1 deletion dev/scripts/pack-exe.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function main() {
return Promise.all(
exes.map((exe) =>
exec(
`./node_modules/.bin/caxa --input ./dist --output ./exe/setup_cpp_${getPlatformName()}${exe} -- "{{caxa}}/node_modules/.bin/node${exe}" "{{caxa}}/setup_cpp.js"`
`./node_modules/.bin/caxa --input ./dist --output ./exe/setup_cpp_${getPlatformName()}${exe} -- "{{caxa}}/node_modules/.bin/node${exe}" "{{caxa}}/setup_cpp.mjs"`
)
)
)
Expand Down
2 changes: 2 additions & 0 deletions dist/actions_python.06541d7b.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/actions_python.06541d7b.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/actions_python.469b76e6.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/actions_python.469b76e6.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions dist/setup_cpp.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/setup_cpp.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions dist/setup_cpp.mjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/setup_cpp.mjs.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
preset: "ts-jest/presets/default-esm",
preset: "ts-jest/presets/js-with-ts-esm",
extensionsToTreatAsEsm: [".ts"],
transformIgnorePatterns: [], // transform everything
testEnvironment: "node",
testMatch: ["**/*.test.ts"],
testPathIgnorePatterns: ["<rootDir>/src/python/setup-python/"],
Expand Down
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
"repository": "https://github.com/aminya/setup-cpp",
"license": "Apache-2.0",
"author": "Amin Yahyaabadi",
"main": "./dist/setup_cpp.js",
"main": "dist/setup_cpp.js",
"module": "dist/setup_cpp.mjs",
"source": "./src/main.ts",
"bin": {
"setup-cpp": "./dist/setup_cpp.js",
"setup_cpp": "./dist/setup_cpp.js"
"setup-cpp": "./dist/setup_cpp.mjs",
"setup_cpp": "./dist/setup_cpp.mjs"
},
"scripts": {
"build": "shx rm -rf dist/ && shx mkdir ./dist && run-p test.tsc build.parcel copy.matchers",
"build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .",
"build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report",
"bump": "ncu -u -x execa,numerous && pnpm update",
"bump": "ncu -u -x numerous && pnpm update && ls-engines --save",
"clean": "shx rm -rf .parcel-cache dist exe",
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/ && shx cp ./src/msvc/msvc_matcher.json ./dist && shx cp ./src/python/python_matcher.json ./dist/ && shx cp ./src/llvm/llvm_matcher.json ./dist/ ",
"dev": "cross-env NODE_ENV=development parcel watch",
Expand All @@ -33,11 +34,11 @@
},
"prettier": "prettier-config-atomic",
"dependencies": {
"@actions/core": "^1.7.0",
"@actions/core": "^1.8.0",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^1.7.2",
"execa": "^5.1.1",
"execa": "^6.1.0",
"mri": "^1.2.0",
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
"numerous": "1.0.3",
Expand All @@ -63,6 +64,7 @@
"eslint-config-atomic": "^1.17.1",
"jest": "^28.0.3",
"loose-ts-check": "^1.2.0",
"ls-engines": "^0.6.5",
"npm-check-updates": "^12.5.11",
"npm-run-all2": "^5.0.2",
"parcel": "^2.5.0",
Expand All @@ -74,7 +76,7 @@
"typescript": "^4.6.4"
},
"engines": {
"node": ">=12.x"
"node": "^18 || ^17 || ^16 || ^14.13.1 || ^12.20"
},
"keywords": [
"github-actions",
Expand Down Expand Up @@ -111,7 +113,8 @@
}
},
"targets": {
"main": {
"main": false,
"module": {
"context": "node",
"includeNodeModules": true,
"optimize": true
Expand Down
Loading