Skip to content

Commit

Permalink
rewrite in ts, export impls, hybrid export
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jul 30, 2023
1 parent 06853f6 commit 40eea01
Show file tree
Hide file tree
Showing 30 changed files with 2,696 additions and 5,128 deletions.
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 17.x]
node-version: [16.x, 18.x, 19.x]
platform:
- os: ubuntu-latest
shell: bash
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/commit-if-modified.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/copyright-year.sh

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/isaacs-makework.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/package-json-repo.js

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Nodejs ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies
run: npm install
- name: Generate typedocs
run: npm run typedoc

- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.nyc_output/
coverage/
/.nyc_output
/coverage
/dist
/node_modules
57 changes: 40 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,68 @@ Windows.

## USAGE

```javascript
var isexe = require('isexe')
isexe('some-file-name', function (err, isExe) {
if (err) {
console.error('probably file does not exist or something', err)
} else if (isExe) {
```js
import { isexe, sync } from 'isexe'
// or require() works too
// const { isexe } = require('isexe')
isexe('some-file-name').then(isExe => {
if (isExe) {
console.error('this thing can be run')
} else {
console.error('cannot be run')
}
}, (err) => {
console.error('probably file doesnt exist or something')
})

// same thing but synchronous, throws errors
var isExe = isexe.sync('some-file-name')
isExe = sync('some-file-name')

// treat errors as just "not executable"
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
const isExe = await isexe('maybe-missing-file', { ignoreErrors: true })
const isExe = sync('maybe-missing-file', { ignoreErrors: true })
```

## API

### `isexe(path, [options], [callback])`
### `isexe(path, [options]) => Promise<boolean>`

Check if the path is executable. If no callback provided, and a
global `Promise` object is available, then a Promise will be returned.
Check if the path is executable.

Will raise whatever errors may be raised by `fs.stat`, unless
`options.ignoreErrors` is set to true.

### `isexe.sync(path, [options])`
### `sync(path, [options]) => boolean`

Same as `isexe` but returns the value and throws any errors raised.

## Platform Specific Implementations

If for some reason you want to use the implementation for a
specific platform, you can do that.

```js
import { win32, posix } from 'isexe'
win32.isexe(...)
win32.sync(...)
// etc

// or:
import { isexe, sync } from 'isexe/posix'
```

The default exported implementation will be chosen based on
`process.platform`.

### Options

* `ignoreErrors` Treat all errors as "no, this is not executable", but
don't raise them.
* `uid` Number to use as the user id
* `gid` Number to use as the group id
```ts
import type IsexeOptions from 'isexe'
```

* `ignoreErrors` Treat all errors as "no, this is not
executable", but don't raise them.
* `uid` Number to use as the user id on posix
* `gid` Number to use as the group id on posix
* `pathExt` List of path extensions to use instead of `PATHEXT`
environment variable on Windows.
57 changes: 0 additions & 57 deletions index.js

This file was deleted.

41 changes: 0 additions & 41 deletions mode.js

This file was deleted.

Loading

0 comments on commit 40eea01

Please sign in to comment.