Skip to content
Merged
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
9 changes: 4 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# https://github.com/orgs/community/discussions/26276#discussioncomment-3251141
name: CI Lint
on:
push:
branches:
- main
branches: [main]
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
- run: npm install
- run: npm run lint
21 changes: 0 additions & 21 deletions .github/workflows/test-push.yml

This file was deleted.

12 changes: 7 additions & 5 deletions .github/workflows/test-pr.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# https://github.com/orgs/community/discussions/26276#discussioncomment-3251141
name: CI Test
on:
- pull_request
push:
branches: [main]
pull_request:

jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [16, 18]
node-version: ["22.22", "24.15", "26"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
coverage
dist
node_modules/
coverage/
dist/
package-lock.json
yarn.lock
pnpm-*.yaml
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
allow-scripts=dprint,unrs-resolver
24 changes: 0 additions & 24 deletions .xo-config.json

This file was deleted.

16 changes: 16 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"includes": ["**/*.{js,ts,json,jsonc,yml,md}"],
"extends": ["node_modules/@tommy-mitchell/dprint-config/index.json"],
"plugins": [
"npm:@dprint/json@0.25.0",
"npm:@dprint/markdown@0.24.0",
"npm:@dprint/typescript@0.96.1",
"npm:dprint-plugin-malva@0.16.0",
"npm:dprint-plugin-markup@0.27.5",
"npm:dprint-plugin-yaml@0.6.0"
],
"json": {
"trailingCommas": "maintain"
}
}
117 changes: 52 additions & 65 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
{
"name": "execify-cli",
"version": "0.2.1-0",
"description": "Easily make a Node.js CLI executable.",
"description": "Cross-platform `chmod +x`. Easily make a Node.js CLI executable.",
"license": "MIT",
"repository": "tommy-mitchell/execify-cli",
"author": "Tommy Mitchell (https://tommymitchell.io)",
"type": "module",
"imports": {
"#src/*.ts": "./src/*.ts"
},
"bin": {
"execify": "./dist/cli.js"
},
"engines": {
"node": "^22.22 || ^24.15 || >=26"
},
"scripts": {
"prepare": "npm run build",
"build": "tsc -p tsconfig.build.json && node dist/cli.js --pkg",
"lint": "dprint check && xo",
"format": "dprint fmt && xo --fix",
"test": "c8 ava"
},
"files": [
"dist"
],
"keywords": [
"cli",
"cli-app",
Expand All @@ -11,75 +34,39 @@
"chmod+x",
"shebang",
"hashbang",
"typescript",
"binary",
"bin",
"executable"
],
"license": "MIT",
"repository": "tommy-mitchell/execify-cli",
"author": {
"name": "Tommy Mitchell",
"url": "https://tommymitchell.io"
},
"type": "module",
"engines": {
"node": ">=16.17"
},
"bin": {
"execify": "dist/cli.js"
},
"files": [
"dist"
"bin"
],
"scripts": {
"prepare": "npm run build",
"build": "tsc -p tsconfig.build.json && node dist/cli.js --all",
"lint": "xo",
"test": "tsc --noEmit && c8 ava"
},
"ava": {
"files": [
"test/**/*.ts",
"!test/_test-helpers",
"!test/fixtures"
],
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--loader=ts-node/esm",
"--loader=esmock",
"--no-warnings=ExperimentalWarning"
]
},
"dependencies": {
"globby": "^13.2.2",
"meow": "^12.1.0",
"read-pkg-up": "^10.0.0",
"ts-pattern": "^5.0.5"
"log-symbols": "^7.0.1",
"meow": "^14.1.0",
"read-package-up": "^12.0.0"
},
"devDependencies": {
"@tommy-mitchell/tsconfig": "^1.1.0",
"@types/node": "^16.17",
"ava": "^5.3.1",
"c8": "^8.0.1",
"cp-file": "^10.0.0",
"cross-env": "^7.0.3",
"dot-prop": "^8.0.2",
"esmock": "^2.3.6",
"execa": "^7.2.0",
"get-bin-path": "^10.0.0",
"@tommy-mitchell/dprint-config": "^0.8.0",
"@tommy-mitchell/eslint-config-xo": "^2.0.0-beta.11",
"@tommy-mitchell/tsconfig": "^4.0.0",
"@types/node": "^22.20",
"async-sema": "^3.1.1",
"ava": "^8.0.1",
"c8": "^12.0.0",
"dedent": "^1.7.2",
"dprint": "^0.58.0",
"execa": "^10.0.1",
"get-executable-bin-path": "^1.0.0",
"is-executable": "^2.0.1",
"make-executable": "^2.0.2",
"map-obj": "^5.0.2",
"p-map": "^6.0.0",
"proper-tags": "^2.0.1",
"tempy": "^3.1.0",
"testtriple": "^2.2.3",
"ts-node": "^10.9.1",
"type-fest": "^4.2.0",
"typescript": "~5.1.6",
"xo": "^0.56.0"
"test-quadruple": "^1.0.0",
"typescript": "~6.0.3",
"xo": "^5.0.1"
},
"ava": {
"extensions": [
"ts"
],
"environmentVariables": {
"concurrency": "10",
"//": "Suppress loader warnings from esmock",
"NODE_OPTIONS": "--disable-warning=DeprecationWarning"
}
}
}
55 changes: 32 additions & 23 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# execify-cli

Easily make a Node.js CLI executable. Sets permissions (`chmod +x`) and handles common TypeScript conversions. See [Roadmap](#roadmap) for more details.
Cross-platform `chmod +x`. Easily make a Node.js CLI executable.

Sets executable permissions on given binaries, or optionally on every binary in the nearest `package.json`.

Works well in build scripts:

```jsonc
// package.json
"scripts": {
"build": "tsc && execify --pkg"
}
```

## Install

Expand All @@ -10,43 +21,41 @@ npm install --save-dev execify-cli

<details>
<summary>Other Package Managers</summary>
<p>

```sh
yarn add --dev execify-cli
```

```sh
pnpm add --save-dev execify-cli
```

</p>
</details>

## Usage

```
```txt
Usage
$ execify [globs…]
$ execify [paths…]

Options
--package, --pkg, -p Set every binary in package.json as executable
--fix-shebang Convert shebangs to "#!/usr/bin/env node"
--all Set all flags

Examples
$ execify cli.js

$ execify --pkg test/fixtures/**/cli.js

$ execify --fix-shebang dist/ts-cli.js
$ execify foo.js bar.ts baz/xyz.sh
✔ Execified "foo.js"
⚠ File "foo.js" is missing a shebang!
ℹ File "bar.ts" is already executable
✖ Failed to execify "baz/xyz.sh", file not found

$ execify --pkg
✔ Execified "./dist/foo.js" (foo-cli)
✔ Execified "./dist/bar.js" (bar-cli)
```

## Roadmap

v0.1.0 is a minimal release. The following features were cut and will be added in the next minor version:

- TypeScript import path mapping from `tsconfig.json` `paths` option
- A flag to fix all TypeScript-related conversions
- Logging of completed/failed files, improved error handling

## Related

- [chmodx](https://github.com/johnowennixon/chmodx)
- [ts-fix-shebang](https://github.com/johnowennixon/ts-fix-shebang)
- [make-executable](https://github.com/bconnorwhite/make-executable)
- [replace-in-files-cli](https://github.com/sindresorhus/replace-in-files-cli)
- [tsconfig-replace-paths](https://github.com/jonkwheeler/tsconfig-replace-paths)
- [chmodx](https://github.com/johnowennixon/chmodx) - A cross platform command line utility for setting the executable bits on files.
- [make-executable](https://github.com/bconnorwhite/make-executable) - Set or remove the executable bits on a file.
Loading
Loading