Giter Site home page Giter Site logo

davidlj95 / ngx Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 0.0 4.46 MB

🏡 for ngx-meta library. And whatever ones are to come :)

Home Page: https://ngx-meta.dev

License: MIT License

TypeScript 91.11% Shell 4.70% Makefile 0.43% JavaScript 1.84% HTML 1.63% CSS 0.29%
angular library angular2 html-meta-tags json-ld meta metadata open-graph twitter-cards

ngx's Introduction

@davidlj95/ngx

An Angular CLI workspace created by Angular CLI version 17.0.2 to host some Angular utils

🏡 Living here

That's it 😜 But whatever ones are to come 🔮 will live here ☺️

ngx's People

Contributors

davidlj95 avatar renovate[bot] avatar dependabot[bot] avatar

Stargazers

Touhid Rahman avatar Sylvain Autran avatar Enea Jahollari avatar Clara Castillo avatar  avatar Jose Torres avatar  avatar  avatar Xavi Caro avatar Carlos Cebrecos avatar

Watchers

 avatar  avatar

ngx's Issues

Allow scoped metadata to be undefined

Current route metadta types for scoped metadata (standard, open graph, open graph profile, ...) set the proper type but don't allow undefined to be there. So in case you define a generic type that may allow some kind of scoped metadata, but may not be there in some cases, you have to do some workarounds

For instance:
https://github.com/davidlj95/chrislb/blob/4982d6aac13954f570a421cecb76ab4d04cc75f2/src/app/common/routing/make-route-metadata.ts#L38-L38

To take into account in #90

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Cannot push to the Git repository.

semantic-release cannot push the version tag to the branch main on the remote Git repository with URL https://x-access-token:[secure]@github.com/davidlj95/ngx.

This can be caused by:


Good luck with your project ✨

Your semantic-release bot 📦🚀

Export non-routing types too

Currently, we export XMetadataRouteData so that you can write type-safe metadata objects. However, those types are for routes only. So when using metadata types that are not for routes, you don't have types for that.

For instance, when setting defaults:

https://github.com/davidlj95/chrislb/blob/8d9e6049154042c801a8efef30cc3be799979b12/src/app/app.module.ts#L45-L58

Or when calling the metadata service:

https://github.com/davidlj95/chrislb/blob/8d9e6049154042c801a8efef30cc3be799979b12/src/app/about-page/about-page.component.ts#L54-L56

Improve namings

  • MetadataSetter: applies a given metadata value to the current page
  • MetadataProvider: manages a given metadata. Identified by a (string) id that prevents same provider to be registered twice. Provides how to resolve the value to set so the setter can set it.
  • Metadata: contains information to resolve the metadata value to set for a page and the id of that metadata.
  • MetadataValues: values to use as metadata for the page. As a JSON object.

Issues:
Naming:

  • Provider may be confused with an Angular’s “Provider”
  • Metadata name is too generic: can be confused with metadata values. Also, provides several responsibilities: a) identify the “provider” b) value resolution data: jsonPath & global
  • Values don’t specify it’s a JSON. But it will probably be.

Functionality:

  • The value to be resolved may not come from a JSON. For instance, in issue #75 we may want to retrieve the value from the router. So it’s not sure that we’ll need “jsonPath” and “global” for every metadata provider around. The automatic canonical URL could come from querying the router + a config. And ultimately fetch the value. Well then the value is interesting anyway 🤔
  • Global + jsonPath could just be “jsonPaths” to look for values. Where “global” is one of those jsonPath

Some options:

  • MetadataManager instead of “Provider” suffix. No confusion with Angular’s “Provider”. And it’s clear that that piece of code manages some metadata of the page.
  • Add something apart for resolving values per each metadata. This way #75 could be use the router URL + config for resolving value or go fetch the JSON value instead. Or two separate managers, one implementing each and one that combines both. That behaviour is configured when injecting the module. Though that value is used for standard.canonicalUrl + openGraph.url + twitterCard.url 🤔 Maybe it could be a special core thing? Or a separate module?

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Missing package.json file.

A package.json file at the root of your project is required to release on npm.

Please follow the npm guideline to create a valid package.json file.


Good luck with your project ✨

Your semantic-release bot 📦🚀

perf: avoid usage of named arguments

Mainly, Metadata's constructor accepting a {name: string, scope: string, globalName: string}.

Argument names end up in app bundles. So a lot of repeated name, scope and globalName around.

Some bytes could be saved in there

Add docs

Explain how lib works so fellow devs can use it as fast as possible

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Missing package.json file.

A package.json file at the root of your project is required to release on npm.

Please follow the npm guideline to create a valid package.json file.


Good luck with your project ✨

Your semantic-release bot 📦🚀

refactor: scope property could be moved to ScopedMetadataDefinition

Given the path to values will be scope.name maybe we can leave that to be a part of a new definition: ScopedMetadataDefinition

Given the MetadataDefinition main interface requires to provide an id and then ScopedMetadataDefinition builds this by doing scope.name.

This would help with JSON LD, that isn't scoped. So the id is just jsonLd. And no global name, given jsonLd is already kind of a global as not scoped.

Relates to #97

Multiple imports are suggested, just one is the recommended

Project

ngx-meta

What happened?

After using latest version of library in a real life app, found out the IDE lets you import same thing from several places.

For instance, if importing something from core entry point, it suggests you can import it from:

  1. @davidlj95/ngx-meta/core: the right one. Things are actually there for both flattened & unflattened exports.
  2. @davidlj95/ngx-meta/core/public-api: shouldn't be used, as that public-api file could change
  3. @davidlj95/ngx-meta/core/src/some-file: shouldn't be used, as that some-file filename / path could change.

In order to avoid using non-recommended imports 2/3, we should rollup our Typescript definitions, as Angular Package Format recommends.

API Extractor is recommended for that purpose. Which we already use for the API Report and docs.

However, it is not possible right now to use Typescript definitions rollup when there are secondary entry points

So seems we'll need to go another way

Version

1.0.0-alpha.45

Minimal reproduction

import { GlobalMetadata } from '@davidlj95/ngx-meta/core'

Code of Conduct

  • I agree to follow this project's Code of Conduct

Run `tsc` on CI

Can detect errors that don't appear in compilation. Like files not used directly in compilation

Reduce bundle size

Bundle size is quite too big due to lots of features being provided in there. Firstly, modules take way too much space (Open Graph, Twitter card) when they're essentially just setting some <meta> elements. That's preventing myself from using the library. Given I'd honestly prefer to just apply those using Angular's Meta service from a performance point of view.

For instance, each metadata setter given it's injectable, has some overhead. So what it could be just a call to the MetaService to update a meta tag is envolved with much code around. Which increases the bundle size.

For instance, let's look at the DescriptionStandardMetadata when gets compiled for production (beautified for visualisation purposes)

Uc = 'description',
Fw = (() => {
  let e = class e extends Ge {
    constructor(n) {
      super(Uc, Uc), (this.metaService = n)
    }

    set(n) {
      this.metaService.set(new Vt(Uc), n)
    }
  }
  ;(e.ɵfac = function (o) {
    return new (o || e)(p(V))
  }),
    (e.ɵprov = g({ token: e, factory: e.ɵfac }))
  let t = e
  return t
})(),

That's 256 characters when picking it raw from the bundle (no whitespaces / new lines). So 256 bytes.

When the actual call that matters: this.metaService.set(new Vt(Uc), n) takes 35 chars -> 35 bytes. That's 221 bytes extra per each metadata.

Those 221 bytes are dedicated to:

  • Class syntax
  • Constructor
  • Angular's injectable code

Which could be reduced to just 1 per each kind of metadata type (Open Graph, Twitter Card, Standard, ...)

In Open Graph, if just joining was enough, that would mean saving 6 times 221 bytes (there are 7 metadata). So 1,326B -> 1.3kB.

Let's reduce the bundle size. For instance, by joining all metadata setters in one class

See #150 to see how a reduction was possible whilst still allowing to configure individual metadata setters 🤓

Bug: canonical URL metadata value is `[object Object]`

Project

ngx-meta

What happened?

Provided a default canonical URL as a URL object*. Then, provided a canonical URL in some page's route metadata as a URL object.

The result is the page setting canonical URL metadata elements to [object Object] instead of the one in the route.

*A bit weird use case to have a default canonical URL. But the same bug may appear in other scenarios due to the code causing it.

Version

1.0.0-alpha.47

Minimal reproduction

Set a default canonical URL using a URL object

NgxMetaCoreModule.forRoot({
  defaults: { canonicalUrl: new URL('https://example.org')} satisfies GlobalMetadata,
}),

Then, set a canonical URL using a URL object too

const routes: Routes = [
  // ...
  { 
     path: 'example',
     component: ExamplePageComponent, 
     data: {
       meta: { canonicalUrl: new URL('https://example.org/example') }
     } satisfies NgxMetadataRouteData<GlobalMetadata>
  },
  // ...
]

Code of Conduct

  • I agree to follow this project's Code of Conduct

Automatic canonical URL

Canonical URL could be automatic. For instance, by providing the app's base URL, then, using the route information, retrieve the page URL. And assume it's the canonical URL unless another is configured.

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.

  • build(dev-deps): update dependency eslint to v9

Detected dependencies

github-actions
.github/actions/setup/action.yml
  • pnpm/action-setup v4.0.0@fe02b34f77f8bc703788d5817da081398fad5dd2
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
.github/workflows/pull-request-completed.yml
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/github-script v7@60a0d83039c74a4aee543508d2ffcb1c3799cdea
  • peter-evans/find-comment v3@3eae4d37986fb5a8592848f6a574fdf654e61f9e
  • peter-evans/create-or-update-comment v4@71345be0265236311c031f5c7866368bd1eff043
.github/workflows/reusable-api-extractor.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
.github/workflows/reusable-build.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
.github/workflows/reusable-bundle-size.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • pnpm/action-setup v4.0.0@fe02b34f77f8bc703788d5817da081398fad5dd2
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
  • actions/github-script v7@60a0d83039c74a4aee543508d2ffcb1c3799cdea
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/github-script v7@60a0d83039c74a4aee543508d2ffcb1c3799cdea
.github/workflows/reusable-docs.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/setup-python v5@82c7e631bb3cdc910f68e0081d67478d79c6982d
  • pnpm/action-setup v4.0.0@fe02b34f77f8bc703788d5817da081398fad5dd2
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • cloudflare/pages-action 1@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca
.github/workflows/reusable-e2e.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • pnpm/action-setup v4.0.0@fe02b34f77f8bc703788d5817da081398fad5dd2
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • cypress-io/github-action v6.6.1@1b70233146622b69e789ccdd4f9452adc638d25a
.github/workflows/reusable-example-apps.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • pnpm/action-setup v4.0.0@fe02b34f77f8bc703788d5817da081398fad5dd2
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
.github/workflows/reusable-lint.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
.github/workflows/reusable-release.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • peter-evans/create-pull-request v6@6d6857d36972b65feb161a90e484f2984215f83e
.github/workflows/reusable-style.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
.github/workflows/reusable-test.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
nodenv
.node-version
  • node 20.13.1
npm
package.json
  • @angular/animations 17.3.8
  • @angular/common 17.3.8
  • @angular/compiler 17.3.8
  • @angular/core 17.3.8
  • @angular/forms 17.3.8
  • @angular/platform-browser 17.3.8
  • @angular/platform-browser-dynamic 17.3.8
  • @angular/router 17.3.8
  • rxjs 7.8.1
  • tslib 2.6.2
  • zone.js 0.14.5
  • @angular-devkit/build-angular 17.3.7
  • @angular-eslint/builder 17.4.0
  • @angular-eslint/eslint-plugin 17.4.0
  • @angular-eslint/eslint-plugin-template 17.4.0
  • @angular-eslint/schematics 17.4.0
  • @angular-eslint/template-parser 17.4.0
  • @angular/cli 17.3.7
  • @angular/compiler-cli 17.3.8
  • @commitlint/cli 19.3.0
  • @commitlint/config-conventional 19.2.2
  • @microsoft/api-documenter 7.23.38
  • @microsoft/api-extractor 7.43.4
  • @semantic-release/changelog 6.0.3
  • @types/jasmine 5.1.4
  • @typescript-eslint/eslint-plugin 7.8.0
  • @typescript-eslint/parser 7.8.0
  • conventional-changelog-conventionalcommits 7.0.2
  • dts-bundle-generator 9.5.1
  • eslint 8.57.0
  • eslint-config-prettier 9.1.0
  • husky 9.0.11
  • jasmine-core 5.1.2
  • karma 6.4.3
  • karma-chrome-launcher 3.2.0
  • karma-coverage 2.2.1
  • karma-jasmine 5.1.0
  • karma-jasmine-html-reporter 2.1.0
  • lint-staged 15.2.2
  • ng-lint-staged 12.0.4
  • ng-mocks 14.12.2
  • ng-packagr 17.3.0
  • prettier 3.2.5
  • semantic-release 23.1.1
  • typescript 5.4.5
  • pnpm 9.1.0
projects/ngx-meta/bundle-size/package.json
  • source-map-explorer 2.5.3
  • pnpm 9.1.0
projects/ngx-meta/docs/package.json
  • @fontsource-variable/inter-tight 5.0.21
  • @fontsource/dm-mono 5.0.20
projects/ngx-meta/e2e/package.json
  • cypress 13.9.0
  • typescript 5.4.5
  • pnpm 9.1.0
projects/ngx-meta/example-apps/package.json
  • @types/node 20.12.11
  • @types/semver 7.5.8
  • execa 9.0.2
  • semver 7.6.2
  • ts-morph 22.0.0
  • typescript 5.4.5
  • pnpm 9.1.0
projects/ngx-meta/example-apps/src/angular-cli-versions.json
  • v15 15.2.11
  • v16 16.2.14
  • v17 17.3.7
  • pnpm 9.1.0
projects/ngx-meta/src/package.json
  • tslib ^2.3.0
  • @angular/common ^17 || ^16 || ^15
  • @angular/core ^17 || ^16 || ^15
  • @angular/router ^17 || ^16 || ^15
pep621
projects/ngx-meta/docs/pyproject.toml
poetry
projects/ngx-meta/docs/pyproject.toml
  • python ==3.12.3
  • mkdocs-autolinks-plugin 0.7.1
  • mkdocs-material 9.5.21
  • mkdocs-git-revision-date-localized-plugin 1.2.5

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

Add `provideX` for Angular standalone apps

Given right now, we need to use a converter to importing modules at bootstrap time

importProvidersFrom(
NgxMetaRoutingModule.forRoot(),
NgxMetaStandardModule,
NgxMetaOpenGraphModule,
NgxMetaOpenGraphProfileModule,
NgxMetaTwitterCardModule,
NgxMetaJsonLdModule,
),

Whilst the new way with standalone apps is to use provideX methods

Those create environment injectors, which can't be used by component injectors. That can bring new possibilities

So we can add something like provideNgxMetaRouting() for instance

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid tarballDir option.

The tarballDir option option, if defined, must be a String.

Your configuration for the tarballDir option is true.


Good luck with your project ✨

Your semantic-release bot 📦🚀

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.