Skip to content

Commit

Permalink
Merge branch 'release/3.0.0-alpha.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Aug 6, 2024
2 parents 208d6ff + 24f9be8 commit b37c192
Show file tree
Hide file tree
Showing 36 changed files with 568 additions and 231 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: release

on:
push:
tags:
- '*.*.*'

jobs:
release:
runs-on: macos-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
id: npm-cache
with:
path: |
${{ steps.npm-cache-dir.outputs.dir }}
**/node_modules
.eslintcache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm install --no-audit --no-fund

- run: npm run build

- name: Test
run: npm run test -- -- --coverage.enabled

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./packages/coverage
flags: unittests
fail_ci_if_error: false
verbose: true

- run: |
NPM_TAG='latest'
IS_PRERELEASE=false
if [[ $GITHUB_REF_NAME =~ 'alpha' || $GITHUB_REF_NAME =~ 'beta' || $GITHUB_REF_NAME =~ 'rc' ]]; then
NPM_TAG='next'
IS_PRERELEASE=true
fi
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV
echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV
- uses: JS-DevTools/npm-publish@v3
with:
provenance: true
package: dist/
tag: ${{ env.NPM_TAG }}
token: ${{ secrets.NPM_TOKEN }}

- uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref }}
name: v${{ github.ref_name }}
body: Please refer to [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
draft: false
prerelease: ${{ env.IS_PRERELEASE }}
70 changes: 0 additions & 70 deletions .github/workflows/release.yml

This file was deleted.

26 changes: 19 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ All notable changes to this project will be documented in this file. The format

## [Unreleased]

## [v3.0.0-alpha.6](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.5..3.0.0-alpha.6) (2023-08-02)
## [v3.0.0-alpha.7](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.6..3.0.0-alpha.7) (2024-08-06)

### Added

- Add `camelCase`, `pascalCase`, `snakeCase` and `dashCase` functions ([#506](https://github.com/studiometa/js-toolkit/pull/506), [c753a16](https://github.com/studiometa/js-toolkit/commit/c753a16))
- Add a `memo` function as a simpler and smaller `memoize` alternative ([#506](https://github.com/studiometa/js-toolkit/pull/506), [980a0b3](https://github.com/studiometa/js-toolkit/commit/980a0b3))

### Changed

- Convert ref names to camelCase ([#338](https://github.com/studiometa/js-toolkit/issues/338), [#506](https://github.com/studiometa/js-toolkit/pull/506), [1f5dbd9](https://github.com/studiometa/js-toolkit/commit/1f5dbd9))

## [v3.0.0-alpha.6](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.5..3.0.0-alpha.6) (2024-08-02)

### Changed

Expand All @@ -17,14 +28,15 @@ All notable changes to this project will be documented in this file. The format
### Fixed

- Fix a bug where refs could be undefined ([c11eb49](https://github.com/studiometa/js-toolkit/commit/c11eb49))
- ⚠️ Fix listening to unconfigured events ([#505](https://github.com/studiometa/js-toolkit/pull/505), [a1e8dc9](https://github.com/studiometa/js-toolkit/commit/a1e8dc9))

## [v3.0.0-alpha.5](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.4..3.0.0-alpha.5) (2023-07-16)
## [v3.0.0-alpha.5](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.4..3.0.0-alpha.5) (2024-07-16)

### Changed

- Change behaviour of the `getInstances` helper ([#484](https://github.com/studiometa/js-toolkit/pull/484))

## [v3.0.0-alpha.4](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.3..3.0.0-alpha.4) (2023-07-05)
## [v3.0.0-alpha.4](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.3..3.0.0-alpha.4) (2024-07-05)

### Added

Expand All @@ -35,7 +47,7 @@ All notable changes to this project will be documented in this file. The format

- Fix code coverage reports ([#474](https://github.com/studiometa/js-toolkit/pull/474))

## [v3.0.0-alpha.3](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.2..3.0.0-alpha.3) (2023-04-17)
## [v3.0.0-alpha.3](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.2..3.0.0-alpha.3) (2024-04-17)

### Added

Expand All @@ -46,7 +58,7 @@ All notable changes to this project will be documented in this file. The format
- ⚠️ Enable the `asyncChildren` feature by default ([#427](https://github.com/studiometa/js-toolkit/pull/427))
- ⚠️ Rename the `asyncChildren` feature to `blocking` ([#427](https://github.com/studiometa/js-toolkit/pull/427))

## [v3.0.0-alpha.2](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.1..3.0.0-alpha.2) (2023-04-04)
## [v3.0.0-alpha.2](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.1..3.0.0-alpha.2) (2024-04-04)

### Added

Expand All @@ -56,7 +68,7 @@ All notable changes to this project will be documented in this file. The format

- Fix an import path ([#426](https://github.com/studiometa/js-toolkit/pull/426), [9722d74](https://github.com/studiometa/js-toolkit/commit/9722d74))

## [v3.0.0-alpha.1](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.0..3.0.0-alpha.1) (2023-04-04)
## [v3.0.0-alpha.1](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.0..3.0.0-alpha.1) (2024-04-04)

### Added

Expand All @@ -66,7 +78,7 @@ All notable changes to this project will be documented in this file. The format

- Fix `ease...` tests ([#425](https://github.com/studiometa/js-toolkit/pull/425))

## [v3.0.0-alpha.0](https://github.com/studiometa/js-toolkit/compare/2.12.0..3.0.0-alpha.0) (2023-04-03)
## [v3.0.0-alpha.0](https://github.com/studiometa/js-toolkit/compare/2.12.0..3.0.0-alpha.0) (2024-04-03)

### Added

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-workspace",
"version": "3.0.0-alpha.6",
"version": "3.0.0-alpha.7",
"private": true,
"type": "module",
"workspaces": [
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-demo",
"version": "3.0.0-alpha.6",
"version": "3.0.0-alpha.7",
"private": true,
"type": "module",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions packages/docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function getUtilsSidebar() {
items: [
{ text: 'debounce', link: '/utils/debounce.html' },
{ text: 'keyCodes', link: '/utils/keyCodes.html' },
{ text: 'memo', link: '/utils/memo.html' },
{ text: 'memoize', link: '/utils/memoize.html' },
{ text: 'nextFrame', link: '/utils/nextFrame.html' },
{ text: 'nextMicrotask', link: '/utils/nextMicrotask.html' },
Expand Down Expand Up @@ -356,6 +357,12 @@ function getUtilsSidebar() {
link: '/utils/string/',
collapsed: true,
items: [
{ text: 'camelCase', link: '/utils/string/camelCase.html' },
{ text: 'dashCase', link: '/utils/string/dashCase.html' },
{ text: 'pascalCase', link: '/utils/string/pascalCase.html' },
{ text: 'snakeCase', link: '/utils/string/snakeCase.html' },
{ text: 'lowerCase', link: '/utils/string/lowerCase.html' },
{ text: 'upperCase', link: '/utils/string/upperCase.html' },
{ text: 'startsWith', link: '/utils/string/startsWith.html' },
{ text: 'endsWith', link: '/utils/string/endsWith.html' },
{ text: 'withLeadingCharacters', link: '/utils/string/withLeadingCharacters.html' },
Expand Down
16 changes: 8 additions & 8 deletions packages/docs/api/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The [lazy import helpers](/api/helpers/#lazy-import-helpers) can be used to mana
- Type : `Array<String>`
- Default : `[]`

Define the refs of the components by specifying their name in the configuration. Multiple refs should be suffixed with `[]`.
Define the refs of the components by specifying their name in the configuration. Multiple refs should be suffixed with `[]`. Refs names can be configured and used in HTML following the `dash-case` pattern, and will be available in the `this.$refs` object following the `camelCase` pattern.

```html
<div data-component="Component">
Expand All @@ -132,8 +132,8 @@ Define the refs of the components by specifying their name in the configuration.
<li data-ref="items[]">#1</li>
</ul>
<ul>
<li data-ref="otherItems[]">#1</li>
<li data-ref="otherItems[]">#2</li>
<li data-ref="other-items[]">#1</li>
<li data-ref="other-items[]">#2</li>
</ul>
<!-- Refs can be prefixed by the name of their component (in HTML only) -->
<input data-ref="Component.input" type="text" />
Expand All @@ -144,13 +144,13 @@ Define the refs of the components by specifying their name in the configuration.
class Component extends Base {
static config = {
name: 'Component',
refs: ['btn', 'items[]', 'otherItems[]'],
refs: ['btn', 'items[]', 'other-items[]'],
};

mounted() {
this.$refs.btn; // <button data-ref="btn">Click me</button>
this.$refs.items; // [<li data-ref="items[]">#1</li>]
this.$refs.otherItems; // [<li data-ref="otherItems[]">#1</li>, <li data-ref="otherItems[]">#2</li>]
this.$refs.otherItems; // [<li data-ref="other-items[]">#1</li>, <li data-ref="other-items[]">#2</li>]
}
}
```
Expand Down Expand Up @@ -203,11 +203,11 @@ The debug logs are conditionnally rendered base on a `__DEV__` global variable w
**Example Webpack configuration**

```js
const { DefinePlugin } = require('webpack');
import webpack from 'webpack';

module.exports = {
export default {
plugins: [
new DefinePlugin({
new webpack.DefinePlugin({
__DEV__: JSON.stringify(process.env.NODE_ENV === 'development'),
}),
],
Expand Down
23 changes: 23 additions & 0 deletions packages/docs/guide/migration/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,26 @@ this.$update(); // [!code --]
await this.$update(); // [!code ++]
this.$children.Component[0].toggle();
```
## Unconfigured events are not listenable anymore
In v2, custom events that were not configured via the [static `config` property](/api/configuration.html) were still taken in consideration when adding event listeners with the [`$on` method](/api/instance-methods.html#on-event-callback-options) or the [`on...` event hooks](/api/methods-hooks-events.html). This behavior is removed in v3, meaning that each component must define the events it will emit.
To migrate, make sure to add the events that will be emitted to the static `config` object with the `emits` property.
```js
class MyComponent extends Base {
static config = {
name: 'MyComponent',
emits: ['custom-event'], // [!code ++]
};

mounted() {
this.$emit('custom-event');
}

onCustomEvent() {
// ...
}
}
```
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-docs",
"version": "3.0.0-alpha.6",
"version": "3.0.0-alpha.7",
"type": "module",
"private": true,
"scripts": {
Expand Down
Loading

0 comments on commit b37c192

Please sign in to comment.