Skip to content

Commit

Permalink
ahoy🏴‍☠️
Browse files Browse the repository at this point in the history
  • Loading branch information
frani committed Jun 13, 2023
0 parents commit 159b936
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy Extension

on:
release:
type: published

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- uses: lannonbr/vsce-action@master
with:
args: "publish -p $VSCE_TOKEN"
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
out
node_modules
.vscode-test/
.vsix
npm-debug.log
vsc-extension-quickstart.md
*.vsix
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// A launch configuration that launches the extension inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"]
}
]
}
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v1.0.0

- Initial release (Jun 13th, 2023)
8 changes: 8 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2020 Frani

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.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<h1 align="center">
<br>
<a href="#"><img src="https://github.com/frani/fracta-function-snippet/raw/master/images/logo.png" alt="fracta-function-snippet-logo" width="200"></a>
<br>
Fractal Function <i>Snippet</i>
<br>
<br>
</h1>

<h4 align="center">A solution to deal with errors</h4>

<p align="center">
<a href="https://marketplace.visualstudio.com/items?itemName=frani.fracta-function-snippet"><img src="https://img.shields.io/visual-studio-marketplace/v/frani.fracta-function-snippet?style=flat&logo=visual-studio-code&logoColor=blue" alt="VSCode-ext"></a>
<a href="https://marketplace.visualstudio.com/items?itemName=frani.fracta-function-snippet"><img alt="Visual Studio Marketplace Installs" src="https://img.shields.io/visual-studio-marketplace/i/frani.fracta-function-snippet?color=yellow"></a>
<a href="https://github.com/frani/fracta-function-snippet/blob/master/LICENSE.md"><img alt="github license" src="https://img.shields.io/github/license/frani/fracta-function-snippet?color=success"></a>
<a href="https://github.com/frani/fracta-function-snippet/issues"><img alt="github issues" src="https://img.shields.io/github/issues/frani/fracta-function-snippet"></a>
<a href="https://marketplace.visualstudio.com/items?itemName=frani.fracta-function-snippet"><img alt="Visual Studio Marketplace Rating" src="https://img.shields.io/visual-studio-marketplace/stars/frani.fracta-function-snippet?label=rating&logo=visual-studio-code&logoColor=blue"></a>
</p>

# About

Fractal Function Pattern was made as a solution to give a way of handler errors in a isolated way, so if something explot in a function, instead of keep throwing the error through all the system is going to receive an idempotent response so when function's caller receive the response, can determinated of what is going to receive in case something went wrong then take decition of what to do.

[I wrote about this in spanish in my blog](https://frani.dev/Fractal-Funcional-Design-Pattern-57ecf46f1e644d718e763ff8905b8d4a)
_I still working on it to give a better explanation haha_

---

# Install

### Install with VScode:

To install the extension, open the Extensions view on sidenav, search for `Fractal Function` to filter results and select `Fractal Function Snippets` authored by [Frani](https://github.com/frani).

### Install with Terminal:

```sh
code --install-extension frani.fracta-function-snippet
```

in case you have `code` command disable [see this link to enable it](https://code.visualstudio.com/docs/editor/command-line#_common-questions)

# License

MIT © [Frani](http://github.com/frani)
Binary file added images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "fractal-function-snippet",
"displayName": "Fractal Function Snippet",
"description": "Fractal Function Snippet, a fractal pattern to implement in functional paradigma",
"version": "1.0.0",
"publisher": "frani",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/frani/fractal-function-snippet.git"
},
"bugs": {
"url": "https://github.com/frani/fractal-function-snippet.git/issues"
},
"engines": {
"vscode": "^1.18.0"
},
"categories": [
"Snippets"
],
"icon": "images/logo.png",
"keywords": [
"nodejs",
"javascript",
"fractals",
"fractal",
"fractal pattern",
"fractal function"
],
"contributes": {
"snippets": [
{
"language": "javascript",
"path": "./snippets/fractal.json"
}
]
}
}
24 changes: 24 additions & 0 deletions snippets/fractal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"fratal function snippet": {
"prefix": "ffs",
"body": [
"const ${1:name} = async ({ ${2:input} }) => {",
" const payload = { success: false, data: null, message: '', errors: [] };",
" try {",
" $0",
"",
" payload.success = true;",
" payload.data = data;",
" return payload;",
" } catch (error) {",
" console.error(error);",
" payload.success = false;",
" payload.data = null;",
" payload.errors = payload.errors.concat(error.message);",
" return payload;",
" }",
"};"
],
"description": "Create a Function with Fractal Pattern"
}
}

0 comments on commit 159b936

Please sign in to comment.