-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Waren Gonzaga
committed
Oct 11, 2020
1 parent
140b71a
commit 447ee53
Showing
7 changed files
with
1,587 additions
and
51 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,9 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
|
||
"env": { | ||
"es6": true | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/*! | ||
* BuyMeACoffeeJS - https://github.com/WarenGonzaga/buymeacoffee.js#readme | ||
* A simple and lightweight but powerful Node.js client for Buy Me A Coffee API | ||
* Version: 1.0.0-beta.1 | ||
* Github: https://github.com/WarenGonzaga/buymeacoffee.js | ||
* Licensed Under The MIT License: http://opensource.org/licenses/MIT | ||
* Copyright (c) 2020 Waren Gonzaga | ||
* | ||
* Facebook: @warengonzagaofficial | ||
* Twitter: @warengonzaga | ||
* Github: @warengonzaga | ||
* Website: warengonzaga.com | ||
*/ | ||
|
||
const{get:get}=require("request"),baseURL="https://developers.buymeacoffee.com/api/v1";class BMC{constructor(s){this.access_token=s}Supporters(s){this._sendRequest("supporters",s)}Subscriptions(s){this._sendRequest("subscriptions",s)}Extras(s){this._sendRequest("extras",s)}_sendRequest(s,e){get(`${baseURL}/${s}`,{auth:{bearer:this.access_token}},(function(s,t,r){!s&200===t.statusCode&&e(JSON.parse(r))}))}} |
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,66 @@ | ||
/** | ||
/*! | ||
* Buy Me A Coffee JS | Gulpfile | ||
* By Waren Gonzaga | ||
*/ | ||
|
||
const { series, parallel } = require('gulp'); | ||
// modules | ||
const { | ||
series, | ||
src, | ||
dest } = require('gulp'), | ||
uglify = require('gulp-uglify-es').default, | ||
eslint = require('gulp-eslint'), | ||
pipeline = require('readable-stream').pipeline, | ||
header = require('gulp-header'), | ||
fs = require('fs'); | ||
|
||
function check(cb) { | ||
cb(); | ||
// dev paths | ||
const path = { | ||
dist: "./dist", | ||
scripts: "./src/*.js" | ||
}; | ||
|
||
// open source label | ||
const pkg = JSON.parse(fs.readFileSync('package.json')); | ||
const data = { | ||
banner: [ | ||
'/*!', | ||
' * BuyMeACoffeeJS - <%= homepage %>', | ||
' * <%= description %>', | ||
' * Version: <%= version %>', | ||
' * Github: <%= github %>', | ||
' * Licensed Under The MIT License: http://opensource.org/licenses/MIT', | ||
' * Copyright (c) <%= new Date().getFullYear() %> <%= author %>', | ||
' *', | ||
' * Facebook: @warengonzagaofficial', | ||
' * Twitter: @warengonzaga', | ||
' * Github: @warengonzaga', | ||
' * Website: warengonzaga.com', | ||
' */\n\n', | ||
].join('\n'), | ||
}; | ||
|
||
// lint js | ||
function lintJS() { | ||
return src(path.scripts) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failAfterError()); | ||
} | ||
|
||
exports.default = series(check); | ||
// minify js | ||
function minifyJS() { | ||
return pipeline( | ||
src(path.scripts), | ||
uglify(), | ||
dest(path.dist)); | ||
} | ||
|
||
// add copyright label | ||
function copyright() { | ||
return src([path.dist+"/*.js"], {allowEmpty: true}) | ||
.pipe(header(data.banner, pkg)) | ||
.pipe(dest([path.dist])); | ||
} | ||
|
||
exports.default = series(lintJS, minifyJS, copyright); |
Oops, something went wrong.