forked from stephan83/download-github-release
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from terascope/switch-to-ts
Migrate to typescript to reduce the dependencies
- Loading branch information
Showing
44 changed files
with
3,241 additions
and
2,925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{js,ts,jsx,tsx,json,md}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
max_line_length = off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"extends": "airbnb/base", | ||
"env": { | ||
"mocha": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"comma-dangle": 0, | ||
"no-console": 0 | ||
} | ||
"extends": "@terascope" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
*.log | ||
node_modules | ||
lib | ||
dist | ||
tmp | ||
coverage |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,23 @@ | |
dist: bionic | ||
language: node_js | ||
node_js: | ||
- '10' | ||
- '12' | ||
- '14' | ||
branches: | ||
only: | ||
- master | ||
- "/^v\\d+\\.\\d+\\.\\d+/" | ||
- master | ||
- "/^v\\d+\\.\\d+\\.\\d+/" | ||
install: | ||
- yarn | ||
- yarn | ||
before_script: | ||
- yarn build | ||
script: | ||
- stty cols 80 | ||
- yarn test:cov | ||
- yarn build:lib | ||
- stty cols 80 | ||
- yarn test | ||
after_script: | ||
- yarn lint | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
- bash <(curl -s https://codecov.io/bash) | ||
deploy: | ||
provider: npm | ||
email: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
verbose: true, | ||
testEnvironment: 'node', | ||
setupFilesAfterEnv: ['jest-extended'], | ||
collectCoverage: true, | ||
coverageReporters: ['json', 'lcov', 'text', 'html'], | ||
coverageDirectory: 'coverage', | ||
collectCoverageFrom: [ | ||
'<rootDir>/src/**/*.ts', | ||
'!<rootDir>/**/coverage/**', | ||
'!<rootDir>/**/*.d.ts', | ||
'!<rootDir>/**/dist/**', | ||
'!<rootDir>/**/coverage/**' | ||
], | ||
testMatch: [ | ||
'<rootDir>/test/**/*-spec.{ts,js}', | ||
'<rootDir>/test/*-spec.{ts,js}', | ||
], | ||
preset: 'ts-jest', | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: './tsconfig.json', | ||
diagnostics: true, | ||
}, | ||
ignoreDirectories: ['dist'], | ||
availableExtensions: ['.js', '.ts'] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import yargs from 'yargs'; | ||
import { downloadRelease } from './downloadRelease'; | ||
import { version } from '../package.json'; | ||
import { GithubRelease, GithubReleaseAsset } from './interfaces'; | ||
|
||
const command = yargs | ||
.option('prerelease', { | ||
description: 'download prerelease', | ||
type: 'boolean', | ||
alias: 'p', | ||
default: false | ||
}) | ||
.option('search', { | ||
description: 'filter assets name, this can be regex', | ||
alias: 's', | ||
type: 'string', | ||
}) | ||
.option('quiet', { | ||
description: 'don\'t log to console', | ||
type: 'boolean', | ||
alias: 'q', | ||
default: false | ||
}) | ||
.option('zipped', { | ||
description: 'don\'t extract zip files', | ||
type: 'boolean', | ||
alias: 'z', | ||
default: false | ||
}) | ||
.positional('user', { | ||
description: 'The Github user', | ||
type: 'string', | ||
}) | ||
.requiresArg('user') | ||
.positional('repo', { | ||
description: 'The Github repo', | ||
type: 'string', | ||
}) | ||
.requiresArg('repo') | ||
.positional('outputdir', { | ||
description: 'The directory to download the assets to', | ||
type: 'string', | ||
default: process.cwd() | ||
}) | ||
.version(version) | ||
.argv; | ||
|
||
const { user, repo, outputdir } = command; | ||
|
||
function filterRelease(release: GithubRelease): boolean { | ||
return release.draft === false && release.prerelease === !!command.prerelease; | ||
} | ||
|
||
function filterAsset(asset: GithubReleaseAsset): boolean { | ||
if (!command.search) { | ||
return true; | ||
} | ||
|
||
return new RegExp(command.search).test(asset.name); | ||
} | ||
|
||
downloadRelease(user!, repo!, outputdir, filterRelease, filterAsset, | ||
!!command.zipped, !!command.quiet) | ||
.catch((err) => console.error(err.message)); |
Oops, something went wrong.