Skip to content

Commit

Permalink
Port the CLI script to CommonJS
Browse files Browse the repository at this point in the history
cedx committed Jan 12, 2025
1 parent 373c8fb commit 4ad50d5
Showing 7 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
@@ -18,4 +18,4 @@ inputs:

runs:
using: node20
main: bin/setup_ant.js
main: bin/setup_ant.cjs
63 changes: 63 additions & 0 deletions bin/setup_ant.cjs

Large diffs are not rendered by default.

63 changes: 0 additions & 63 deletions bin/setup_ant.js

This file was deleted.

5 changes: 2 additions & 3 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
@@ -18,14 +18,13 @@ export dist = ->
await npx "esbuild",
"\"--banner:js=#!/usr/bin/env node\"",
"--bundle",
"--format=esm",
"--legal-comments=none",
"--log-level=warning",
"--minify",
"--outfile=bin/setup_ant.js",
"--outfile=bin/setup_ant.cjs",
" --platform=node",
"lib/cli.js"
await run "git", "update-index", "--chmod=+x", "bin/setup_ant.js"
await run "git", "update-index", "--chmod=+x", "bin/setup_ant.cjs"

# Performs the static analysis of source code.
export lint = ->
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"url": "https://belin.io"
},
"bin": {
"setup_ant": "bin/setup_ant.js"
"setup_ant": "bin/setup_ant.cjs"
},
"dependencies": {
"@actions/core": "^1.11.1",
7 changes: 4 additions & 3 deletions src/cli.coffee
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@ import process from "node:process"
import {Release} from "./release.js"
import {Setup} from "./setup.js"

try
# Application entry point.
main = ->
process.title = "Setup Ant"

version = getInput "version"
@@ -15,5 +16,5 @@ try
path = await new Setup(release).install {optionalTasks}
info "Apache Ant #{release.version} successfully #{installed} in \"#{path}\"."

catch error
setFailed if error instanceof Error then error else String error
# Start the application.
main().catch error -> setFailed if error instanceof Error then error else String error

0 comments on commit 4ad50d5

Please sign in to comment.