Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Update to Lit v2 #202

Merged
merged 7 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy

on:
push:
branches: [main]
branches: [main, lit-next]
Tansito marked this conversation as resolved.
Show resolved Hide resolved

jobs:
deploy:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

This project helps you to build Progressive Web Applications following the modern web standards, best practices and providing you with tools for that purpose. Out of the box, provides you with the following features:

- Simple way to create Web Components with [LitElement](https://lit-element.polymer-project.org).
- Simple way to create Web Components with [Lit](https://lit.dev).
- Small and powerful client-side router for Web Components with [Vaadin Router](https://vaadin.com/router).
- All the benefits from a PWA (manifest, service worker, offline UI) thanks to [Workbox](https://developers.google.com/web/tools/workbox) and [pwa-helpers](https://github.com/thepassle/pwa-helpers).
- SEO friendly thanks to the `PageElement` custom element and the `html-meta-manager`.
Expand Down Expand Up @@ -96,7 +96,8 @@ Note: If you need to add static files to the build, like the `images` folder or
1. Create the new page component (extending from `PageElement` helper) in the `pages` folder. For example a `page-explore.ts`.

```typescript
import { html, customElement } from 'lit-element';
import { html } from 'lit';
import { customElement } from 'lit/decorators.js';

import { PageElement } from '../helpers/page-element.js';

Expand Down
438 changes: 252 additions & 186 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pwa-lit-template",
"version": "0.1.0",
"private": true,
"description": "A template for building Progressive Web Applications using LitElement and Vaadin Router",
"description": "A template for building Progressive Web Applications using Lit and Vaadin Router",
"license": "MIT",
"repository": "github:IBM/pwa-lit-template",
"engines": {
Expand All @@ -27,17 +27,17 @@
},
"dependencies": {
"@vaadin/router": "^1.7.4",
"lit-element": "^2.5.1",
"lit": "^2.0.0",
"pwa-helper-components": "~0.2.10",
"tslib": "^2.3.1"
},
"devDependencies": {
"@open-wc/building-rollup": "^1.10.0",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^8.2.5",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@web/dev-server": "~0.1.22",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"@web/dev-server": "~0.1.23",
"@web/dev-server-esbuild": "~0.2.14",
"@web/dev-server-rollup": "~0.3.9",
"@web/rollup-plugin-copy": "~0.3.0",
Expand All @@ -55,7 +55,7 @@
"prettier": "~2.4.1",
"prettier-plugin-package": "^1.3.0",
"rimraf": "^3.0.2",
"rollup": "^2.56.3",
"rollup": "^2.57.0",
"stylelint": "^13.13.1",
"stylelint-config-ibmresearch": "~0.8.1",
"typescript": "~4.2.4"
Expand Down
12 changes: 12 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ const config = merge(
createSpaConfig({
outputDir: DIST_PATH,
legacyBuild: true,
polyfillsLoader: {
Tansito marked this conversation as resolved.
Show resolved Hide resolved
polyfills: {
custom: [
{
name: 'lit-polyfill-support',
path: 'node_modules/lit/polyfill-support.js',
test: "!('attachShadow' in Element.prototype)",
module: false,
},
],
},
},
developmentMode: process.env.ROLLUP_WATCH === 'true',
workbox: GENERATE_SERVICE_WORKER && workboxConfig,
injectServiceWorker: GENERATE_SERVICE_WORKER,
Expand Down
3 changes: 2 additions & 1 deletion src/components/app-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import { LitElement, html, css, customElement, query } from 'lit-element';
import { LitElement, html, css } from 'lit';
import { customElement, query } from 'lit/decorators.js';

import config from '../config.js';
import { attachRouter, urlForName } from '../router/index.js';
Expand Down
5 changes: 3 additions & 2 deletions src/helpers/page-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*/

import type { RouterLocation } from '@vaadin/router';
import { LitElement, state } from 'lit-element';
import type { PropertyValues } from 'lit-element';
import { LitElement } from 'lit';
import type { PropertyValues } from 'lit';
import { state } from 'lit/decorators.js';

import config from '../config.js';
import { updateMeta } from './html-meta-manager/index.js';
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/render-page-not-found.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import { html } from 'lit-element';
import { html } from 'lit';

// TODO: Review this issue https://github.com/vaadin/vaadin-router/issues/408

Expand Down
3 changes: 2 additions & 1 deletion src/pages/page-about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import { html, css, customElement } from 'lit-element';
import { html, css } from 'lit';
import { customElement } from 'lit/decorators.js';

import { PageElement } from '../helpers/page-element.js';

Expand Down
3 changes: 2 additions & 1 deletion src/pages/page-home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import { html, css, customElement } from 'lit-element';
import { html, css } from 'lit';
import { customElement } from 'lit/decorators.js';

import config from '../config.js';
import { PageElement } from '../helpers/page-element.js';
Expand Down
3 changes: 2 additions & 1 deletion src/pages/page-not-found.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import { html, css, customElement } from 'lit-element';
import { html, css } from 'lit';
import { customElement } from 'lit/decorators.js';

import {
PageElementNotFound,
Expand Down
4 changes: 3 additions & 1 deletion web-dev-server.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const NODE_ENV = process.env.NODE_ENV || 'development';

export default {
appIndex: 'index.html',
nodeResolve: true,
nodeResolve: {
exportConditions: ['development']
},
plugins: [
esbuildPlugin({ ts: true }),
...(NODE_ENV !== 'development'
Expand Down