Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Bechtel committed Apr 7, 2020
0 parents commit c0b4ff9
Show file tree
Hide file tree
Showing 14 changed files with 11,434 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,12 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
},
extends: ['eslint:recommended'],
};
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,34 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Test
run: npm test
env:
CI: true
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: GitHub Pages
uses: peaceiris/actions-gh-pages@v3.5.6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./example
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,21 @@
name: Test

on: pull_request

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Test
run: npm test
env:
CI: true
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
node_modules
dist
.vscode
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
access = 'public'
6 changes: 6 additions & 0 deletions .prettierrc.js
@@ -0,0 +1,6 @@
module.exports = {
tabWidth: 2,
semi: true,
singleQuote: true,
trailingComma: 'es5',
};
10 changes: 10 additions & 0 deletions .releaserc.json
@@ -0,0 +1,10 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
]
}
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Timo Bechtel

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.
33 changes: 33 additions & 0 deletions example/index.html
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Test Page</title>
</head>
<body>
<header>
<a href="https://github.com/CompactJS/clipboard"
>@compactjs/clipboard - Demo</a
>
</header>
<main>
<button id="copy-string">Copy String</button>
<textarea id="input-text"></textarea>
<button id="copy-input">Copy from Input</button>
</main>
<script type="module">
import { clipboard } from './dist/index.module.js';

document
.getElementById('copy-string')
.addEventListener('click', () => clipboard('test' + Math.random()));

const inputText = document.getElementById('input-text');
document
.getElementById('copy-input')
.addEventListener('click', () => clipboard(inputText));
</script>
</body>
</html>
36 changes: 36 additions & 0 deletions example/style.css
@@ -0,0 +1,36 @@
* {
font-family: sans-serif;
}
header {
text-align: center;
margin: 30px 0 50px;
}
header a {
color: black;
text-decoration: none;
font-weight: bold;
font-size: 1.7em;
}
main {
max-width: 400px;
margin: 30px auto;
}
button,
textarea {
box-sizing: border-box;
display: block;
width: 100%;
border-radius: 4px;
}
button {
border: none;
background: black;
color: white;
padding: 10px 10px;
margin: 10px 0;
cursor: pointer;
}
textarea {
height: 70px;
margin-top: 30px;
}

0 comments on commit c0b4ff9

Please sign in to comment.