Skip to content

Commit 5c9e333

Browse files
committed
build: init repo
0 parents  commit 5c9e333

35 files changed

+15603
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ""

apps/lit/.eleventy.cjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
2+
3+
module.exports = function (eleventyConfig) {
4+
eleventyConfig.addPlugin(syntaxHighlight);
5+
eleventyConfig.addPassthroughCopy("docs-src/docs.css");
6+
eleventyConfig.addPassthroughCopy("docs-src/.nojekyll");
7+
return {
8+
dir: {
9+
input: 'docs-src',
10+
output: 'docs',
11+
},
12+
templateExtensionAliases: {
13+
'11ty.cjs': '11ty.js',
14+
'11tydata.cjs': '11tydata.js',
15+
},
16+
};
17+
};

apps/lit/.eslintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/eslint-recommended",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"ecmaVersion": 2020,
10+
"sourceType": "module"
11+
},
12+
"plugins": ["@typescript-eslint"],
13+
"rules": {
14+
"no-unexpected-multiline": "off",
15+
"@typescript-eslint/indent": "off",
16+
"@typescript-eslint/explicit-function-return-type": "off",
17+
"@typescript-eslint/no-non-null-assertion": "off",
18+
"@typescript-eslint/no-use-before-define": "off",
19+
"@typescript-eslint/no-unused-vars": [
20+
"warn",
21+
{
22+
"argsIgnorePattern": "^_"
23+
}
24+
]
25+
}
26+
}

apps/lit/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/node_modules/
2+
/lib/
3+
/test/
4+
5+
# top level source
6+
my-element.js
7+
my-element.js.map
8+
my-element.d.ts
9+
my-element.d.ts.map

apps/lit/.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"bracketSpacing": false,
6+
"arrowParens": "always"
7+
}

apps/lit/LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2019, The Polymer Authors. All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

apps/lit/README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# LitElement TypeScript starter
2+
3+
This project includes a sample component using LitElement with TypeScript.
4+
5+
## Setup
6+
7+
Install dependencies:
8+
9+
```bash
10+
npm i
11+
```
12+
13+
## Build
14+
15+
This sample uses the TypeScript compiler to produce JavaScript that runs in modern browsers.
16+
17+
To build the JavaScript version of your component:
18+
19+
```bash
20+
npm run build
21+
```
22+
23+
To watch files and rebuild when the files are modified, run the following command in a separate shell:
24+
25+
```bash
26+
npm run build:watch
27+
```
28+
29+
Both the TypeScript compiler and lit-analyzer are configured to be very strict. You may want to change `tsconfig.json` to make them less strict.
30+
31+
## Testing
32+
33+
This sample uses Karma, Chai, Mocha, and the open-wc test helpers for testing. See the [open-wc testing documentation](https://open-wc.org/testing/testing.html) for more information.
34+
35+
Tests can be run with the `test` script:
36+
37+
```bash
38+
npm test
39+
```
40+
41+
## Dev Server
42+
43+
This sample uses open-wc's [es-dev-server](https://github.com/open-wc/open-wc/tree/master/packages/es-dev-server) for previewing the project without additional build steps. ES dev server handles resolving Node-style "bare" import specifiers, which aren't supported in browsers. It also automatically transpiles JavaScript and adds polyfills to support older browsers.
44+
45+
To run the dev server and open the project in a new browser tab:
46+
47+
```bash
48+
npm run serve
49+
```
50+
51+
There is a development HTML file located at `/dev/index.html` that you can view at http://localhost:8000/dev/index.html.
52+
53+
## Editing
54+
55+
If you use VS Code, we highly reccomend the [lit-plugin extension](https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin), which enables some extremely useful features for lit-html templates:
56+
- Syntax highlighting
57+
- Type-checking
58+
- Code completion
59+
- Hover-over docs
60+
- Jump to definition
61+
- Linting
62+
- Quick Fixes
63+
64+
The project is setup to reccomend lit-plugin to VS Code users if they don't already have it installed.
65+
66+
## Linting
67+
68+
Linting of TypeScript files is provided by [ESLint](eslint.org) and [TypeScript ESLint](https://github.com/typescript-eslint/typescript-eslint). In addition, [lit-analyzer](https://www.npmjs.com/package/lit-analyzer) is used to type-check and lint lit-html templates with the same engine and rules as lit-plugin.
69+
70+
The rules are mostly the recommended rules from each project, but some have been turned off to make LitElement usage easier. The recommended rules are pretty strict, so you may want to relax them by editing `.eslintrc.json` and `tsconfig.json`.
71+
72+
To lint the project run:
73+
74+
```bash
75+
npm run lint
76+
```
77+
78+
## Formatting
79+
80+
[Prettier](https://prettier.io/) is used for code formatting. It has been pre-configured according to the Polymer Project's style. You can change this in `.prettierrc.json`.
81+
82+
Prettier has not been configured to run when commiting files, but this can be added with Husky and and `pretty-quick`. See the [prettier.io](https://prettier.io/) site for instructions.
83+
84+
## Static Site
85+
86+
This project includes a simple website generated with the [eleventy](11ty.dev) static site generator and the templates and pages in `/docs-src`. The site is generated to `/docs` and intended to be checked in so that GitHub pages can serve the site [from `/docs` on the master branch](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site).
87+
88+
To enable the site go to the GitHub settings and change the GitHub Pages &quot;Source&quot; setting to &quot;master branch /docs folder&quot;.</p>
89+
90+
To build the site, run:
91+
92+
```bash
93+
npm run docs
94+
```
95+
96+
To serve the site locally, run:
97+
98+
```bash
99+
npm run docs:serve
100+
```
101+
102+
To watch the site files, and re-build automatically, run:
103+
104+
```bash
105+
npm run docs:watch
106+
```
107+
108+
The site will usually be served at http://localhost:8000.
109+
110+
## Bundling and minification
111+
112+
This starter project doesn't include any build-time optimizations like bundling or minification. We recommend publishing components as unoptimized JavaScript modules, and performing build-time optimizations at the application level. This gives build tools the best chance to deduplicate code, remove dead code, and so on.
113+
114+
For information on building application projects that include LitElement components, see [Build for production](https://lit.dev/docs/tools/production/) on the Lit site.
115+
116+
## More information
117+
118+
See [Get started](https://lit.dev/docs/getting-started/) on the Lit site for more information.

apps/lit/dev/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
This directory contains HTML files containing your element for development. By running `npm run build:watch` and `npm run serve` you can edit and see changes without bundling.

0 commit comments

Comments
 (0)