Skip to content

Commit 494ccd3

Browse files
author
Graham Butler
committed
Initial setup
1 parent 1b5af48 commit 494ccd3

14 files changed

+448
-21
lines changed

.drone.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
kind: pipeline
2+
name: release
3+
4+
steps:
5+
- name: autotag
6+
image: node
7+
environment:
8+
GIT_USER:
9+
from_secret: GITHUB_USERNAME
10+
GIT_SECRET:
11+
from_secret: GITHUB_KEY
12+
commands:
13+
- npm install -g @author.io/cicd-autotag
14+
- autotag
15+
when:
16+
event:
17+
- push
18+
- name: tag_notification
19+
image: plugins/slack
20+
settings:
21+
webhook:
22+
from_secret: SLACK_WEBHOOK
23+
channel: releases
24+
icon_url: https://avatars0.githubusercontent.com/u/46585558?s=32
25+
template: >
26+
<author-{{repo.name}}> autotag on {{build.event}} to {{repo.owner}}/{{repo.name}} failed ({{build.tag}}). See {{build.link}} for details.
27+
icon_emoji: warning
28+
when:
29+
status: [ failure ]
30+
event:
31+
- push
32+
- name: build
33+
image: node
34+
commands:
35+
- npm install
36+
- npm run build
37+
when:
38+
event:
39+
- tag
40+
- name: github_release
41+
image: plugins/github-release
42+
settings:
43+
api_key:
44+
from_secret: GITHUB_TOKEN
45+
files: dist/**/*
46+
when:
47+
event:
48+
- tag
49+
- name: npm_release
50+
image: plugins/npm
51+
settings:
52+
username:
53+
from_secret: NPM_USERNAME
54+
password:
55+
from_secret: NPM_PASSWORD
56+
email:
57+
from_secret: NPM_EMAIL
58+
registry: "https://registry.npmjs.org"
59+
when:
60+
event:
61+
- tag
62+
- name: release_notification
63+
image: plugins/slack
64+
settings:
65+
webhook:
66+
from_secret: SLACK_WEBHOOK
67+
channel: releases
68+
icon_url: https://avatars0.githubusercontent.com/u/46585558?s=32
69+
template: >
70+
<author-{{repo.name}}> {{build.tag}} (build {{build.number}}) {{#success build.status}}released{{else}}failed{{/success}}.
71+
{{build.link}}
72+
73+
{{#success build.status}}
74+
Availability:
75+
- CDN: https://cdn.author.io/{{repo.owner}}/{{repo.name}}/{{build.tag}}/author-{{repo.name}}.js
76+
- npm: `npm install @author.io/element-{{repo.name}}@{{build.tag}}`
77+
- Release: https://github.com/{{repo.owner}}/{{repo.name}}/releases/tag/{{build.tag}}
78+
{{/success}}
79+
when:
80+
event:
81+
- tag

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.*
2+
_*
3+
dist
4+
!.gitignore
5+
!.npmignore
6+
!.travis.yml
7+
!.drone.yml
8+
node_modules
9+
env.json
10+
*.log

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Author.io
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# control
2-
author-control element. Wraps form inputs and associated tags
1+
# AuthorControlElement [![](https://data.jsdelivr.com/v1/package/npm/@author.io/element-control/badge)](https://www.jsdelivr.com/package/npm/@author.io/element-control?path=dist) [![Build Status](https://travis-ci.org/author-elements/control.svg?branch=master&style=for-the-badge)](https://travis-ci.org/author-elements/control)
2+
3+
<!-- TODO: Add description -->
4+
5+
![Source Size](https://img.shields.io/github/size/author-elements/control/src/element.js.svg?colorB=%23333333&label=Source&logo=JavaScript&logoColor=%23aaaaaa&style=for-the-badge) ![Deliverable Size](https://img.shields.io/bundlephobia/minzip/@author.io/element-control.svg?colorB=%23333333&label=Minified-Gzipped&logo=JavaScript&style=for-the-badge) ![npm](https://img.shields.io/npm/v/@author.io/element-control.svg?colorB=%23333&label=%40author.io%2Felement-control&logo=npm&style=for-the-badge)
6+
7+
We're using BrowserStack to make sure these components work on the browsers developers care about.
8+
9+
<a href="https://browserstack.com"><img src="https://github.com/author-elements/control/raw/master/browserstack.png" height="30px"/></a>
10+
11+
## Usage
12+
13+
There are 4 versions of this element:
14+
15+
1. *author-control.min.js* (ES6 Minified for Production)
16+
1. _author-control.js_ (ES6 Unminified for Debugging)
17+
1. *author-control.es5.min.js* (ES5 Minified for Production)
18+
1. _author-control.es5.js_ (ES5 Unminified for Debugging)
19+
20+
Each version has it's own source map, so it's always possible to trace activity back to a specific code block in the source.
21+
22+
You only need to choose one of these files. If you need to support Internet Explorer, older versions of Chrome/Firefox/Safari, then you likely need the ES5 version.
23+
24+
*Via Global CDN*
25+
26+
```html
27+
<html>
28+
<head>
29+
<script src="https://cdn.author.io/author-elements/base/1.0.0/author-base.min.js"></script>
30+
<script src="https://cdn.author.io/author-elements/control/x.x.x/author-control.min.js"></script>
31+
</head>
32+
</html>
33+
```
34+
35+
*Via npm*
36+
37+
If the [base class](https://github.com/author-elements/base) is not yet installed, install it:
38+
39+
`npm install @author.io/element-base -S`
40+
41+
Next, install the control module locally:
42+
43+
`npm install @author.io/element-control -S`
44+
45+
Then include them in your HTML:
46+
47+
```html
48+
<html>
49+
<head>
50+
<script src="./node_modules/@author.io/element-base/dist/author-base.min.js"></script>
51+
<script src="./node_modules/@author.io/element-control/dist/author-control.min.js"></script>
52+
</head>
53+
54+
<body>
55+
56+
</body>
57+
</html>
58+
```

browserstack.png

31 KB
Loading

clean.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const fs = require('fs-extra')
2+
const dist = require('path').join('./dist')
3+
4+
// if (process.argv.indexOf('--karma') >= 0) {
5+
// fs.readdirSync(process.cwd()).forEach(asset => {
6+
// if (asset.indexOf('sc-karma') === 0 && asset.indexOf('.log') > 0) {
7+
// fs.removeSync(require('path').join(process.cwd(), asset))
8+
// }
9+
// })
10+
// }
11+
12+
if (fs.existsSync(dist)) {
13+
fs.removeSync(dist)
14+
}

karma.conf.es5.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
let customize = require('@author.io/karma-customelements')('test/es5', './dist/author-control.es5.js', 'BrowserStack')
2+
3+
module.exports = config => {
4+
config.set(Object.assign(customize(config), {
5+
captureTimeout: 120000,
6+
browserNoActivityTimeout: 120000,
7+
concurrency: 3,
8+
logLevel: config.LOG_INFO
9+
}))
10+
}

karma.conf.es6-modules.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const customize = require('@author.io/karma-customelements')('test/es6-modules', './dist/author-control.js', 'BrowserStack')
2+
3+
module.exports = config => {
4+
config.set(Object.assign(customize(config, true, true), {
5+
browserify: {
6+
transform: [ 'rollupify' ]
7+
},
8+
concurrency: 1,
9+
captureTimeout: 120000,
10+
browserNoActivityTimeout: 120000
11+
}))
12+
}

karma.conf.es6.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const customize = require('@author.io/karma-customelements')('test/es6', './dist/author-control.js', 'BrowserStack')
2+
3+
module.exports = config => {
4+
config.set(Object.assign(customize(config, true, false), {
5+
browserify: {
6+
transform: [ 'rollupify' ]
7+
},
8+
concurrency: 1,
9+
captureTimeout: 120000,
10+
browserNoActivityTimeout: 120000
11+
}))
12+
}

package.json

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"name": "@author.io/element-control",
3+
"version": "1.0.0",
4+
"description": "author-control custom element (web component).",
5+
"main": "dist/author-control.min.js",
6+
"scripts": {
7+
"build": "npm run clean && rollup -c ./rollup.release.config.js",
8+
"clean": "node clean.js",
9+
"deploy": "npm run build && npm publish --access public",
10+
"test": "npm run build && karma start karma.conf.es6.js && karma start karma.conf.es6-modules.js && karma start karma.conf.es5.js && npm run test:syntax",
11+
"test:syntax": "standard --verbose | snazzy",
12+
"test:es5": "npm run build && karma start karma.conf.es5.js",
13+
"test:es5:local": "npm run build && karma start karma.conf.es5.js --local && npm run test:syntax",
14+
"test:es6": "npm run build && karma start karma.conf.es6.js",
15+
"test:es6:local": "npm run build && karma start karma.conf.es6.js --local && npm run test:syntax",
16+
"test:es6-modules": "npm run build && karma start karma.conf.es6-modules.js",
17+
"test:es6-modules:local": "npm run build && karma start karma.conf.es6-modules.js --local && npm run test:syntax",
18+
"test:es5:sauce": "TRAVIS_BUILD_NUMBER=1 && npm run build && karma start karma.conf.es5.js"
19+
},
20+
"files": [
21+
"dist/*.js",
22+
"dist/*.js.map"
23+
],
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/author-elements/control.git"
27+
},
28+
"keywords": [
29+
"author",
30+
"web",
31+
"component",
32+
"custom",
33+
"element",
34+
"form",
35+
"control",
36+
"chassis",
37+
"ngn"
38+
],
39+
"author": {
40+
"name": "Author.io",
41+
"url": "https://author.io"
42+
},
43+
"contributors": [
44+
{
45+
"name": "Graham Butler",
46+
"url": "http://grahambutler.com"
47+
},
48+
{
49+
"name": "Corey Butler",
50+
"url": "http://coreybutler.com"
51+
}
52+
],
53+
"license": "MIT",
54+
"bugs": {
55+
"url": "https://github.com/author-elements/control/issues"
56+
},
57+
"homepage": "https://github.com/author-elements/control#readme",
58+
"devDependencies": {
59+
"@author.io/karma-customelements": "^1.1.11",
60+
"@author.io/rollup-plugin-wcbuilder": "^1.1.4",
61+
"fs-extra": "^7.0.1",
62+
"karma": "^4.0.0",
63+
"rollup": "^1.1.0",
64+
"rollup-plugin-buble": "^0.19.6",
65+
"rollup-plugin-terser": "^4.0.2",
66+
"rollup-plugin-uglify": "^6.0.1",
67+
"rollupify": "^0.5.1",
68+
"snazzy": "^8.0.0",
69+
"standard": "^12.0.1",
70+
"tap": "^12.1.1",
71+
"tape": "^4.9.2"
72+
},
73+
"standard": {
74+
"ignore": [
75+
"_*",
76+
"_**/*",
77+
"test/lib/**/*",
78+
"node_modules",
79+
"dist",
80+
"rollup*.js"
81+
],
82+
"globals": [
83+
"customElements",
84+
"KeyboardEvent",
85+
"crypto",
86+
"msCrypto",
87+
"CustomEvent",
88+
"window",
89+
"MutationObserver",
90+
"DOMParser",
91+
"XMLHttpRequest",
92+
"FormData",
93+
"btoa",
94+
"localStorage",
95+
"fetch",
96+
"Element",
97+
"HTMLElement",
98+
"NodeFilter"
99+
]
100+
},
101+
"dependencies": {},
102+
"publishConfig": {
103+
"access": "public"
104+
}
105+
}

0 commit comments

Comments
 (0)