From 68c3273658f7276e68eca65b510739cdeadafbf7 Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Fri, 7 Jul 2023 14:08:42 +0200 Subject: [PATCH] Repo Maintenance / Prep Release (#775) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jan Buschtöns --- .dependabot/config.yml | 13 ---- .github/workflows/release.yml | 1 + CHANGELOG.md | 29 ++++++++- LICENSE.md | 10 +-- README.md | 119 +--------------------------------- docs/getting-started.md | 24 +++++-- docs/testing.md | 1 - ember-link/rollup.config.mjs | 11 +--- 8 files changed, 47 insertions(+), 161 deletions(-) delete mode 100644 .dependabot/config.yml mode change 100644 => 120000 LICENSE.md mode change 100644 => 120000 README.md diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index c8520438..00000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: 1 -update_configs: - - package_manager: "javascript" - directory: "/" - update_schedule: "live" - version_requirement_updates: increase_versions - automerged_updates: - - match: - dependency_type: "development" - update_type: "all" - - match: - dependency_type: "production" - update_type: "all" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 846ffd34..821c986d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,5 +16,6 @@ jobs: with: pnpm-args: --frozen-lockfile - run: npm publish + working-directory: ./ember-link env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0bb396..8d9df952 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,39 @@ # Changelog +## v2.1.0 (2023-05-25) + +#### :house: Internal + +* [#746](https://github.com/buschtoens/ember-link/pull/746) Deprecations and TS Fixes ([@gossi](https://github.com/gossi)) + +#### Committers: 1 + +- Thomas Gossmann ([@gossi](https://github.com/gossi)) ## v2.0.1 (2022-12-23) #### :bug: Bug Fix + * [#718](https://github.com/buschtoens/ember-link/pull/718) Fix exporting `LinkParams` and `UILinkParams` types ([@bertdeblock](https://github.com/bertdeblock)) #### :house: Internal + * [#711](https://github.com/buschtoens/ember-link/pull/711) Update `.npmignore` file ([@Turbo87](https://github.com/Turbo87)) #### Committers: 2 + - Bert De Block ([@bertdeblock](https://github.com/bertdeblock)) -- Tobias Bieniek ([@Turbo87](https://github.com/Turbo87)) +* Tobias Bieniek ([@Turbo87](https://github.com/Turbo87)) ## v2.0.0 (2022-04-06) #### :boom: Breaking Change + * [#658](https://github.com/buschtoens/ember-link/pull/658) Remove link cache ([@Turbo87](https://github.com/Turbo87)) * [#656](https://github.com/buschtoens/ember-link/pull/656) Raise minimum Node to v12 ([@Turbo87](https://github.com/Turbo87)) #### :house: Internal + * [#678](https://github.com/buschtoens/ember-link/pull/678) Adjust `@glimmer/tracking` dependency to use semver ([@Turbo87](https://github.com/Turbo87)) * [#675](https://github.com/buschtoens/ember-link/pull/675) Use `pnpm` package manager ([@Turbo87](https://github.com/Turbo87)) * [#674](https://github.com/buschtoens/ember-link/pull/674) Release via CI ([@Turbo87](https://github.com/Turbo87)) @@ -33,25 +47,31 @@ * [#618](https://github.com/buschtoens/ember-link/pull/618) Fix CI issues ([@Turbo87](https://github.com/Turbo87)) #### Committers: 1 + - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87)) ## v1.3.1 (2021-01-29) #### :rocket: Enhancement + * [#518](https://github.com/buschtoens/ember-link/pull/518) fix(link-manager): Use private router API to query `currentURL` in a side-effect-free way ([@Turbo87](https://github.com/Turbo87)) #### Committers: 1 + - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87)) ## v1.3.0 (2021-01-28) #### :rocket: Enhancement + * [#507](https://github.com/buschtoens/ember-link/pull/507) Fix Ember 3.24 compatibility ([@Turbo87](https://github.com/Turbo87)) #### :bug: Bug Fix + * [#506](https://github.com/buschtoens/ember-link/pull/506) services/link-manager: Fix typo in `getLinkParamsFromURL()` method name ([@Turbo87](https://github.com/Turbo87)) #### :house: Internal + * [#505](https://github.com/buschtoens/ember-link/pull/505) tests/components: Run tests with and without the `setupLink()` test helper ([@Turbo87](https://github.com/Turbo87)) * [#504](https://github.com/buschtoens/ember-link/pull/504) Add `LinkTo` tests and `currentURL()` assertions ([@Turbo87](https://github.com/Turbo87)) * [#503](https://github.com/buschtoens/ember-link/pull/503) tests/components/link: Add "incomplete model" test ([@Turbo87](https://github.com/Turbo87)) @@ -59,17 +79,20 @@ * [#501](https://github.com/buschtoens/ember-link/pull/501) tests/acceptance: Avoid multiple `Router.map()` calls ([@Turbo87](https://github.com/Turbo87)) #### Committers: 1 + - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87)) ## v1.2.1 (2020-11-16) #### :bug: Bug Fix + * [#473](https://github.com/buschtoens/ember-link/pull/473) Check `button` property and modifier key states before calling `preventDefault()` ([@Turbo87](https://github.com/Turbo87)) #### Committers: 1 + - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87)) ## v1.2.0 (2020-08-06) -- [#257](https://github.com/buschtoens/ember-link/issues/257) Testing API and support for render tests -- [#394](https://github.com/buschtoens/ember-link/pull/394) fix(Link): Use `currentTransitionStack` to enable auto-tracking +* [#257](https://github.com/buschtoens/ember-link/issues/257) Testing API and support for render tests +* [#394](https://github.com/buschtoens/ember-link/pull/394) fix(Link): Use `currentTransitionStack` to enable auto-tracking diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index f8d1edb3..00000000 --- a/LICENSE.md +++ /dev/null @@ -1,9 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md new file mode 120000 index 00000000..7eef114e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1 @@ +ember-link/LICENSE.md \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index a9f84f3c..00000000 --- a/README.md +++ /dev/null @@ -1,118 +0,0 @@ -# ember-link - -[![CI](https://github.com/buschtoens/ember-link/workflows/CI/badge.svg)](https://github.com/buschtoens/ember-link/actions) -[![npm version](https://badge.fury.io/js/ember-link.svg)](http://badge.fury.io/js/ember-link) -[![Download Total](https://img.shields.io/npm/dt/ember-link.svg)](http://badge.fury.io/js/ember-link) -[![Ember Observer Score](https://emberobserver.com/badges/ember-link.svg)](https://emberobserver.com/addons/ember-link) - -Introduces a new `Link` primitive to pass around self-contained references to -routes, like URLs, but with state (`isActive`, ...) and methods (`open`, -...). Also brings along an accompanying template helper for easy -usage in templates. - -> `ember-link` does to routing what `ember-concurrency` did to asynchrony! - -— [/r/whatjawsdid](https://www.reddit.com/r/whatjawsdid/) - -## Installation - -Install `ember-link` with: - -```sh -ember install ember-link -``` - -## Usage - -You can use `ember-link` in a declarative form with a [`(link)` -helper](https://buschtoens.github.io/ember-link/helper.html) or imperatively with the [`LinkManager` -Service](https://buschtoens.github.io/ember-link/service.html). - -### `(link)` Helper Example - -Use the `(link)` helper to create a link primitive and attach it to an element. - -```hbs -{{#let (link "about") as |l|}} - - About us - -{{/let}} -``` - -### `LinkManager` Service Example - -Use the `LinkManager.createLink()` method to create a link programmatically. - -```ts -import Contoller from '@ember/controller'; -import { service } from '@ember/service'; -import type { LinkManagerService } from 'ember-link'; - -export default class PageHeader extends Controller { - @service declare linkManager: LinkManagerService; - - aboutUsLink = this.linkManager.createLink('about'); -} -``` - -### Working with Primitives - -The idea of `ember-link` is to be able to create link primitives, that you can -pass around. Create links at route level and then pass them into components. - -A more in-depth guide is available at [using primitives](https://buschtoens.github.io/ember-link/using-primitives.html). - -## Testing - -[ember-link has testing support](https://buschtoens.github.io/ember-link/testing.html) on board, preparing the environment with -`setupLink()` and `linkFor()` to create a link to a route on the fly: - -```ts -import { click, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; - -import { linkFor, setupLink } from 'ember-link/test-support'; - -import type { TestContext as BaseTestContext } from '@ember/test-helpers'; -import type { TestLink } from 'ember-link/test-support'; - -interface TestContext extends BaseTestContext { - link: TestLink; -} - -module('`setupLink` example', function (hooks) { - setupRenderingTest(hooks); - setupLink(hooks); - - test('using link in render tests', async function (this: TestContext, assert) { - // arrange - this.link = linkFor('some.route'); - this.link.onTransitionTo = () => assert.step('link clicked'); - - await render(hbs` - {{#let this.link as |l|}} - Click me - {{/let}} - `); - - // act - await click('a'); - - // assert - assert.verifySteps(['link clicked']); - }); -}); - -``` - -## Related RFCs / Projects - -- [`ember-engine-router-service`](https://github.com/buschtoens/ember-engine-router-service): - Allows you to use `ember-link` inside engines -- [`ember-router-helpers`](https://github.com/rwjblue/ember-router-helpers) -- [RFC 391 "Router Helpers"](https://github.com/emberjs/rfcs/blob/master/text/0391-router-helpers.md) -- [RFC 339 "Router link component and routing helpers"](https://github.com/emberjs/rfcs/pull/339) -- [RFC 459 "Angle Bracket Invocations For Built-in Components"](https://github.com/emberjs/rfcs/blob/angle-built-ins/text/0459-angle-bracket-built-in-components.md#linkto) diff --git a/README.md b/README.md new file mode 120000 index 00000000..cffbfc81 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +ember-link/README.md \ No newline at end of file diff --git a/docs/getting-started.md b/docs/getting-started.md index 54b72225..ad6f8537 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -55,29 +55,39 @@ A more in-depth guide is available at [using primitives](./using-primitives.md). `setupLink()` and `linkFor()` to create a link to a route on the fly: ```ts -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; -import { setupLink, linkFor, TestLink } from 'ember-link/test-support'; +import { linkFor, setupLink } from 'ember-link/test-support'; + +import type { TestContext as BaseTestContext } from '@ember/test-helpers'; +import type { TestLink } from 'ember-link/test-support'; + +interface TestContext extends BaseTestContext { + link: TestLink; +} module('`setupLink` example', function (hooks) { setupRenderingTest(hooks); setupLink(hooks); - test('`(link)` works in render tests', async function (assert) { - const link = linkFor('some.route'); - link.onTransitionTo = assert.step('link clicked'); + test('using link in render tests', async function (this: TestContext, assert) { + // arrange + this.link = linkFor('some.route'); + this.link.onTransitionTo = () => assert.step('link clicked'); await render(hbs` - {{#let (link @route="some.route") as |l|}} + {{#let this.link as |l|}} Click me {{/let}} `); + // act await click('a'); + // assert assert.verifySteps(['link clicked']); }); }); diff --git a/docs/testing.md b/docs/testing.md index 474d66f8..1303cdd6 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -51,5 +51,4 @@ module('`setupLink` example', function (hooks) { assert.verifySteps(['link clicked']); }); }); - ``` diff --git a/ember-link/rollup.config.mjs b/ember-link/rollup.config.mjs index 9a10e4d7..6e201ce4 100644 --- a/ember-link/rollup.config.mjs +++ b/ember-link/rollup.config.mjs @@ -1,7 +1,6 @@ import { Addon } from '@embroider/addon-dev/rollup'; import { defineConfig } from 'rollup'; -import copy from 'rollup-plugin-copy'; import typescript from 'rollup-plugin-ts'; const addon = new Addon({ @@ -52,14 +51,6 @@ export default defineConfig({ addon.keepAssets(['**/*.css']), // Remove leftover build artifacts when starting a new build. - addon.clean(), - - // Copy Readme and License into published package - copy({ - targets: [ - { src: '../README.md', dest: '.' }, - { src: '../LICENSE.md', dest: '.' } - ] - }) + addon.clean() ] });