Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
doggodoge committed Oct 9, 2022
0 parents commit 4af2a49
Show file tree
Hide file tree
Showing 17 changed files with 5,080 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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: |
npm install -g pnpm
release_version=$(cat package.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
pnpm install
pnpm run 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
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 16

- name: Run tests
run: |
npm install -g pnpm
pnpm install
pnpm run test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
106 changes: 106 additions & 0 deletions .gitignore
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/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.github
rollup.config.js
20 changes: 20 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"arrowParens": "avoid",
"tabWidth": 2,
"printWidth": 80,
"overrides": [
{
"files": "*.svelte",
"options": {
"svelteBracketNewLine": false,
"svelteAllowShorthand": true,
"plugins": [
"prettier-plugin-svelte"
]
}
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Gary Moore

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.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Fancy Password Input 🛂

[![Release](https://github.com/doggodoge/fancy-password-input/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/doggodoge/fancy-password-input/actions/workflows/release.yml)
[![codecov](https://codecov.io/gh/doggodoge/fancy-password-input/branch/main/graph/badge.svg?token=PQ97066X4F)](https://codecov.io/gh/doggodoge/fancy-password-input)

![fancy-password](https://user-images.githubusercontent.com/8438991/193717758-fd590d3b-bbb1-4e51-99a5-339e989fc164.gif)

This budibase widget adds a new fancy password input with a wee progress bar thing
that can be customized with a threshold, max length etc.

## Features

- Fancy password input field
- Visual complexity slider and controls
- Forms compatibility
- Customizable bad/good password text

## Description

This is an input component that will work inside a form. Basically, it's a very
styled `<input type="password">`, with a little bar that shows complexity of
your password.

This component is also compatible with forms.

## Instructions

To build your new plugin run the following in your Budibase CLI:

```shell
budi plugins --build
```

You can also re-build everytime you make a change to your plugin with the command:

```shell
budi plugins --watch
```
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Wrapper from "./lib/Wrapper.svelte"
import schema from "./schema.json"
import pkg from "./package.json"

if (window) {
const plugin = { Component: Wrapper, schema, version: pkg.version }
if (!window["##BUDIBASE_CUSTOM_COMPONENTS##"]) {
window["##BUDIBASE_CUSTOM_COMPONENTS##"] = []
}
window["##BUDIBASE_CUSTOM_COMPONENTS##"].push(plugin)
if (window.registerCustomComponent) {
window.registerCustomComponent(plugin)
}
}

export const Component = Wrapper
export const version = pkg.version
export { schema }
13 changes: 13 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
testEnvironment: 'jsdom',
moduleFileExtensions: ['js', 'svelte'],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest'],
'^.+\\.svelte$': 'svelte-jester',
},
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"]
};
4 changes: 4 additions & 0 deletions lib/Boundary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Boundary from "./Boundary.svelte"
import { createBoundary } from "@crownframework/svelte-error-boundary"

export default createBoundary(Boundary);
51 changes: 51 additions & 0 deletions lib/Boundary.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

<script>
import pkg from "../package.json"
import { getContext } from "svelte"
export let error = null
const { styleable } = getContext("sdk")
const component = getContext("component")
$: styles = {
normal: {},
id: $component.id,
interactive: true
}
</script>

{#if $error}
<div class="error" use:styleable={styles}>
<b>There was an error running the "{pkg.name}" plugin:</b>
<div class="detail">
{$error}
</div>
</div>
{:else}
<slot />
{/if}

<style>
.error {
background: var(--spectrum-global-color-red-400);
color: white;
border-radius: 4px;
padding: 16px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: 8px;
min-width: 400px;
}
.detail {
font-family: monospace;
font-size: 10px;
padding: 8px;
background: rgba(0, 0, 0, 0.1);
border-radius: 4px;
max-height: 100px;
overflow: auto;
}
</style>
10 changes: 10 additions & 0 deletions lib/Wrapper.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
import Component from "../src/Component.svelte"
import Boundary from "./Boundary.js"
</script>

<Boundary>
<Component {...$$props}>
<slot/>
</Component>
</Boundary>
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "bb-timer",
"version": "0.0.1",
"description": "A kinda cool timer thing",
"license": "MIT",
"svelte": "index.js",
"module": "dist/plugin.min.js",
"scripts": {
"build": "rollup -c",
"watch": "rollup -cw",
"test": "jest"
},
"dependencies": {
"@crownframework/svelte-error-boundary": "^1.0.3",
"svelte": "^3.49.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@swc/core": "^1.3.4",
"@swc/jest": "^0.2.23",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.1",
"jest": "^29.1.2",
"jest-environment-jsdom": "^29.1.2",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.10",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.7.1",
"rollup": "^2.44.0",
"rollup-plugin-copy2": "^0.3.1",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-svg": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",
"svelte-jester": "^2.3.2",
"tar": "^6.1.11"
}
}
Loading

0 comments on commit 4af2a49

Please sign in to comment.