Coder Social home page Coder Social logo

ibm / pwa-lit-template Goto Github PK

View Code? Open in Web Editor NEW
177.0 19.0 24.0 7.64 MB

A template for building Progressive Web Applications using Lit and Vaadin Router.

Home Page: https://pwa-lit-template.mybluemix.net

License: MIT License

HTML 11.78% TypeScript 68.08% JavaScript 20.15%
pwa-lit-template web-components lit-element lit-html progressive-web-app pwa typescript lit

pwa-lit-template's Issues

Keep the Service Worker disabled by default

Is your feature request related to a problem? Please describe.

Keeping track of Service Worker can be tricky, so we could make it opt-in.

Describe the solution you'd like

Keep the Service Worker disabled by default.
Allowing the user to activate / uncomment it in a simple way.

The Lit decorators doesn't work after the build step

Describe the bug

Right now, when build the project (npm run build), the output doesn't work.

Screenshot 2021-06-01 at 15 25 43

Seems like the this.main is undefined:

firstUpdated() {
attachRouter(this.main);
}

From the @query decorator:

@query('main')
private main!: HTMLElement;

To reproduce

Just build and run the project.

Expected behavior

Working as always.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Lock file maintenance

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update dependency @web/dev-server-esbuild to ~0.3.6

Pending Branch Automerge

These updates await pending status checks before automerging. Click on a checkbox to abort the branch automerge, and create a PR instead.

  • Update dependency @web/dev-server to ~0.1.38

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/verify.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @vaadin/router ^1.7.5
  • lit ^2.7.1
  • pwa-helper-components ~0.2.10
  • tslib ^2.5.0
  • @open-wc/building-rollup ^2.2.2
  • @rollup/plugin-replace ^4.0.0
  • @rollup/plugin-typescript ^8.5.0
  • @typescript-eslint/eslint-plugin ^5.57.1
  • @typescript-eslint/parser ^5.57.1
  • @web/dev-server ~0.1.37
  • @web/dev-server-esbuild ~0.3.5
  • @web/dev-server-rollup ~0.3.21
  • @web/rollup-plugin-copy ~0.3.0
  • deepmerge ^4.3.1
  • eslint ^8.37.0
  • eslint-config-ibmresearch ~0.25.1
  • eslint-plugin-lit ^1.8.2
  • eslint-plugin-lit-a11y ^2.4.0
  • eslint-plugin-wc ^1.4.0
  • lit-analyzer ^1.2.1
  • nano-staged ^0.8.0
  • npm-run-all ^4.1.5
  • picocolors ^1.0.0
  • postcss-html ^1.5.0
  • postcss-lit ^1.1.0
  • prettier ~2.8.7
  • prettier-plugin-package ^1.3.0
  • rimraf ^4.4.1
  • rollup ^2.79.1
  • simple-git-hooks ^2.8.1
  • stylelint ^14.16.1
  • stylelint-config-ibmresearch ~0.16.0
  • typescript ~4.9.5
server/package.json
  • prpl-server ^1.4.2

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Use the absoluteBaseUrl property from @web/rollup-plugin-html

The new version v1.3.0 of @web/rollup-plugin-html introduce the absoluteBaseUrl.

With this, it change the og:image meta tag with the full URL.

<link rel="canonical" href="http://localhost:8000" />
<meta property="og:title" content="MyApplication" />
<meta property="og:description" content="MyApplication description" />
<meta
property="og:image"
content="http://localhost:8000/images/open-graph/cover.png"
/>
<meta property="og:image:alt" content="MyApplication logo" />
<meta property="og:image:width" content="512" />
<meta property="og:image:height" content="512" />
<meta property="og:url" content="http://localhost:8000" />

Styling the navigation links based on active route

I think it would be good to include an example of styling the active navigation links based on the current route as this probably a pretty common ask, its basically one of the first things I tried to get working and the right approach is not immediately obvious.

To be complete it would be good to have an example of styling a link that has child routes e.g.
if the link was to /items which displayed a list of items.
Then navigating to /items/item1 should still consider the link as active as it is a child route of items.

Not sure how best to do this, seems vaadin router passes route information down to the routed elements, e.g. location.params.id.

However since the navigation links are in app-index.ts where the router itself is attached it won't have access to that .

So one option would be to move the navigation links into one of the routed components (maybe an overall parent layout component that matches all routes, which handles the navigation bar itself with a slot for the content - then have child routes to '/' and '/about' for the home and about content.

Or another option would be to add an event listener in the app-index.ts that updates some state containing the current routing information (bit like this: vaadin/router#483).

window.addEventListener('vaadin-router-location-changed', this.handleRouteChange)

Maybe there is a better way, any thoughts?

Remove the pwa-helper-components warnings

Right now the lit-analyzer found two problems (warnings) about the pwa-helper-components. You can the npm run typescript:type-checking to see it.

> lit-analyzer "src/{components,pages}/**/*.ts" --strict

Analyzing 4 files...

./src/components/app-index.ts

    Unknown tag <pwa-install-button>.
    63:  <pwa-install-button>
    no-unknown-tag-name


    Unknown tag <pwa-update-available>.
    67:  <pwa-update-available>
    no-unknown-tag-name


  โœ– 2 problems in 1 file (0 errors, 2 warnings)

Related issues:

Document the SEO related stuff

  • The page-not-found.ts add the render:status_code

  • The page-element.ts update the HTML meta tags based on the route metatada property. Also the user can override the metadata() method to use dynamic data.

  • The renderPageNotFound helper. The user can use this helper in the render() method in a page. For example, in a user route when the user doesn't exists. We will know that the user does not exist after making the request to the API.

    Related Vaadin Router issue: vaadin/router#408

Whats a good way to pass data to the page-elements?

Because the vaadin-router dynamically replaces the page-elements shown inside the <main> tag, there is no chance for the app-index to pass some properties down to the page-elements.

Whats the best way to achieve this?

Expected router outlet to be a valid DOM Node

On Firefox Ubuntu

I use npm start and then the content doesn't appear, only the menu.

Uncaught (in promise) TypeError: [Vaadin.Router] Expected router outlet to be a valid DOM Node (but got undefined)
__ensureOutlet router.js:752
__addAppearingContent router.js:786
ready router.js:498
promise callback*render router.js:469
attachRouter index.ts:29
firstUpdated app-index.ts:103
_$didUpdate reactive-element.ts:1350
performUpdate reactive-element.ts:1317
scheduleUpdate reactive-element.ts:1235
__enqueueUpdate reactive-element.ts:1207
requestUpdate reactive-element.ts:1182
_initialize reactive-element.ts:924
ReactiveElement reactive-element.ts:907
LitElement lit-element.js:82
AppIndex app-index.ts:18
legacyCustomElement custom-element.ts:21
customElement custom-element.ts:64
__decorateClass app-index.ts:7
app-index.ts:18
router.js:752:12
GEThttp://192.168.1.108:8000/src/pages/page-about.ts
[HTTP/1.1 304 Not Modified 1ms]

Add one simple test

For example, something like navigate to each route and get the expected title & description

Research the router export

Right now we lazy import and initialize the router here:

private async initializeRouter() {
const router = await import('../router/index');
router.init(this.main);
}
firstUpdated() {
this.initializeRouter();
}

This router.init() function doesn't export anything:

export const init = (outlet: HTMLElement) => {
const router = new Router(outlet, { baseUrl: config.routerBaseUrl });
router.setRoutes([
// Redirect to URL without trailing slash
{
path: '(.*)/',
action: (context, commands) => {
const newPath = context.pathname.slice(0, -1);
return commands.redirect(newPath);
}
},
...routes
]);
};

Doing it this way, we found a problem:
We can't import the router instance to use the router helpers.

For example, we want to replace the hardcoded link in the not found page to use the router name. From this:

<a href="/">Back to home</a>

To something like this:

<a href="${router.urlForName('home')}">Back to home</a> 

And the same for the navigation links:

<nav>
<a href="/">Home</a>
<span>-</span>
<a href="/about">About</a>
</nav>

When running npm run build I get errors

Describe the bug

[!] Error: ENOENT: no such file or directory, lstat 'C:\Users\saadon\AppData\Local\Temp\6'

To reproduce

Type npm run build

Expected behavior

I am interested to build for different env (CI, QA, EA and PRD), and each build should use the relevant config file (config.ci.ts, config.qa.ts etc.).

Thank you

Setup Renovate to test and merge minor and patch releases without PR

We want to try setup Renovate to test and merge minor and patch releases without PR.

Current config:

{
"extends": [
"config:base",
":separateMultipleMajorReleases",
":maintainLockFilesWeekly"
],
"rangeStrategy": "bump",
"packageRules": [
{
"matchDepTypes": ["engines"],
"enabled": false
},
{
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true
}
],
"lockFileMaintenance": {
"automerge": true
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.