Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Distribution files
dist

# Logs
logs
*.log
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Instead of ```node-pre-gyp publish``` use **```node-pre-gyp-github publish```**
For Ex. ```node-pre-gyp-github publish --release```

## Install
```javascript
```bash
npm install -g node-pre-gyp-github
```

## Configuration
This module is intended to be used with node-pre-gyp. Therefore, be sure to configure and install node-pre-gyp first. After having done that, within **```package.json```** update the ```binary``` properties ```host``` and ```remote_path``` so it matches the following format:

```
```json
"host": "https://github.com/[owner]/[repo]/releases/download/",
"remote_path": "{version}"
```
Expand Down
32 changes: 0 additions & 32 deletions bin/node-pre-gyp-github.js

This file was deleted.

168 changes: 0 additions & 168 deletions index.js

This file was deleted.

33 changes: 25 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"name": "node-pre-gyp-github",
"version": "1.4.3",
"description": "A node-pre-gyp module which provides the ability to publish to GitHub releases.",
"bin": "./bin/node-pre-gyp-github.js",
"main": "index.js",
"bin": "dist/cli.js",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"test": "nyc --reporter=html --reporter=text mocha",
"build": "tsc",
"test": "xo && nyc --reporter=html --reporter=text mocha",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"repository": {
Expand All @@ -25,21 +29,34 @@
"releases"
],
"dependencies": {
"@octokit/rest": "^15.9.5",
"commander": "^2.17.0",
"mime-types": "^2.1.19"
"@octokit/rest": "^18.0.6",
"meow": "^7.1.1",
"mime-types": "^2.1.27",
"p-map": "^4.0.0",
"parse-github-url": "^1.0.2",
"pupa": "^2.1.1",
"read-pkg-up": "^7.0.1",
"update-notifier": "^5.0.0"
},
"devDependencies": {
"@richienb/tsconfig": "^0.1.1",
"chai": "^3.5.0",
"coveralls": "^3.0.2",
"mocha": "^5.2.0",
"nyc": "^12.0.2",
"sinon": "^6.1.4"
"sinon": "^6.1.4",
"typescript": "^4.0.5",
"xo": "^0.34.1"
},
"author": "Bill Christo",
"license": "MIT",
"bugs": {
"url": "https://github.com/bchr02/node-pre-gyp-github/issues"
},
"homepage": "https://github.com/bchr02/node-pre-gyp-github#readme"
"homepage": "https://github.com/bchr02/node-pre-gyp-github#readme",
"xo": {
"rules": {
"@typescript-eslint/no-implicit-any-catch": "off"
}
}
}
57 changes: 57 additions & 0 deletions source/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env node

import meow from 'meow';
import updateNotifier from 'update-notifier';
import nodePreGypGithub from '.';

const {input, flags, pkg, showHelp} = meow(`
Usage
$ node-pre-gyp-github publish

Options
--release If a release is created don't mark it as a draft after the assets have finished uploading.
--silent Whether to log all status updates. Errors will always show.

Examples
$ node-pre-gyp-github publish
...
Richienb/the-module@1.0.0 was just published.
`, {
flags: {
release: {
type: 'boolean',
default: false
},
silent: {
type: 'boolean',
default: false
}
}
});

const [action] = input;

const getGithubAuthentication = () => {
const token = process.env.NODE_PRE_GYP_GITHUB_TOKEN;
if (!token) {
throw new Error('NODE_PRE_GYP_GITHUB_TOKEN environment variable not found');
}

return token;
};

(async () => {
if (action === 'publish') {
await nodePreGypGithub({
githubAuth: getGithubAuthentication()
}, status => {
if (!flags.silent) {
console.log(status);
}
});
} else {
showHelp();
}

updateNotifier({pkg}).notify();
})();
Loading