From 7401530bb3a0d09fa6fd615f0e25bd18d5b09a1a Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 1 Feb 2025 11:18:42 -0500 Subject: [PATCH 1/3] manage versioning with changesets --- .changeset/README.md | 8 ++++++++ .changeset/config.json | 11 +++++++++++ .changeset/pre.json | 8 ++++++++ .changeset/wise-owls-accept.md | 5 +++++ Taskfile.yaml | 2 ++ package.json | 3 ++- 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .changeset/README.md create mode 100644 .changeset/config.json create mode 100644 .changeset/pre.json create mode 100644 .changeset/wise-owls-accept.md diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000..e5b6d8d --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..6b37255 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 0000000..6c328bc --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,8 @@ +{ + "mode": "pre", + "tag": "alpha", + "initialVersions": { + "updux": "4.0.0-alpha.9" + }, + "changesets": [] +} diff --git a/.changeset/wise-owls-accept.md b/.changeset/wise-owls-accept.md new file mode 100644 index 0000000..d26ceaf --- /dev/null +++ b/.changeset/wise-owls-accept.md @@ -0,0 +1,5 @@ +--- +'updux': patch +--- + +Use @changesets/cli as the changelog manager diff --git a/Taskfile.yaml b/Taskfile.yaml index 1584275..24f5b93 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -46,6 +46,8 @@ tasks: - git is-clean # did we had tests? - git diff-ls {{.PARENT_BRANCH}} | grep test + # a new changeset + - git diff-ls main | grep .changeset/ - git checkout {{.PARENT_BRANCH}} - git weld - diff --git a/package.json b/package.json index 07598d3..fcda13c 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,12 @@ "version": "4.0.0-alpha.9", "type": "module", "dependencies": { + "@changesets/cli": "^2.27.12", "@mobily/ts-belt": "4.0.0-rc.5", + "@reduxjs/toolkit": "^2.2.7", "@yanick/updeep-remeda": "^2.3.1", "json-schema-shorthand": "^2.0.0", "json-schema-to-ts": "^2.9.2", - "@reduxjs/toolkit": "^2.2.7", "moize": "^6.1.6", "redux": "^4.2.0", "remeda": "^1.0.1", From 3d7701985a65802e6868c2970bb5141b23d92cd5 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 1 Feb 2025 11:39:09 -0500 Subject: [PATCH 2/3] use preconditions in the taskfile --- Taskfile.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 24f5b93..150dd59 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -42,12 +42,14 @@ tasks: integrate: deps: [checks] + preconditions: + - sh: git is-clean + msg: Workspace is not clean + - sh: git diff-ls {{.PARENT_BRANCH}} | grep test + msg: No test added + - sh: git diff-ls main | grep .changeset/ + msg: No new changeset cmds: - - git is-clean - # did we had tests? - - git diff-ls {{.PARENT_BRANCH}} | grep test - # a new changeset - - git diff-ls main | grep .changeset/ - git checkout {{.PARENT_BRANCH}} - git weld - From 9adaa71b2a498cbdc1776adc06308ca96925c929 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 1 Feb 2025 12:29:41 -0500 Subject: [PATCH 3/3] allow to skip preconditions --- Taskfile.yaml | 25 +++++++++++++++++++++---- contrib/check_changelog.fish | 5 +++++ contrib/check_new_tests.fish | 5 +++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100755 contrib/check_changelog.fish create mode 100755 contrib/check_new_tests.fish diff --git a/Taskfile.yaml b/Taskfile.yaml index 150dd59..c3e87eb 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -3,6 +3,9 @@ # tea releases c --asset releases/updux-4.0.0-alpha.2.tgz -p --title v4.0.0-alpha.2 --tag v4.0.0-alpha.2 version: '3' +env: + SHELL: /usr/local/bin/fish + vars: PARENT_BRANCH: main @@ -42,13 +45,17 @@ tasks: integrate: deps: [checks] + env: + NO_NEW_TESTS: '{{.NO_NEW_TESTS}}' + NO_CHANGELOG: '{{.NO_CHANGELOG}}' + PARENT_BRANCH: '{{.PARENT_BRANCH}}' preconditions: - sh: git is-clean msg: Workspace is not clean - - sh: git diff-ls {{.PARENT_BRANCH}} | grep test - msg: No test added - - sh: git diff-ls main | grep .changeset/ - msg: No new changeset + - sh: ./contrib/check_new_tests.fish + msg: No test added (NO_NEW_TESTS to disable) + - sh: ./contrib/check_changelog.fish + msg: No new changeset (NO_CHANGELOG to disable) cmds: - git checkout {{.PARENT_BRANCH}} - git weld - @@ -57,6 +64,16 @@ tasks: test:dev: vitest src + foo: + env: + NO_NEW_TESTS: '{{.NO_NEW_TESTS}}' + PARENT_BRANCH: '{{.PARENT_BRANCH}}' + cmds: + - echo $SHELL + - echo {{.NO_NEW_TESTS}} + - echo $NO_NEW_TESTS + - ./contrib/check_new_tests.fish + lint:fix:delta: vars: FILES: diff --git a/contrib/check_changelog.fish b/contrib/check_changelog.fish new file mode 100755 index 0000000..0b8dc57 --- /dev/null +++ b/contrib/check_changelog.fish @@ -0,0 +1,5 @@ +#!/usr/bin/env fish + +if test -z "$NO_CHANGELOG" + git diff-ls main | grep .changeset/ ; +end diff --git a/contrib/check_new_tests.fish b/contrib/check_new_tests.fish new file mode 100755 index 0000000..8e0c55c --- /dev/null +++ b/contrib/check_new_tests.fish @@ -0,0 +1,5 @@ +#!/usr/bin/env fish + +if test -z "$NO_NEW_TESTS" + git diff-ls $PARENT_BRANCH | grep test +end