Skip to content

Commit 876a505

Browse files
author
Graham Butler
committed
update config
1 parent 9634068 commit 876a505

16 files changed

+284
-10870
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 --allowInitialNpmPublish
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: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,58 @@
1-
# boilerplate
2-
Boilerplate for custom element repos.
1+
# __ELEMENT_CLASS-NAME__ [![](https://data.jsdelivr.com/v1/package/npm/@author.io/element-__ELEMENT_NAME__/badge)](https://www.jsdelivr.com/package/npm/@author.io/element-__ELEMENT_NAME__?path=dist) [![Build Status](https://travis-ci.org/author-elements/__ELEMENT_NAME__.svg?branch=master&style=for-the-badge)](https://travis-ci.org/author-elements/__ELEMENT_NAME__)
32

4-
To set up a new custom element:
3+
<!-- TODO: Add description -->
54

6-
1. Open `karma.base.js` and change line 8, `sauceConfiguration.testName` to reflect the correct element
7-
2. In each of the `karma.conf.**.**` files, change the path on line 6 to the point to the correct element
8-
3. In the `test` folder, replace all references to `AuthorElement` in all instances of `sanity.js` with the correct class
9-
4. In the same folder, update the script tags in each instance of `test.html` to point to the correct file
10-
5. In `rollup.release.config.js` change the variable declarations at the top to point to the correct file
5+
![Source Size](https://img.shields.io/github/size/author-elements/__ELEMENT_NAME__/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-__ELEMENT_NAME__.svg?colorB=%23333333&label=Minified-Gzipped&logo=JavaScript&style=for-the-badge) ![npm](https://img.shields.io/npm/v/@author.io/element-__ELEMENT_NAME__.svg?colorB=%23333&label=%40author.io%2Felement-__ELEMENT_NAME__&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/__ELEMENT_NAME__/raw/master/browserstack.png" height="30px"/></a>
10+
11+
## Usage
12+
13+
There are 4 versions of this element:
14+
15+
1. *author-__ELEMENT_NAME__.min.js* (ES6 Minified for Production)
16+
1. _author-__ELEMENT_NAME__.js_ (ES6 Unminified for Debugging)
17+
1. *author-__ELEMENT_NAME__.es5.min.js* (ES5 Minified for Production)
18+
1. _author-__ELEMENT_NAME__.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/__ELEMENT_NAME__/x.x.x/author-__ELEMENT_NAME__.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 __ELEMENT_NAME__ module locally:
42+
43+
`npm install @author.io/element-__ELEMENT_NAME__ -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-__ELEMENT_NAME__/dist/author-__ELEMENT_NAME__.min.js"></script>
52+
</head>
53+
54+
<body>
55+
56+
</body>
57+
</html>
58+
```

browserstack.png

31 KB
Loading

clean.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
const fs = require('fs-extra')
22
const dist = require('path').join('./dist')
33

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+
412
if (fs.existsSync(dist)) {
513
fs.removeSync(dist)
614
}

karma.base.js

Lines changed: 0 additions & 79 deletions
This file was deleted.

karma.conf.es5.js

Lines changed: 9 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,10 @@
1-
const base = require('./karma.base')
2-
3-
var getFiles = function () {
4-
var files = [
5-
{
6-
pattern: require('path').join(process.cwd(), './dist/author-element.es5.js'),
7-
nocache: true
8-
}
9-
]
10-
11-
// Run all tests by default
12-
let testfiles = 'test/es5/*.js'
13-
14-
return files.concat([
15-
testfiles,
16-
'test/es5/test.html'
17-
])
18-
}
19-
20-
console.log(base.tablemaker([[base.chalk.bold('Included Files')]].concat(getFiles().map(file => { return [file] }))))
21-
22-
module.exports = function (config) {
23-
config.set({
24-
25-
plugins: [
26-
require('karma-browserify'),
27-
require('tape'),
28-
require('karma-tap'),
29-
require('karma-spec-reporter'),
30-
require('karma-chrome-launcher'),
31-
// require('karma-firefox-launcher'),
32-
// require('karma-safari-launcher'),
33-
// require('karma-ie-launcher'),
34-
// require('karma-edge-launcher'),
35-
// require('karma-phantomjs-launcher'),
36-
// require('karma-sauce-launcher'),
37-
require('karma-html2js-preprocessor')
38-
],
39-
40-
// base path that will be used to resolve all patterns (eg. files, exclude)
41-
basePath: '',
42-
43-
// frameworks to use
44-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
45-
frameworks: ['tap', 'browserify'],
46-
47-
// list of files / patterns to load in the browser
48-
files: getFiles(),
49-
50-
// list of files to exclude
51-
exclude: [],
52-
53-
// preprocess matching files before serving them to the browser
54-
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
55-
preprocessors: {
56-
'test/es5/**/*.js': ['browserify'],
57-
'test/es5/test.html': 'html2js'
58-
// , 'test/lib/**/*.js': 'coverage'
59-
},
60-
61-
// coverageReporter: {
62-
// type : 'html',
63-
// dir : 'coverage/'
64-
// },
65-
66-
// test results reporter to use
67-
// possible values: 'dots', 'progress'
68-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
69-
reporters: base.reporterEngines, // ['progress'],
70-
71-
// web server port
72-
port: 9876,
73-
74-
// enable / disable colors in the output (reporters and logs)
75-
colors: true,
76-
77-
// level of logging
78-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
79-
logLevel: config.LOG_DEBUG,
80-
81-
// enable / disable watching file and executing tests whenever any file changes
82-
autoWatch: false,
83-
84-
// start these browsers
85-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
86-
browsers: ['Chrome'],
87-
88-
// Continuous Integration mode
89-
// if true, Karma captures browsers, runs the tests and exits
90-
singleRun: true,
91-
92-
// Concurrency level
93-
// how many browser should be started simultanous
94-
concurrency: 3
95-
})
1+
let customize = require('@author.io/karma-customelements')('test/es5', './dist/author-__ELEMENT_NAME__.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+
}))
9610
}

0 commit comments

Comments
 (0)