-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 155c528
Showing
16 changed files
with
4,479 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
- name: Make the production plugin bundle | ||
run: | | ||
release_version=$(cat package.json | jq -r '.version') | ||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | ||
yarn | ||
yarn build | ||
- name: Perform Github Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: v${{ env.RELEASE_VERSION }} | ||
tag_name: v${{ env.RELEASE_VERSION }} | ||
generate_release_notes: true | ||
files: | | ||
dist/*.tar.gz |
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,106 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
.idea/ |
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,3 @@ | ||
node_modules | ||
.github | ||
rollup.config.js |
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 @@ | ||
# Stripe-payouts-refunds-datasource | ||
Official Stripe docs here: https://stripe.com/docs/api/payouts/create?lang=node | ||
|
||
# Description | ||
Manage Stripe customers | ||
|
||
Find out more about [Budibase](https://github.com/Budibase/budibase). | ||
|
||
## Instructions | ||
|
||
To build your new plugin run the following in your Budibase CLI: | ||
``` | ||
budi plugins --build | ||
``` | ||
|
||
You can also re-build everytime you make a change to your plugin with the command: | ||
``` | ||
budi plugins --watch | ||
``` |
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,3 @@ | ||
module.exports = { | ||
presets: [["@babel/preset-env", { targets: { node: "current" } }]], | ||
} |
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,8 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.ts?$": "ts-jest", | ||
}, | ||
transformIgnorePatterns: ["<rootDir>/node_modules/"] | ||
} |
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,37 @@ | ||
{ | ||
"name": "stripe-payouts-refunds-datasource", | ||
"version": "1.0.0", | ||
"description": "Manage Stripe payouts and refunds", | ||
"main": "src/index.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"watch": "rollup -cw" | ||
}, | ||
"dependencies": { | ||
"@budibase/types": "^1.2.38", | ||
"node-fetch": "^2", | ||
"stripe": "^10.11.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.19.0", | ||
"@babel/preset-env": "^7.19.0", | ||
"@jest/globals": "^29.0.3", | ||
"@rollup/plugin-commonjs": "^22.0.2", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@rollup/plugin-typescript": "^8.3.4", | ||
"@types/node-fetch": "^2.6.2", | ||
"babel-jest": "^29.0.3", | ||
"jest": "^29.0.3", | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "^2.44.0", | ||
"rollup-plugin-copy2": "^0.3.1", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tar": "^6.1.11", | ||
"ts-jest": "^29.0.0", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.8.2" | ||
} | ||
} |
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,106 @@ | ||
import resolve from "@rollup/plugin-node-resolve" | ||
import commonjs from "@rollup/plugin-commonjs" | ||
import { terser } from "rollup-plugin-terser" | ||
import json from "rollup-plugin-json" | ||
import copy from "rollup-plugin-copy2" | ||
import typescript from "@rollup/plugin-typescript" | ||
import tar from "tar" | ||
import fs from "fs" | ||
import pkg from "./package.json" | ||
import crypto from "crypto" | ||
|
||
const iconFile = "icon.svg" | ||
const iconExists = fs.existsSync(iconFile) | ||
const assets = ["schema.json", "package.json"] | ||
if (iconExists) { | ||
assets.push(iconFile) | ||
} | ||
|
||
// Custom plugin to clean the dist folder before building | ||
const clean = () => ({ | ||
buildStart() { | ||
const dist = "./dist/" | ||
if (fs.existsSync(dist)) { | ||
fs.readdirSync(dist).forEach(path => { | ||
if (path.endsWith(".tar.gz")) { | ||
fs.unlinkSync(dist + path) | ||
} | ||
}) | ||
} | ||
}, | ||
}) | ||
|
||
// Custom plugin to hash the JS bundle and write it in the schema | ||
const hash = () => ({ | ||
writeBundle() { | ||
// Generate JS hash | ||
const fileBuffer = fs.readFileSync("dist/plugin.min.js") | ||
const hashSum = crypto.createHash("sha1") | ||
hashSum.update(fileBuffer) | ||
const hex = hashSum.digest("hex") | ||
|
||
// Read and parse existing schema from dist folder | ||
const schema = JSON.parse(fs.readFileSync("./dist/schema.json", "utf8")) | ||
|
||
// Write updated schema to dist folder, pretty printed as JSON again | ||
const newSchema = { | ||
...schema, | ||
hash: hex, | ||
version: pkg.version, | ||
} | ||
fs.writeFileSync("./dist/schema.json", JSON.stringify(newSchema, null, 2)) | ||
}, | ||
}) | ||
|
||
// Custom plugin to bundle up our files after building | ||
const bundle = () => ({ | ||
async writeBundle() { | ||
const bundleName = `${pkg.name}-${pkg.version}.tar.gz` | ||
return tar | ||
.c({ gzip: true, cwd: "dist" }, [...assets, "plugin.min.js"]) | ||
.pipe(fs.createWriteStream(`dist/${bundleName}`)) | ||
}, | ||
}) | ||
|
||
export default { | ||
input: "src/index.ts", | ||
output: { | ||
sourcemap: false, | ||
format: "cjs", | ||
file: "dist/plugin.min.js", | ||
inlineDynamicImports: true, | ||
exports: "default", | ||
}, | ||
plugins: [ | ||
clean(), | ||
resolve({ | ||
preferBuiltins: true, | ||
browser: false, | ||
}), | ||
typescript({ | ||
compilerOptions: { | ||
target: "es6", | ||
module: "esnext", | ||
lib: ["es2020"], | ||
allowJs: true, | ||
strict: true, | ||
noImplicitAny: true, | ||
esModuleInterop: true, | ||
resolveJsonModule: true, | ||
types: ["node"], | ||
skipLibCheck: true, | ||
moduleResolution: "node", | ||
}, | ||
include: ["./src/**/*"], | ||
exclude: ["node_modules", "dist", "**/*.spec.ts", "**/*.spec.js"], | ||
}), | ||
commonjs(), | ||
json(), | ||
terser(), | ||
copy({ | ||
assets, | ||
}), | ||
hash(), | ||
bundle(), | ||
], | ||
} |
Oops, something went wrong.