Skip to content

Commit cc43a29

Browse files
authored
refactor!: convert to Polymer 3 (#163)
1 parent 201faed commit cc43a29

File tree

97 files changed

+1603
-1928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1603
-1928
lines changed

.eslintrc.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"extends": "vaadin",
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:prettier/recommended"
5+
],
6+
"plugins": ["prettier"],
37
"env": {
48
"browser": true,
5-
"node": true,
69
"es6": true
710
},
8-
"plugins": [
9-
"html"
10-
],
11-
"globals": {
12-
"Polymer": false,
13-
"Vaadin": false
11+
"parserOptions": {
12+
"sourceType": "module",
13+
"ecmaVersion": 2020
1414
}
1515
}

.gemini.yml

-22
This file was deleted.

.github/workflows/sauce.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: sauce
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '*.*'
9+
10+
jobs:
11+
unit-tests:
12+
runs-on: ubuntu-latest
13+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: 12
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: SauceLabs tests
25+
env:
26+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
27+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
28+
run: npm run test:sauce
29+
30+
visual-tests:
31+
runs-on: ubuntu-latest
32+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-node@v1
37+
with:
38+
node-version: 12
39+
40+
- name: Install dependencies
41+
run: npm install
42+
43+
- name: Visual tests
44+
env:
45+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
46+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
47+
run: npm run test:visual

.github/workflows/tests.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v1
12+
with:
13+
node-version: 12
14+
15+
- name: Install dependencies
16+
run: npm install
17+
18+
- name: Check version
19+
run: npm run check-version
20+
21+
- name: Lint JavaScript
22+
run: npm run lint:js
23+
24+
- name: Lint CSS
25+
run: npm run lint:css
26+
27+
unit-tests:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: actions/setup-node@v1
33+
with:
34+
node-version: 12
35+
36+
- name: Install dependencies
37+
run: npm install
38+
39+
- name: Unit tests
40+
run: npm test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ node_modules
33
package-lock.json
44
yarn.lock
55
coverage
6+
dist
67
analysis.json

.hermione.conf.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
browsers: {
3+
chrome: {
4+
baseUrl: 'http://localhost:8080/test/visual/',
5+
screenshotsDir: () => 'test/visual/screens/vaadin-button',
6+
desiredCapabilities: {
7+
browserName: 'chrome',
8+
version: '85.0',
9+
platform: 'Windows 10'
10+
}
11+
}
12+
},
13+
plugins: {
14+
'hermione-esm': {
15+
port: 8080
16+
},
17+
'hermione-sauce': {
18+
verbose: false
19+
}
20+
}
21+
};

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 120,
4+
"trailingComma": "none",
5+
"htmlWhitespaceSensitivity": "strict"
6+
}

.stylelintrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "stylelint-config-vaadin"
2+
"extends": [
3+
"stylelint-config-vaadin",
4+
"stylelint-config-prettier"
5+
]
36
}

.travis.yml

-64
This file was deleted.

README.md

+24-56
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
[![npm version](https://badgen.net/npm/v/@vaadin/vaadin-button)](https://www.npmjs.com/package/@vaadin/vaadin-button)
2-
[![Bower version](https://badgen.net/github/release/vaadin/vaadin-button)](https://github.com/vaadin/vaadin-button/releases)
3-
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/vaadin/vaadin-button)
4-
[![Build Status](https://travis-ci.org/vaadin/vaadin-button.svg?branch=master)](https://travis-ci.org/vaadin/vaadin-button)
5-
[![Coverage Status](https://coveralls.io/repos/github/vaadin/vaadin-button/badge.svg?branch=master)](https://coveralls.io/github/vaadin/vaadin-button?branch=master)
6-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vaadin/web-components?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
7-
8-
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/vaadinvaadin-button)
9-
[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/vaadinvaadin-button.svg)](https://vaadin.com/directory/component/vaadinvaadin-button)
10-
111
# <vaadin-button>
122

133
[Live Demo ↗](https://vaadin.com/components/vaadin-button/html-examples)
@@ -16,17 +6,13 @@
166

177
[<vaadin-button>](https://vaadin.com/components/vaadin-button) is a Web Component providing an accessible and customizable button, part of the [Vaadin components](https://vaadin.com/components).
188

19-
<!--
20-
```
21-
<custom-element-demo>
22-
<template>
23-
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
24-
<link rel="import" href="vaadin-button.html">
25-
<next-code-block></next-code-block>
26-
</template>
27-
</custom-element-demo>
28-
```
29-
-->
9+
[![npm version](https://badgen.net/npm/v/@vaadin/vaadin-button)](https://www.npmjs.com/package/@vaadin/vaadin-button)
10+
[![Build Status](https://travis-ci.org/vaadin/vaadin-button.svg?branch=master)](https://travis-ci.org/vaadin/vaadin-button)
11+
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/vaadin/vaadin-button)
12+
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/vaadinvaadin-button)
13+
[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/vaadinvaadin-button.svg)](https://vaadin.com/directory/component/vaadinvaadin-button)
14+
[![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
15+
3016
```html
3117
<vaadin-button theme="primary">Primary</vaadin-button>
3218
<vaadin-button theme="secondary">Secondary</vaadin-button>
@@ -37,28 +23,6 @@
3723

3824
## Installation
3925

40-
The Vaadin components are distributed as Bower and npm packages.
41-
Please note that the version range is the same, as the API has not changed.
42-
You should not mix Bower and npm versions in the same application, though.
43-
44-
Unlike the official Polymer Elements, the converted Polymer 3 compatible Vaadin components
45-
are only published on npm, not pushed to GitHub repositories.
46-
47-
### Polymer 2 and HTML Imports compatible version
48-
49-
Install `vaadin-button`:
50-
51-
```sh
52-
bower i vaadin/vaadin-button --save
53-
```
54-
55-
Once installed, import it in your application:
56-
57-
```html
58-
<link rel="import" href="bower_components/vaadin-button/vaadin-button.html">
59-
```
60-
### Polymer 3 and ES Modules compatible version
61-
6226
Install `vaadin-button`:
6327

6428
```sh
@@ -81,41 +45,45 @@ To use the Material theme, import the correspondent file from the `theme/materia
8145

8246
- The component with the Lumo theme:
8347

84-
`theme/lumo/vaadin-button.html`
48+
`theme/lumo/vaadin-button.js`
8549

8650
- The component with the Material theme:
8751

88-
`theme/material/vaadin-button.html`
89-
90-
- Alias for `theme/lumo/vaadin-button.html`:
52+
`theme/material/vaadin-button.js`
9153

92-
`vaadin-button.html`
54+
- Alias for `theme/lumo/vaadin-button.js`:
9355

56+
`vaadin-button.js`
9457

95-
## Running demos and tests in a browser
58+
## Running API docs and tests in a browser
9659

9760
1. Fork the `vaadin-button` repository and clone it locally.
9861

99-
1. Make sure you have [npm](https://www.npmjs.com/) and [Bower](https://bower.io) installed.
62+
1. Make sure you have [node.js](https://nodejs.org/) 12.x installed.
10063

101-
1. When in the `vaadin-button` directory, run `npm install` and then `bower install` to install dependencies.
64+
1. Make sure you have [npm](https://www.npmjs.com/) installed.
65+
66+
1. When in the `vaadin-button` directory, run `npm install` to install dependencies.
10267

10368
1. Run `npm start`, browser will automatically open the component API documentation.
10469

105-
1. You can also open demo or in-browser tests by adding **demo** or **test** to the URL, for example:
70+
1. You can also open visual tests, for example:
10671

107-
- http://127.0.0.1:3000/components/vaadin-button/demo
108-
- http://127.0.0.1:3000/components/vaadin-button/test
72+
- http://127.0.0.1:3000/test/visual/default.html
10973

11074

11175
## Running tests from the command line
11276

113-
1. When in the `vaadin-button` directory, run `polymer test`
77+
1. When in the `vaadin-button` directory, run `npm test`
78+
79+
## Debugging tests in the browser
80+
81+
1. Run `npm run debug`, then choose manual mode (M) and open the link in browser.
11482

11583

11684
## Following the coding style
11785

118-
We are using [ESLint](http://eslint.org/) for linting JavaScript code. You can check if your code is following our standards by running `npm run lint`, which will automatically lint all `.js` files as well as JavaScript snippets inside `.html` files.
86+
We are using [ESLint](http://eslint.org/) for linting JavaScript code. You can check if your code is following our standards by running `npm run lint`, which will automatically lint all `.js` files.
11987

12088

12189
## Big Thanks

0 commit comments

Comments
 (0)