Skip to content

Commit a4b02d2

Browse files
authored
Initial commit
0 parents  commit a4b02d2

26 files changed

+10969
-0
lines changed

.devcontainer/Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/javascript-node/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
4+
ARG VARIANT="16"
5+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
6+
7+
# [Optional] Uncomment this section to install additional OS packages.
8+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9+
# && apt-get -y install --no-install-recommends <your-package-list-here>
10+
11+
# [Optional] Uncomment if you want to install an additional version of node using nvm
12+
# ARG EXTRA_NODE_VERSION=10
13+
# RUN su node -c "source/usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
14+
15+
# [Optional] Uncomment if you want to install more global node modules
16+
# RUN su node -c "npm install -g <your-package-list-here>"

.devcontainer/devcontainer.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/javascript-node
3+
{
4+
"name": "Node.js",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
8+
// Append -bullseye or -buster to pin to an OS version.
9+
// Use -bullseye variants on local arm64/Apple Silicon.
10+
"args": { "VARIANT": "16" }
11+
},
12+
13+
// Set *default* container specific settings.json values on container create.
14+
"settings": {},
15+
16+
// Add the IDs of extensions you want installed when the container is created.
17+
"extensions": [
18+
"dbaeumer.vscode-eslint"
19+
],
20+
21+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
22+
// "forwardPorts": [],
23+
24+
// Use 'postCreateCommand' to run commands after the container is created.
25+
// "postCreateCommand": "yarn install",
26+
27+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
28+
"remoteUser": "node",
29+
"features": {
30+
"git": "latest"
31+
}
32+
}

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.eslintrc.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"root": true,
3+
"plugins": ["custom-elements"],
4+
"extends": [
5+
"plugin:github/recommended",
6+
"plugin:github/browser",
7+
"plugin:github/typescript",
8+
"plugin:custom-elements/recommended"
9+
],
10+
"rules": {
11+
"custom-elements/file-name-matches-element": ["error", {"suffix": "Element"}],
12+
"custom-elements/tag-name-matches-class": ["error", {"suffix": "Element"}]
13+
},
14+
"globals": {
15+
"CustomElementElement": "readonly"
16+
}
17+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/publish.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish-npm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 18
15+
registry-url: https://registry.npmjs.org/
16+
cache: npm
17+
- run: npm ci
18+
- run: npm test
19+
- run: npm version ${TAG_NAME} --git-tag-version=false
20+
env:
21+
TAG_NAME: ${{ github.event.release.tag_name }}
22+
- run: npm whoami; npm --ignore-scripts publish
23+
env:
24+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Node CI
2+
3+
on: [push]
4+
jobs:
5+
build:
6+
runs-on: macos-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: Use Node.js
10+
uses: actions/setup-node@v1
11+
with:
12+
node-version: 18.x
13+
- name: npm install, build, and test
14+
run: |
15+
npm install
16+
npm run build --if-present
17+
npm test
18+
env:
19+
CI: true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
node_modules

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @github/primer-reviewers

CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Contributing
2+
3+
[code-of-conduct]: CODE_OF_CONDUCT.md
4+
5+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
6+
7+
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
8+
9+
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
10+
11+
## Submitting a pull request
12+
13+
0. Fork and clone the repository
14+
0. Configure and install the dependencies: `script/bootstrap`
15+
0. Make sure the tests pass on your machine: `rake`
16+
0. Create a new branch: `git checkout -b my-branch-name`
17+
0. Make your change, add tests, and make sure the tests still pass
18+
0. Push to your fork and submit a pull request
19+
0. Pat your self on the back and wait for your pull request to be reviewed and merged.
20+
21+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
22+
23+
- Write tests.
24+
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
25+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
26+
27+
## Resources
28+
29+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
30+
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
31+
- [GitHub Help](https://help.github.com)

LICENSE

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

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# &lt;custom-element&gt; element
2+
3+
Boilerplate for creating a custom element.
4+
5+
## Installation
6+
Available on [npm](https://www.npmjs.com/) as [**@github/custom-element-element**](https://www.npmjs.com/package/@github/custom-element-element).
7+
```
8+
$ npm install --save @github/custom-element-element
9+
```
10+
11+
## Usage
12+
13+
### Script
14+
15+
Import as ES modules:
16+
17+
```js
18+
import '@github/custom-element-element'
19+
```
20+
21+
Include with a script tag:
22+
23+
```html
24+
<script type="module" src="./node_modules/@github/custom-element-element/dist/index.js">
25+
```
26+
27+
An example Custom Element. This documentation ends up in the
28+
README so describe how this elements works here.
29+
30+
You can event add examples on the element is used with Markdown.
31+
32+
```
33+
<custom-element></custom-element>
34+
```
35+
36+
## Browser support
37+
38+
Browsers without native [custom element support][support] require a [polyfill][].
39+
- Chrome
40+
- Firefox
41+
- Safari
42+
- Microsoft Edge
43+
44+
[support]: https://caniuse.com/custom-elementsv1
45+
[polyfill]: https://github.com/webcomponents/custom-elements
46+
47+
## License
48+
49+
Distributed under the MIT license. See LICENSE for details.

SECURITY.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
If you discover a security issue in this repository, please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github).

custom-elements-manifest.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {generateCustomData} from 'cem-plugin-vs-code-custom-data-generator'
2+
import {readme} from '@github/cem-plugin-readme'
3+
4+
export default {
5+
packagejson: true,
6+
globs: ['src/*-element.ts'],
7+
plugins: [readme(), generateCustomData()],
8+
}

custom-elements.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"schemaVersion": "1.0.0",
3+
"readme": "",
4+
"modules": [
5+
{
6+
"kind": "javascript-module",
7+
"path": "src/custom-element.ts",
8+
"declarations": [
9+
{
10+
"kind": "class",
11+
"description": "An example Custom Element. This documentation ends up in the\nREADME so describe how this elements works here.\n\nYou can event add examples on the element is used with Markdown.\n\n```\n<custom-element></custom-element>\n```",
12+
"name": "CustomElementElement",
13+
"superclass": {
14+
"name": "HTMLElement"
15+
},
16+
"tagName": "custom-element",
17+
"customElement": true
18+
}
19+
],
20+
"exports": [
21+
{
22+
"kind": "js",
23+
"name": "default",
24+
"declaration": {
25+
"name": "CustomElementElement",
26+
"module": "src/custom-element.ts"
27+
}
28+
},
29+
{
30+
"kind": "custom-element-definition",
31+
"name": "custom-element",
32+
"declaration": {
33+
"name": "CustomElementElement",
34+
"module": "src/custom-element.ts"
35+
}
36+
}
37+
]
38+
}
39+
]
40+
}

examples/index.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>custom-element demo</title>
6+
</head>
7+
<body>
8+
<custom-element></custom-element>
9+
10+
<script type="module">
11+
// import 'https://unpkg.com/@github/custom-element-boilerplate@latest/dist/custom-element.js'
12+
import '../src/custom-element.ts'
13+
</script>
14+
</body>
15+
</html>

0 commit comments

Comments
 (0)