Skip to content

Commit 3e03ab6

Browse files
committed
Update to Lit2
1 parent b79a967 commit 3e03ab6

File tree

5 files changed

+1224
-1773
lines changed

5 files changed

+1224
-1773
lines changed

demo/app-root.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { html, css, LitElement, customElement } from 'lit-element';
1+
import { html, css, LitElement } from 'lit';
2+
import { customElement } from 'lit/decorators.js';
23
import '../src/your-webcomponent';
34

45
@customElement('app-root')

package.json

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
{
22
"name": "@internetarchive/your-webcomponent",
3-
"version": "0.0.0",
43
"description": "The Internet Archive Typescript WebComponent template. It is based on the @open-wc template.",
5-
"author": "Internet Archive",
64
"license": "AGPL-3.0-only",
5+
"author": "Internet Archive",
6+
"version": "0.0.0",
77
"main": "dist/index.js",
88
"module": "dist/index.js",
9-
"types": "dist/index.d.ts",
10-
"publishConfig": {
11-
"access": "public"
12-
},
139
"scripts": {
1410
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
1511
"build": "tsc",
@@ -20,33 +16,37 @@
2016
"test": "tsc && yarn run lint && yarn run circular && wtr --coverage",
2117
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
2218
},
19+
"types": "dist/index.d.ts",
2320
"dependencies": {
24-
"lit-element": "^2.2.1",
25-
"lit-html": "^1.1.2"
21+
"lit": "^2.0.2"
2622
},
2723
"devDependencies": {
28-
"@open-wc/eslint-config": "^4.2.0",
29-
"@open-wc/testing": "^2.0.0",
30-
"@typescript-eslint/eslint-plugin": "^4.16.1",
31-
"@typescript-eslint/parser": "^4.16.1",
24+
"@open-wc/eslint-config": "^6.0.0",
25+
"@open-wc/testing": "next",
26+
"@typescript-eslint/eslint-plugin": "^4.29.2",
27+
"@typescript-eslint/parser": "^4.29.2",
3228
"@web/dev-server": "^0.1.1",
33-
"@web/test-runner": "^0.13.15",
29+
"@web/test-runner": "next",
3430
"concurrently": "^5.3.0",
35-
"eslint": "^7.21.0",
36-
"eslint-config-prettier": "^6.11.0",
37-
"husky": "^1.0.0",
38-
"lint-staged": "^10.0.0",
31+
"eslint": "^7.32.0",
32+
"eslint-config-prettier": "^8.3.0",
33+
"eslint-plugin-wc": "^1.3.2",
34+
"husky": "^4.3.8",
35+
"lint-staged": "^10.5.4",
3936
"madge": "^4.0.1",
40-
"prettier": "^2.0.4",
37+
"prettier": "^2.3.2",
4138
"sinon": "^9.2.4",
4239
"tslib": "^2.0.3",
4340
"typescript": "^4.2.3"
4441
},
42+
"publishConfig": {
43+
"access": "public"
44+
},
4545
"eslintConfig": {
4646
"parser": "@typescript-eslint/parser",
4747
"extends": [
48-
"@open-wc/eslint-config",
49-
"eslint-config-prettier"
48+
"@open-wc",
49+
"prettier"
5050
],
5151
"plugins": [
5252
"@typescript-eslint"
@@ -63,7 +63,8 @@
6363
"class-methods-use-this": "off",
6464
"import/no-unresolved": "off",
6565
"import/extensions": [
66-
"warn",
66+
"off",
67+
"ignorePackages",
6768
{
6869
"js": "never",
6970
"ts": "never"

src/your-webcomponent.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { html, css, LitElement, property, customElement } from 'lit-element';
1+
import { html, css, LitElement } from 'lit';
2+
import { property, customElement } from 'lit/decorators.js';
23

34
@customElement('your-webcomponent')
45
export class YourWebComponent extends LitElement {

web-test-runner.config.mjs

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
// import { playwrightLauncher } from '@web/test-runner-playwright';
22

3+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4+
35
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6+
/** Test files to run */
47
files: 'dist/test/**/*.test.js',
5-
nodeResolve: true,
8+
9+
/** Resolve bare module imports */
10+
nodeResolve: {
11+
exportConditions: ['browser', 'development'],
12+
},
13+
14+
/** Filter out lit dev mode logs */
15+
filterBrowserLogs(log) {
16+
for (const arg of log.args) {
17+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18+
return false;
19+
}
20+
}
21+
return true;
22+
},
623

724
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
825
// esbuildTarget: 'auto',
926

10-
/** Confgure bare import resolve plugin */
11-
// nodeResolve: {
12-
// exportConditions: ['browser', 'development']
13-
// },
14-
1527
/** Amount of browsers to run concurrently */
1628
// concurrentBrowsers: 2,
1729

0 commit comments

Comments
 (0)