Skip to content

Commit a5bc03f

Browse files
authored
Merge pull request #33 from ghostdevv/next
2 parents 90f6657 + 62bff2c commit a5bc03f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4827
-8869
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1-
name: Test Suite CI
1+
name: Tests
22

33
on: [push, pull_request]
44

55
jobs:
6-
test:
7-
runs-on: ubuntu-latest
6+
test:
7+
runs-on: ubuntu-latest
88

9-
strategy:
10-
matrix:
11-
node-version: [10.x, 12.x, 14.x]
9+
strategy:
10+
matrix:
11+
node-version: [14.x, 16.x, 18.x]
1212

1313
steps:
14-
- uses: actions/checkout@v2
15-
- name: Use Node.js ${{ matrix.node-version }}
16-
uses: actions/setup-node@v1
17-
with:
18-
node-version: ${{ matrix.node-version }}
19-
- run: npm i
20-
- run: npm test
14+
- uses: actions/checkout@v2
15+
16+
- name: Setup Node 16
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 16
20+
registry-url: https://registry.npmjs.org/
21+
22+
- name: Setup PNPM
23+
uses: pnpm/[email protected]
24+
with:
25+
version: 7.0.0
26+
27+
- name: Install
28+
run: pnpm install
29+
30+
- name: Test
31+
run: pnpm test

.github/workflows/release-cd.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release Package & Test
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
node-version: [14.x, 16.x, 18.x]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Setup Node 16
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 16
22+
registry-url: https://registry.npmjs.org/
23+
24+
- name: Setup PNPM
25+
uses: pnpm/[email protected]
26+
with:
27+
version: 7.0.0
28+
29+
- name: Install
30+
run: pnpm install
31+
32+
- name: Test
33+
run: pnpm test
34+
35+
publish-npm:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v2
40+
41+
- name: Setup Node 16
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: 16
45+
registry-url: https://registry.npmjs.org/
46+
47+
- name: Setup PNPM
48+
uses: pnpm/[email protected]
49+
with:
50+
version: 7.0.0
51+
52+
- name: Install
53+
run: pnpm install
54+
55+
- name: Build
56+
run: pnpm build
57+
58+
- name: Publish
59+
run: |
60+
pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
61+
pnpm publish --no-git-checks
62+
env:
63+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2+
dist
23
dev

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,17 @@
22
"[javascript]": {
33
"editor.defaultFormatter": "esbenp.prettier-vscode",
44
"editor.formatOnSave": true
5+
},
6+
"[typescript]": {
7+
"editor.defaultFormatter": "esbenp.prettier-vscode",
8+
"editor.formatOnSave": true
9+
},
10+
"[svelte]": {
11+
"editor.defaultFormatter": "svelte.svelte-vscode",
12+
"editor.formatOnSave": true
13+
},
14+
"[json]": {
15+
"editor.defaultFormatter": "vscode.json-language-features",
16+
"editor.formatOnSave": true
517
}
618
}

LICENSE

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
SEE: https://ghosts-tools.mit-license.org/
1+
Copyright © 2022 - Present GHOST <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Sourcebin
2+
3+
[![](https://img.shields.io/npm/v/sourcebin?label=Latest%20Version&style=for-the-badge&logo=npm&color=informational)](https://www.npmjs.com/package/sourcebin)
4+
[![](https://img.shields.io/static/v1?label=Project%20Creator&message=GHOST&color=informational&style=for-the-badge)](https://ghostdev.xyz)
5+
[![](https://img.shields.io/github/workflow/status/ghostdevv/sourcebin/Test%20Suite%20CI?style=for-the-badge)](https://github.com/ghostdevv/sourcebin)
6+
7+
Fast and simple package to get and create bins from [sourcebin](https://sourceb.in/)
8+
9+
# Requirements
10+
11+
```
12+
NodeJS >= 14.x
13+
```
14+
15+
# Install
16+
17+
```
18+
npm install sourcebin
19+
```
20+
21+
# Docs
22+
23+
This README is the best place to learn how to use this package, you can also [take a look at our API docs](https://ghostdevv.github.io/sourcebin/index.html)
24+
25+
# Setup
26+
27+
```js
28+
// Import individual methods
29+
import { create, get, url } from 'sourcebin';
30+
31+
// Import all methods
32+
import * as sourcebin from 'sourcebin';
33+
34+
// Use required
35+
const { create, get, url } = require('sourcebin');
36+
```
37+
38+
# Get a bin
39+
40+
`get(options)`
41+
42+
```js
43+
const bin = await get({
44+
key: 'qXO2NVhRc6'
45+
});
46+
```
47+
48+
## Options
49+
50+
| Option | Description | Default | Required |
51+
|----------------|-----------------------------------|---------|----------|
52+
| `key` | The key to get | n/a ||
53+
| `fetchContent` | Should the bin content be fetched | `true` ||
54+
55+
# Create a bin
56+
57+
`create(options)`
58+
59+
```js
60+
const bin = await create(
61+
{
62+
title: 'bin name',
63+
description: 'test bin',
64+
files: [
65+
{
66+
content: 'Hello World',
67+
language: 'text',
68+
},
69+
],
70+
},
71+
);
72+
```
73+
74+
## Options
75+
76+
| Option | Description | Required |
77+
|----------------|------------------------|----------|
78+
| `title` | Title of the bin ||
79+
| `description` | Description of the bin ||
80+
| `files` | Bin files - see below ||
81+
82+
### File Options
83+
84+
| Option | Description | Default | Required |
85+
|----------------|----------------------------------|---------|----------|
86+
| `content` | Contents of the file | n/a ||
87+
| `language` | What language should the file be | `text` ||
88+
89+
# Url Helper
90+
91+
If you want to get information about a bin try the `url` function.
92+
93+
```js
94+
const urlData = url('iQznILdZRP');
95+
96+
// or
97+
98+
const urlData = url('https://sourceb.in/iQznILdZRP');
99+
```
100+
101+
This returns an object that looks like:
102+
103+
```js
104+
{
105+
key: 'iQznILdZRP',
106+
url: 'https://sourceb.in/iQznILdZRP',
107+
short: 'http://srcb.in/iQznILdZRP'
108+
}
109+
```
110+
111+
# FAQ
112+
113+
- ## Multiple files in one bin
114+
115+
This is not currently possible with this wrapper as sourcebin doesn't have a token system for authentication, only pro users are able to have multiple files in one bin. This may come in the future
116+
117+
- ## Migrate from v4 to v5
118+
119+
v5 is a overhaull of `sourcebin` so we changed some apis.
120+
121+
### Get a bin
122+
123+
Instead of passing the `key` then `options` it's now one object.
124+
125+
```diff
126+
- const bin = await get('qXO2NVhRc6');
127+
+ const bin = await get({ key: 'qXO2NVhRc6' });
128+
129+
- const bin = await get('qXO2NVhRc6', { fetchContent: false });
130+
+ const bin = await get({ key: 'qXO2NVhRc6', fetchContent: false });
131+
```
132+
133+
### Create a bin
134+
135+
We also unified the options for this function:
136+
137+
```diff
138+
- const bin = await create(
139+
- [
140+
- {
141+
- content: 'Hello World',
142+
- language: 'text',
143+
- },
144+
- ],
145+
- {
146+
- title: 'bin name',
147+
- description: 'test bin',
148+
- },
149+
- );
150+
151+
+ const bin = await create(
152+
+ {
153+
+ title: 'bin name',
154+
+ description: 'test bin',
155+
+ files: [
156+
+ {
157+
+ content: 'Hello World',
158+
+ language: 'text',
159+
+ },
160+
+ ],
161+
+ }
162+
+ );
163+
```
164+
165+
# Support
166+
167+
- Join the [discord](https://discord.gg/2Vd4wAjJnm)
168+
- Create a issue on the [github](https://github.com/ghostdevv/sourcebin)

docs/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

0 commit comments

Comments
 (0)