Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
paulkr committed Feb 23, 2022
0 parents commit d4371fb
Show file tree
Hide file tree
Showing 2,381 changed files with 93,192 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"env": {
"node": true,
"commonjs": true,
"es6": true,
"jquery": false
},
"extends": ["eslint:recommended", "prettier", "airbnb-base"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"rules": {
"quotes": ["warn", "double"],
"semi": ["error", "always"],
"max-len": ["off"],
"no-var": ["error"],
"no-unused-vars": ["off"],
"no-use-before-define": ["off"],
"no-useless-catch": ["off"],
"no-console": ["off"],
"no-mixed-spaces-and-tabs": ["off"],
"require-atomic-updates": ["off"],
"import/no-unresolved": ["off"],
"arrow-body-style": ["off"],
"camelcase": ["off"],
"no-underscore-dangle": ["off"],
"operator-linebreak": ["off"],
"object-curly-newline": ["off"],
"curly": ["off"],
"nonblock-statement-body-position": ["off"],
"consistent-return": ["off"]
}
}
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# dotenv environment variables file
.env

# System Files
.DS_Store
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Private
sync/

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": false,
"printWidth": 100,
"useTabs": false,
"tabWidth": 2
}
157 changes: 157 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Creating Node Templates

To create and publish your own templates, simply follow the steps below.

### 1. Clone this repository ✅

```
git clone https://github.com/buildable/templates.git
```

### 2. Create a branch for your template ✅

`git checkout -b feature/utilities/your-template-name`

### 3. Copy the boilerplate folder into the proper directory ✅

Copy the `sample` folder into the respective location within the `templates` folder.

Each template folder is grouped in a parent directory that relates to its platform. For example, the <a href="https://www.twilio.com/" target="_blank">Twilio</a> action to send an SMS message should be stored in the following path structure:

```
├── templates/
│ ├── twilio/
│ ├── Send SMS/
│ ├── config.json
| ├── input.js
| └── run.js
```

General templates that do not fall under the category of any vendor should be added under `templates/utilities/`.

### 4. Update the config.json file ✅

The `config.json` file contains all the settings for your template. Below are the descriptions for each configuration parameter.

<table>
<thead>
<tr>
<th>Setting Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>String</td>
<td>The name of the node. This should represent the output of out your run function.</td>
</tr>
<tr>
<td>title</td>
<td>String</td>
<td>The template title.</td>
</tr>
<tr>
<td>description</td>
<td>String</td>
<td>The description of the template.</td>
</tr>
<tr>
<td>type</td>
<td>String</td>
<td>This can be either "js-function" for templates that run synchronous logic and do not require access to create requests to external endpoints or "js-request-function" for templates that run asynchronous logic and do require access to create requests to external endpoints. </td>
</tr>
<tr>
<td>envVars</td>
<td>Object</td>
<td>An object of objects for each environment variable that your template requires.</td>
</tr>
<tr>
<td>price</td>
<td>String</td>
<td>The pricing type of your template. This can be "free" or "paid". Currently, only free templates are supported.</td>
</tr>
<tr>
<td>fee</td>
<td>Number</td>
<td>The cost of your template.</td>
</tr>
<tr>
<td>image</td>
<td>String</td>
<td>The image url for your template's icon.</td>
</tr>
<tr>
<td>category</td>
<td>String</td>
<td>The category your template falls under. i.e. "web3".</td>
</tr>
<tr>
<td>accessType</td>
<td>String</td>
<td>This refers to the accessibility of the template itself. It can either be "open", "read-only" or "private". Currently, only "open" templates are supported.</td>
</tr>
<tr>
<td>language</td>
<td>String</td>
<td>The language of your template. Currently, only javascript templates are supported.</td>
</tr>
<tr>
<td>platform</td>
<td>String</td>
<td>The platform your template relates to. i.e. "coinbase". If this does not apply to your template, pass in an empty string as the value.</td>
</tr>
<tr>
<td>tags</td>
<td>Array</td>
<td>An array of strings for tags that relate to your template. We recommend using tags with keywords that are not found in your template title or description to increase searchability. Tags are limited to a maximum of 3.</td>
</tr>
<tr>
<td>stateType</td>
<td>String</td>
<td>This can either be "stateless" or "stateful".</td>
</tr>
<tr>
<td>__version</td>
<td>String</td>
<td>The version of your template.</td>
</tr>
</tbody>
</table>

A sample [config.json](sample/config.json) file is visible inside the `sample/` directory.

### 5. Update the input.js file ✅

Update your `input.js` file to set the input values that will be passed into your run function. Read more about the `input` function in our [docs](https://docs.buildable.dev/core-products/flows/add-nodes-to-a-flow#what-makes-up-a-node).

A sample [input.js](sample/input.js) file is visible inside the `sample/` directory.

### 6. Update the run.js file ✅

Write your template's main logic within the `run.js` file. Read more about the `run` function in our [docs](https://docs.buildable.dev/core-products/flows/add-nodes-to-a-flow#what-makes-up-a-node).

A sample [run.js](sample/run.js) file is visible inside the `sample/` directory.

### 7. Create a pull request ✅

Once you've tested and finished your template, create a pull request on this repository. Once approved, your template will be live on Buildable, for the entire community!

---

### Testing your code 💡

To test your templates, you can write your logic within a Node in a [Buildable Flow](https://docs.buildable.dev/core-products/flows/creating-a-flow) to ensure everything works as expected.

### Code formatting

To format the code structure of the templates, simply run:

```
npm run prettier
```

### Creating your own private templates (BETA) 🤫

If you'd like to create private templates that are only accessible in your Buildable account, you can do so by publishing privately. This feature is currently still in Beta so if you'd like access, send us a request by emailing `friends@buildable.dev` for a private publishing token.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
MIT License
-----------

Copyright (c) 2022 Buildable Technologies Inc (https://www.buildable.dev/)

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:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

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.
Loading

0 comments on commit d4371fb

Please sign in to comment.