From 4dda43247168e78997c56ef531422b8f0533cf6c Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Wed, 10 Dec 2025 11:06:48 +0100 Subject: [PATCH] chore(repo): Update Node version and overal cleanup (#3861) * update ci script * Update ci workflow * Update node version --- .github/workflows/ci.yml | 36 +--- .github/workflows/version-up.sh | 284 -------------------------------- .npmrc | 1 - docs/package.json | 16 +- lint-staged.config.mjs | 4 +- package.json | 4 +- 6 files changed, 14 insertions(+), 331 deletions(-) delete mode 100755 .github/workflows/version-up.sh delete mode 100644 .npmrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e8388be9..b6b886e4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,11 +37,11 @@ jobs: run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT - name: Check if we can patch - run: .github/workflows/version-up.sh --minor + run: pnpm semver $LATEST_TAG -i minor - name: Create new version id: new-version - run: echo "NEW_VERSION=$(.github/workflows/version-up.sh --minor)" >> $GITHUB_OUTPUT + run: echo "NEW_VERSION=$(pnpm semver $LATEST_TAG -i minor)" >> $GITHUB_OUTPUT - name: Create change log id: change-log @@ -68,38 +68,6 @@ jobs: name: Version ${{ steps.new-version.outputs.NEW_VERSION }} generate_release_notes: true - test-semantic-release: - if: github.repository == 'lucide-icons/lucide' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Semantic Release - id: semantic - uses: cycjimmy/semantic-release-action@v4 - with: - tag_format: ${version} - branches: | - ['new-release-workflow'] - extends: | - semantic-release-monorepo - extra_plugins: | - @semantic-release/github - @semantic-release/git - @semantic-release/release-notes-generator - conventional-changelog-conventionalcommits - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Log output - if: steps.semantic.outputs.new_release_published == 'true' - run: | - echo ${{ steps.semantic.outputs.new_release_version }} - echo ${{ steps.semantic.outputs.new_release_major_version }} - echo ${{ steps.semantic.outputs.new_release_minor_version }} - echo ${{ steps.semantic.outputs.new_release_patch_version }} - start-release: if: github.repository == 'lucide-icons/lucide' needs: create-release diff --git a/.github/workflows/version-up.sh b/.github/workflows/version-up.sh deleted file mode 100755 index 32892478e..000000000 --- a/.github/workflows/version-up.sh +++ /dev/null @@ -1,284 +0,0 @@ -#!/usr/bin/env bash -## Copyright (C) 2017, Oleksandr Kucherenko -## Last revisit: 2017-09-29 - -## get highest version tag for all branches -function highest_tag(){ - local TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "$TAG" -} - -## extract current branch name -function current_branch(){ - ## expected: heads/{branch_name} - ## expected: {branch_name} - local BRANCH=$(git rev-parse --abbrev-ref HEAD | cut -d"/" -f2) - echo "$BRANCH" -} - -## get latest/head commit hash number -function head_hash(){ - local COMMIT_HASH=$(git rev-parse --verify HEAD) - echo "$COMMIT_HASH" -} - -## extract tag commit hash code, tag name provided by argument -function tag_hash(){ - local TAG_HASH=$(git log -1 --format=format:"%H" $1 2>/dev/null | tail -n1) - echo "$TAG_HASH" -} - -## get latest revision number -function latest_revision(){ - local REV=$(git rev-list --count HEAD 2>/dev/null) - echo "$REV" -} - -## parse last found tag, extract it PARTS -function parse_last(){ - local position=$(($1-1)) - - # two parts found only - local SUBS=( ${PARTS[$position]//-/ } ) - #echo ${SUBS[@]}, size: ${#SUBS} - - # found NUMBER - PARTS[$position]=${SUBS[0]} - #echo ${PARTS[@]} - - # found SUFFIX - if [[ ${#SUBS} -ge 1 ]]; then - PARTS[4]=${SUBS[1],,} #lowercase - #echo ${PARTS[@]}, ${SUBS[@]} - fi -} - -## increment REVISION part, don't touch STAGE -function increment_revision(){ - PARTS[3]=$(( PARTS[3] + 1 )) - IS_DIRTY=1 -} - -## increment PATCH part, reset all other lower PARTS, don't touch STAGE -function increment_patch(){ - PARTS[2]=$(( PARTS[2] + 1 )) - PARTS[3]=0 - IS_DIRTY=1 -} - -## increment MINOR part, reset all other lower PARTS, don't touch STAGE -function increment_minor(){ - PARTS[1]=$(( PARTS[1] + 1 )) - PARTS[2]=0 - PARTS[3]=0 - IS_DIRTY=1 -} - -## increment MAJOR part, reset all other lower PARTS, don't touch STAGE -function incremet_major(){ - PARTS[0]="v$(( PARTS[0] + 1 ))" - PARTS[1]=0 - PARTS[2]=0 - PARTS[3]=0 - IS_DIRTY=1 -} - -## increment the number only of last found PART: REVISION --> PATCH --> MINOR. don't touch STAGE -function increment_last_found(){ - if [[ "${#PARTS[3]}" == 0 || "${PARTS[3]}" == "0" ]]; then - if [[ "${#PARTS[2]}" == 0 || "${PARTS[2]}" == "0" ]]; then - increment_minor - else - increment_patch - fi - else - increment_revision - fi - - # stage part is not EMPTY - if [[ "${#PARTS[4]}" != 0 ]]; then - IS_SHIFT=1 - fi -} - -## compose version from PARTS -function compose(){ - MAJOR="${PARTS[0]}" - MINOR=".${PARTS[1]}" - PATCH=".${PARTS[2]}" - REVISION=".${PARTS[3]}" - SUFFIX="-${PARTS[4]}" - - if [[ "${#PATCH}" == 1 ]]; then # if empty {PATCH} - PATCH="" - fi - - if [[ "${#REVISION}" == 1 ]]; then # if empty {REVISION} - REVISION="" - fi - - if [[ "${PARTS[3]}" == "0" ]]; then # if revision is ZERO - REVISION="" - fi - - # shrink patch and revision - if [[ -z "${REVISION// }" ]]; then - if [[ "${PARTS[2]}" == "0" ]]; then - PATCH=".0" - fi - else # revision is not EMPTY - if [[ "${#PATCH}" == 0 ]]; then - PATCH=".0" - fi - fi - - # remove suffix if we don't have a alpha/beta/rc - if [[ "${#SUFFIX}" == 1 ]]; then - SUFFIX="" - fi - - - echo "${MAJOR}${MINOR}${PATCH}${REVISION}${SUFFIX}" #full format -} - -# initial version used for repository without tags -INIT_VERSION=0.0.0.0-alpha - -# do GIT data extracting -TAG=$(highest_tag) -REVISION=$(latest_revision) -BRANCH=$(current_branch) -TAG_HASH=$(tag_hash $TAG) -HEAD_HASH=$(head_hash) - -# if tag and branch commit hashes are different, than print info about that -#echo $HEAD_HASH vs $TAG_HASH -if [[ "$@" == "" ]]; then - if [[ "$TAG_HASH" == "$HEAD_HASH" ]]; then - echo "Tag $TAG and HEAD are aligned. We will stay on the TAG version." - echo "" - NO_ARGS_VALUE='--stay' - else - PATTERN="^[0-9]+.[0-9]+(.[0-9]+)*(-(alpha|beta|rc))*$" - - if [[ "$BRANCH" =~ $PATTERN ]]; then - echo "Detected version branch '$BRANCH'. We will auto-increment the last version PART." - echo "" - NO_ARGS_VALUE='--default' - else - echo "Detected branch name '$BRANCH' than does not match version pattern. We will increase MINOR." - echo "" - NO_ARGS_VALUE='--minor' - fi - fi -fi - -# -# {MAJOR}.{MINOR}[.{PATCH}[.{REVISION}][-(.*)] -# -# Suffix: alpha, beta, rc -# No Suffix --> {NEW_VERSION}-alpha -# alpha --> beta -# beta --> rc -# rc --> {VERSION} -# -PARTS=( ${TAG//./ } ) -parse_last ${#PARTS[@]} # array size as argument -#echo ${PARTS[@]} - -# if no parameters than emulate --default parameter -if [[ "$@" == "" ]]; then - set -- $NO_ARGS_VALUE -fi - -# parse input parameters -for i in "$@" -do - key="$i" - - case $key in - -a|--alpha) # switched to ALPHA - PARTS[4]="alpha" - IS_SHIFT=1 - ;; - -b|--beta) # switched to BETA - PARTS[4]="beta" - IS_SHIFT=1 - ;; - -c|--release-candidate) # switched to RC - PARTS[4]="rc" - IS_SHIFT=1 - ;; - -r|--release) # switched to RELEASE - PARTS[4]="" - IS_SHIFT=1 - ;; - -p|--patch) # increment of PATCH - increment_patch - ;; - -e|--revision) # increment of REVISION - increment_revision - ;; - -g|--git-revision) # use git revision number as a revision part§ - PARTS[3]=$(( REVISION )) - IS_DIRTY=1 - ;; - -i|--minor) # increment of MINOR by default - increment_minor - ;; - --default) # stay on the same stage, but increment only last found PART of version code - increment_last_found - ;; - -m|--major) # increment of MAJOR - incremet_major - ;; - -s|--stay) # extract version info - IS_DIRTY=1 - NO_APPLY_MSG=1 - ;; - -t|--tag-only) # extract version info - TAG_ONLY=1 - ;; - --apply) - DO_APPLY=1 - ;; - -h|--help) - help - ;; - esac - shift -done - -# detected shift, but no increment -if [[ "$IS_SHIFT" == "1" ]]; then - # temporary disable stage shift - stage=${PARTS[4]} - PARTS[4]='' - - # detect first run on repository, INIT_VERSION was used - if [[ "$(compose)" == "0.0" ]]; then - increment_minor - fi - - PARTS[4]=$stage -fi - -# no increment applied yet and no shift of state, do minor increase -if [[ "$IS_DIRTY$IS_SHIFT" == "" ]]; then - increment_minor -fi - -compose - -# is proposed tag in conflict with any other TAG -PROPOSED_HASH=$(tag_hash $(compose)) -if [[ "${#PROPOSED_HASH}" -gt 0 && "$NO_APPLY_MSG" == "" ]]; then - echo -e "\033[31mERROR:\033[0m " - echo -e "\033[31mERROR:\033[0m Found conflict with existing tag \033[32m$(compose)\033[0m / $PROPOSED_HASH" - echo -e "\033[31mERROR:\033[0m Only manual resolving is possible now." - echo -e "\033[31mERROR:\033[0m " - echo -e "\033[31mERROR:\033[0m To Resolve try to add --revision or --patch modifier." - echo -e "\033[31mERROR:\033[0m " - echo "" - exit 1 -fi diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 3e775efb0..000000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -auto-install-peers=true diff --git a/docs/package.json b/docs/package.json index ffde218f0..feede4363 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,14 +9,14 @@ "docs:build": "pnpm run /^prebuild:.*/ && vitepress build", "docs:preview": "vitepress preview", "build:docs": "vitepress build", - "prebuild:iconNodes": "node --experimental-strip-types ./scripts/writeIconNodes.mjs", - "prebuild:metaJson": "node --experimental-strip-types ./scripts/writeIconMetaIndex.mjs", - "prebuild:releaseJson": "node --experimental-strip-types ./scripts/writeReleaseMetadata.mjs", - "prebuild:categoriesJson": "node --experimental-strip-types ./scripts/writeCategoriesMetadata.mjs", - "prebuild:relatedIcons": "node --experimental-strip-types ./scripts/writeIconRelatedIcons.mjs", - "prebuild:iconDetails": "node --experimental-strip-types ./scripts/writeIconDetails.mjs", - "prebuild:brandStopwords": "node --experimental-strip-types ./scripts/writeBrandStopwords.mjs", - "postbuild:vercelJson": "node --experimental-strip-types ./scripts/writeVercelOutput.mjs", + "prebuild:iconNodes": "node ./scripts/writeIconNodes.mjs", + "prebuild:metaJson": "node ./scripts/writeIconMetaIndex.mjs", + "prebuild:releaseJson": "node ./scripts/writeReleaseMetadata.mjs", + "prebuild:categoriesJson": "node ./scripts/writeCategoriesMetadata.mjs", + "prebuild:relatedIcons": "node ./scripts/writeIconRelatedIcons.mjs", + "prebuild:iconDetails": "node ./scripts/writeIconDetails.mjs", + "prebuild:brandStopwords": "node ./scripts/writeBrandStopwords.mjs", + "postbuild:vercelJson": "node ./scripts/writeVercelOutput.mjs", "dev": "npx nitropack dev", "prebuild:api": "npx nitropack prepare", "build:api": "npx nitropack build", diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs index 7ba870a29..2b580d645 100644 --- a/lint-staged.config.mjs +++ b/lint-staged.config.mjs @@ -7,8 +7,8 @@ const filenamesToAjvOption = (filenames) => filenames.map((filename) => `-d ${fi /** @satisfies {import('lint-staged').Config} */ const config = { 'icons/*.svg': [ - 'node ./scripts/optimizeStagedSvgs.mjs', - 'node ./scripts/generateNextJSAliases.mjs', + 'node ./scripts/optimizeStagedSvgs.mts', + 'node ./scripts/generateNextJSAliases.mts', ], 'icons/*.json': (filenames) => [ `ajv --spec=draft2020 -s icon.schema.json ${filenamesToAjvOption(filenames)}`, diff --git a/package.json b/package.json index a2e8c4b43..31b44d1fe 100644 --- a/package.json +++ b/package.json @@ -73,9 +73,9 @@ "zod": "^3.25.67" }, "engines": { - "node": ">=23.0.0" + "node": ">=24.11.1" }, - "packageManager": "pnpm@10.23.0+sha512.21c4e5698002ade97e4efe8b8b4a89a8de3c85a37919f957e7a0f30f38fbc5bbdd05980ffe29179b2fb6e6e691242e098d945d1601772cad0fef5fb6411e2a4b", + "packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a", "pnpm": { "packageExtensions": { "vue-template-compiler": {