From c1ee3cb4d08fbb3f19761d31dbb45f77998b79f2 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Tue, 12 Nov 2024 13:25:08 +0100 Subject: [PATCH 01/15] refactor(CI/CD): replace shell by JavaScript --- .github/scripts/build-gh-page.js | 62 ++++++++++++++++++++++++ .github/scripts/build-gh-page.sh | 54 --------------------- .github/workflows/03-deploy-gh-pages.yml | 8 +-- 3 files changed, 67 insertions(+), 57 deletions(-) create mode 100644 .github/scripts/build-gh-page.js delete mode 100755 .github/scripts/build-gh-page.sh diff --git a/.github/scripts/build-gh-page.js b/.github/scripts/build-gh-page.js new file mode 100644 index 00000000000..735d91ae450 --- /dev/null +++ b/.github/scripts/build-gh-page.js @@ -0,0 +1,62 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import tar from 'tar'; + +const NAME = process.env.NAME; +const OWNER_NAME = process.env.OWNER_NAME; +const REPO_NAME = process.env.REPO_NAME; +const RELEASE = process.env.RELEASE === 'true'; +const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; + +if (!NAME) { + console.error('Error: Missing NAME variable'); + process.exit(1); +} + +console.log('โž• Create public dir'); +if (!fs.existsSync('public')) { + fs.mkdirSync('public'); +} + +console.log('๐Ÿ“ฅ Get gh-pages tar'); +fetch(`https://github.com/${OWNER_NAME}/${REPO_NAME}/tarball/gh-pages`) + .then((res) => { + if (!res.ok) { + throw new Error(`Failed to fetch tarball: ${res.statusText}`); + } + return res.arrayBuffer(); + }) + .then((buffer) => { + fs.writeFileSync('gh-pages.tar.gz', Buffer.from(buffer)); + console.log('๐Ÿ“ฆ Unpack Tar'); + return tar.x({ + file: 'gh-pages.tar.gz', + C: 'public', + strip: 1 + }); + }) + .then(() => { + if (RELEASE) { + console.log('๐Ÿ”ƒ Create redirect'); + const redirectContent = ``; + fs.writeFileSync( + path.join('public', 'index.html'), + redirectContent + ); + } + + console.log('๐Ÿ‘ฃ Move out dir'); + if (PRE_RELEASE || RELEASE) { + const versionDir = path.join('public', 'version'); + if (!fs.existsSync(versionDir)) { + console.log(' Make dir ./public/version'); + fs.mkdirSync(versionDir); + } + const nameDir = path.join(versionDir, NAME); + if (fs.existsSync(nameDir)) { + console.log(` Remove dir ./public/version/${NAME}`); + fs.rmdirSync(nameDir, { recursive: true }); + } + } + }) + .catch((err) => console.error(err)); diff --git a/.github/scripts/build-gh-page.sh b/.github/scripts/build-gh-page.sh deleted file mode 100755 index e4df3ffde06..00000000000 --- a/.github/scripts/build-gh-page.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -if [[ $NAME == "true" ]]; then - echo "Erro: Missing NAME variable" - exit 1 -fi - -echo "โž• Create public dir" -mkdir public - -echo "๐Ÿ“ฅ Get gh-pages tar" -curl -L https://github.com/"$OWNER_NAME"/"$REPO_NAME"/tarball/gh-pages --output gh-pages - -echo "๐Ÿ“ฆ Unpack Tar" -tar -zxf gh-pages -C public --strip-components 1 - -if [[ $RELEASE == "true" ]]; then - echo "๐Ÿ”ƒ Create redirect" - echo "" > public/index.html -fi - -echo "๐Ÿ‘ฃ Move out dir" -if [[ $PRE_RELEASE == "true" || $RELEASE == "true" ]]; then - if [[ ! -d ./public/version ]]; then - echo " Make dir ./public/version" - mkdir ./public/version - fi - if [[ -d ./public/version/"$NAME" ]]; then - echo " Remove dir ./public/version/$NAME" - rm -rf ./public/version/"$NAME" - fi - if [[ $RELEASE == "true" ]]; then - if [[ -d ./public/version/latest ]]; then - echo " Remove dir ./public/version/latest" - rm -rf ./public/version/latest - fi - mkdir ./public/version/latest - cp -RT ./out ./public/version/latest - echo " Copied dir out to ./public/version/latest" - fi - mv ./out ./public/version/"$NAME" - echo " Moved dir out to ./public/version/$NAME" -else - if [[ ! -d ./public/review ]]; then - echo " Make dir ./public/review" - mkdir ./public/review - fi - if [[ -d ./public/review/"$NAME" ]]; then - echo " Remove dir ./public/review/$NAME" - rm -rf ./public/review/"$NAME" - fi - mv ./out ./public/review/"$NAME" - echo " Moved dir out to ./public/review/$NAME" -fi diff --git a/.github/workflows/03-deploy-gh-pages.yml b/.github/workflows/03-deploy-gh-pages.yml index 70be335eaf8..9781002d246 100644 --- a/.github/workflows/03-deploy-gh-pages.yml +++ b/.github/workflows/03-deploy-gh-pages.yml @@ -62,15 +62,17 @@ jobs: script: return context?.payload?.repository?.name - name: ๐Ÿ”จ Build page + uses: actions/github-script@v7 env: RELEASE: ${{ inputs.release }} PRE_RELEASE: ${{ inputs.preRelease }} NAME: ${{ steps.extract.outputs.name }} REPO_NAME: ${{ steps.repo-name.outputs.result }} OWNER_NAME: ${{ github.repository_owner }} - run: | - chmod +rx ./.github/scripts/build-gh-page.sh - ./.github/scripts/build-gh-page.sh + with: + script: | + const { default: buildGitHubPage } = await import('${{ github.workspace }}/.github/scripts/build-gh-page.js'); + return await buildGitHubPage(); - name: ๐Ÿฅ… Deploy to GH-Pages uses: peaceiris/actions-gh-pages@v4 From d9d2fa448690ce587acef55f63254e6b18808e29 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Tue, 12 Nov 2024 14:53:12 +0100 Subject: [PATCH 02/15] refactor: we obviously need to provide and export that function --- .github/scripts/build-gh-page.js | 109 ++++++++++++++++--------------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/.github/scripts/build-gh-page.js b/.github/scripts/build-gh-page.js index 735d91ae450..98c7878daae 100644 --- a/.github/scripts/build-gh-page.js +++ b/.github/scripts/build-gh-page.js @@ -2,61 +2,64 @@ import fs from 'node:fs'; import path from 'node:path'; import tar from 'tar'; -const NAME = process.env.NAME; -const OWNER_NAME = process.env.OWNER_NAME; -const REPO_NAME = process.env.REPO_NAME; -const RELEASE = process.env.RELEASE === 'true'; -const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; +const buildGitHubPage = () => { + const NAME = process.env.NAME; + const OWNER_NAME = process.env.OWNER_NAME; + const REPO_NAME = process.env.REPO_NAME; + const RELEASE = process.env.RELEASE === 'true'; + const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; -if (!NAME) { - console.error('Error: Missing NAME variable'); - process.exit(1); -} + if (!NAME) { + console.error('Error: Missing NAME variable'); + process.exit(1); + } -console.log('โž• Create public dir'); -if (!fs.existsSync('public')) { - fs.mkdirSync('public'); -} + console.log('โž• Create public dir'); + if (!fs.existsSync('public')) { + fs.mkdirSync('public'); + } -console.log('๐Ÿ“ฅ Get gh-pages tar'); -fetch(`https://github.com/${OWNER_NAME}/${REPO_NAME}/tarball/gh-pages`) - .then((res) => { - if (!res.ok) { - throw new Error(`Failed to fetch tarball: ${res.statusText}`); - } - return res.arrayBuffer(); - }) - .then((buffer) => { - fs.writeFileSync('gh-pages.tar.gz', Buffer.from(buffer)); - console.log('๐Ÿ“ฆ Unpack Tar'); - return tar.x({ - file: 'gh-pages.tar.gz', - C: 'public', - strip: 1 - }); - }) - .then(() => { - if (RELEASE) { - console.log('๐Ÿ”ƒ Create redirect'); - const redirectContent = ``; - fs.writeFileSync( - path.join('public', 'index.html'), - redirectContent - ); - } - - console.log('๐Ÿ‘ฃ Move out dir'); - if (PRE_RELEASE || RELEASE) { - const versionDir = path.join('public', 'version'); - if (!fs.existsSync(versionDir)) { - console.log(' Make dir ./public/version'); - fs.mkdirSync(versionDir); + console.log('๐Ÿ“ฅ Get gh-pages tar'); + fetch(`https://github.com/${OWNER_NAME}/${REPO_NAME}/tarball/gh-pages`) + .then((res) => { + if (!res.ok) { + throw new Error(`Failed to fetch tarball: ${res.statusText}`); + } + return res.arrayBuffer(); + }) + .then((buffer) => { + fs.writeFileSync('gh-pages.tar.gz', Buffer.from(buffer)); + console.log('๐Ÿ“ฆ Unpack Tar'); + return tar.x({ + file: 'gh-pages.tar.gz', + C: 'public', + strip: 1 + }); + }) + .then(() => { + if (RELEASE) { + console.log('๐Ÿ”ƒ Create redirect'); + const redirectContent = ``; + fs.writeFileSync( + path.join('public', 'index.html'), + redirectContent + ); } - const nameDir = path.join(versionDir, NAME); - if (fs.existsSync(nameDir)) { - console.log(` Remove dir ./public/version/${NAME}`); - fs.rmdirSync(nameDir, { recursive: true }); + + console.log('๐Ÿ‘ฃ Move out dir'); + if (PRE_RELEASE || RELEASE) { + const versionDir = path.join('public', 'version'); + if (!fs.existsSync(versionDir)) { + console.log(' Make dir ./public/version'); + fs.mkdirSync(versionDir); + } + const nameDir = path.join(versionDir, NAME); + if (fs.existsSync(nameDir)) { + console.log(` Remove dir ./public/version/${NAME}`); + fs.rmdirSync(nameDir, { recursive: true }); + } } - } - }) - .catch((err) => console.error(err)); + }) + .catch((err) => console.error(err)); +}; +export default buildGitHubPage; From 83298f51a11c7355712a6b8183829bb92691f207 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 14:45:07 +0100 Subject: [PATCH 03/15] refactor: removed that file again --- .github/scripts/build-gh-page.sh | 54 -------------------------------- 1 file changed, 54 deletions(-) delete mode 100755 .github/scripts/build-gh-page.sh diff --git a/.github/scripts/build-gh-page.sh b/.github/scripts/build-gh-page.sh deleted file mode 100755 index 0eb12b5f75c..00000000000 --- a/.github/scripts/build-gh-page.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -if [[ $NAME == "true" ]]; then - echo "Erro: Missing NAME variable" - exit 1 -fi - -echo "โž• Create public dir" -mkdir public - -echo "๐Ÿ“ฅ Get gh-pages tar" -curl -L https://github.com/"$OWNER_NAME"/"$REPO_NAME"/tarball/gh-pages --output gh-pages - -echo "๐Ÿ“ฆ Unpack Tar" -tar -zxf gh-pages -C public --strip-components 1 - -if [[ $RELEASE == "true" ]]; then - echo "๐Ÿ”ƒ Create redirect" - echo "" > public/index.html -fi - -echo "๐Ÿ‘ฃ Move out dir" -if [[ $PRE_RELEASE == "true" || $RELEASE == "true" ]]; then - if [[ ! -d ./public/version ]]; then - echo " Make dir ./public/version" - mkdir ./public/version - fi - if [[ -d ./public/version/"$NAME" ]]; then - echo " Remove dir ./public/version/$NAME" - rm -rf ./public/version/"$NAME" - fi - if [[ $RELEASE == "true" ]]; then - if [[ -d ./public/version/latest ]]; then - echo " Remove dir ./public/version/latest" - rm -rf ./public/version/latest - fi - mkdir ./public/version/latest - cp -RT ./out ./public/version/latest - echo " Copied dir out to ./public/version/latest" - fi - mv ./out ./public/version/"$NAME" - echo " Moved dir out to ./public/version/$NAME" -else - if [[ ! -d ./public/review ]]; then - echo " Make dir ./public/review" - mkdir ./public/review - fi - if [[ -d ./public/review/"$NAME" ]]; then - echo " Remove dir ./public/review/$NAME" - rm -rf ./public/review/"$NAME" - fi - mv ./out ./public/review/"$NAME" - echo " Moved dir out to ./public/review/$NAME" -fi From a95e1727ac2191c59fec4ae20f30a0c1dc08c8bc Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 14:46:25 +0100 Subject: [PATCH 04/15] refactor: migrated another script --- .github/scripts/get-release.js | 22 ++++++++++++++++++++ .github/scripts/get-release.sh | 17 --------------- .github/workflows/01-get-publish-version.yml | 7 ++++++- 3 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 .github/scripts/get-release.js delete mode 100644 .github/scripts/get-release.sh diff --git a/.github/scripts/get-release.js b/.github/scripts/get-release.js new file mode 100644 index 00000000000..d5a4ea1a98e --- /dev/null +++ b/.github/scripts/get-release.js @@ -0,0 +1,22 @@ +import process from 'process'; + +const GITHUB_REF = process.env.GITHUB_REF; +const GITHUB_ACTOR = process.env.GITHUB_ACTOR; +const GITHUB_COMMITISH = process.env.GITHUB_COMMITISH; +const GITHUB_PRE_RELEASE = process.env.GITHUB_PRE_RELEASE === 'true'; + +if (GITHUB_REF && GITHUB_REF.startsWith('refs/tags/v')) { + if (GITHUB_ACTOR !== 'dependabot[bot]') { + if (GITHUB_COMMITISH === 'main' && !GITHUB_PRE_RELEASE) { + console.log('RELEASE'); + } else { + console.log('PRE_RELEASE'); + } + } else { + console.error('Dependabot has no permission to publish!'); + process.exit(1); + } +} else { + console.error("Your tag has to start with 'v'"); + process.exit(1); +} diff --git a/.github/scripts/get-release.sh b/.github/scripts/get-release.sh deleted file mode 100644 index 0b2b500d9b8..00000000000 --- a/.github/scripts/get-release.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -if [[ $GITHUB_REF == refs/tags/v* ]]; then - if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]]; then - if [[ $GITHUB_COMMITISH == 'main' && $GITHUB_PRE_RELEASE == false ]]; then - echo "RELEASE" - else - echo "PRE_RELEASE" - fi - else - echo "Dependabot has no permission to publish!" - exit 1 - fi -else - echo "Your tag has to start with 'v'" - exit 1 -fi diff --git a/.github/workflows/01-get-publish-version.yml b/.github/workflows/01-get-publish-version.yml index 4a0caf59e4d..b6ad77d5eba 100644 --- a/.github/workflows/01-get-publish-version.yml +++ b/.github/workflows/01-get-publish-version.yml @@ -31,9 +31,14 @@ jobs: uses: ./.github/actions/npm-cache - name: ๐Ÿ’ƒ๐Ÿ•บ Check if release or prerelease + uses: actions/github-script@v7 id: releaseCheck + with: + script: | + const { default: getRelease } = await import('${{ github.workspace }}/.github/scripts/get-release.js'); + return await getRelease(); run: | - chmod +rx ./.github/scripts/get-release.sh + chmod +rx ./.github/scripts/ OUTPUT=$(./.github/scripts/get-release.sh) if [[ $OUTPUT == "RELEASE" ]]; then From cae6f8073b5f12e6d5a8e5bd297eb16af9d49358 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 14:56:25 +0100 Subject: [PATCH 05/15] refactor: removed incorrect import --- .github/scripts/get-release.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/scripts/get-release.js b/.github/scripts/get-release.js index d5a4ea1a98e..bf2730ae0c3 100644 --- a/.github/scripts/get-release.js +++ b/.github/scripts/get-release.js @@ -1,5 +1,3 @@ -import process from 'process'; - const GITHUB_REF = process.env.GITHUB_REF; const GITHUB_ACTOR = process.env.GITHUB_ACTOR; const GITHUB_COMMITISH = process.env.GITHUB_COMMITISH; From 7f6d2b48009eb0e80d6fa59d99a11021c9d86d34 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 14:56:50 +0100 Subject: [PATCH 06/15] chore: removed leftover --- .github/workflows/01-get-publish-version.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/01-get-publish-version.yml b/.github/workflows/01-get-publish-version.yml index b6ad77d5eba..71e9b452841 100644 --- a/.github/workflows/01-get-publish-version.yml +++ b/.github/workflows/01-get-publish-version.yml @@ -38,7 +38,6 @@ jobs: const { default: getRelease } = await import('${{ github.workspace }}/.github/scripts/get-release.js'); return await getRelease(); run: | - chmod +rx ./.github/scripts/ OUTPUT=$(./.github/scripts/get-release.sh) if [[ $OUTPUT == "RELEASE" ]]; then From 6d175bfaf188de732a4a691f8d4438ea65723a53 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 15:07:10 +0100 Subject: [PATCH 07/15] refactor: this was way too complicated --- .github/workflows/01-get-publish-version.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/01-get-publish-version.yml b/.github/workflows/01-get-publish-version.yml index 71e9b452841..1165fa876c6 100644 --- a/.github/workflows/01-get-publish-version.yml +++ b/.github/workflows/01-get-publish-version.yml @@ -31,14 +31,9 @@ jobs: uses: ./.github/actions/npm-cache - name: ๐Ÿ’ƒ๐Ÿ•บ Check if release or prerelease - uses: actions/github-script@v7 id: releaseCheck - with: - script: | - const { default: getRelease } = await import('${{ github.workspace }}/.github/scripts/get-release.js'); - return await getRelease(); run: | - OUTPUT=$(./.github/scripts/get-release.sh) + OUTPUT=$(node .github/scripts/get-release.js) if [[ $OUTPUT == "RELEASE" ]]; then echo "release=true" >> $GITHUB_OUTPUT @@ -64,7 +59,6 @@ jobs: PRE_RELEASE: ${{ steps.releaseCheck.outputs.preRelease }} TAG: ${{ steps.extractTag.outputs.tag }} run: | - chmod +rx ./.github/scripts/package-version.sh OUTPUT=$(./.github/scripts/package-version.sh) echo "version=$OUTPUT" >> $GITHUB_OUTPUT From 17dd84d3c5debe8b938edd998a25e9cda65a3c93 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 15:08:11 +0100 Subject: [PATCH 08/15] refactor: migrated another script --- .github/scripts/package-version.js | 36 ++++++++++++++++++++ .github/scripts/package-version.sh | 22 ------------ .github/workflows/01-get-publish-version.yml | 2 +- 3 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 .github/scripts/package-version.js delete mode 100644 .github/scripts/package-version.sh diff --git a/.github/scripts/package-version.js b/.github/scripts/package-version.js new file mode 100644 index 00000000000..1a6953656dd --- /dev/null +++ b/.github/scripts/package-version.js @@ -0,0 +1,36 @@ +import findVersions from 'find-versions'; + +const TAG = process.env.TAG; +const RELEASE = process.env.RELEASE === 'true'; +const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; +const GITHUB_SHA = process.env.GITHUB_SHA; + +function getSemverVersion(tag) { + return findVersions(tag, { loose: true })[0].toString().trim(); +} + +const SEMVER_VERSION = getSemverVersion(TAG); + +if (RELEASE) { + if (SEMVER_VERSION.includes('-')) { + console.error( + `Version ${SEMVER_VERSION} contains hyphen, maybe you forgot to check the prerelease checkbox in GitHub release draft. A release should not have a hyphen!` + ); + process.exit(1); + } + console.log(SEMVER_VERSION); +} else if (PRE_RELEASE) { + if (SEMVER_VERSION.includes('-')) { + const GITHUB_SHA_SHORT = GITHUB_SHA.substring(0, 7); + const VALID_SEMVER_VERSION = `${SEMVER_VERSION}-${GITHUB_SHA_SHORT}`; + console.log(VALID_SEMVER_VERSION); + } else { + console.error( + `Version ${SEMVER_VERSION} doesn't contain a hyphen. A prerelease should have a hyphen!` + ); + process.exit(1); + } +} else { + console.error('nothing found in environment for RELEASE or PRE_RELEASE'); + process.exit(1); +} diff --git a/.github/scripts/package-version.sh b/.github/scripts/package-version.sh deleted file mode 100644 index 34327d70f3c..00000000000 --- a/.github/scripts/package-version.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -SEMVER_VERSION=$(npx find-versions-cli "$TAG") -if [[ $RELEASE == "true" ]]; then - if [[ $SEMVER_VERSION == *-* ]]; then - echo "Version $SEMVER_VERSION contains hyphen, maybe you forgot to check the prerelease checkbox in GitHub release draft. A release should not have a hyphen!" - exit 1 - fi - echo "$SEMVER_VERSION" -elif [[ $PRE_RELEASE == "true" ]]; then - if [[ $SEMVER_VERSION == *-* ]]; then - GITHUB_SHA_SHORT=$(echo "$GITHUB_SHA" | cut -c1-7) - VALID_SEMVER_VERSION=$(echo "$SEMVER_VERSION"-"$GITHUB_SHA_SHORT") - echo "$VALID_SEMVER_VERSION" - else - echo "Version $SEMVER_VERSION doesn't contain a hyphen. A prerelease should have a hyphen!" - exit 1 - fi -else - echo "nothing found in environment for REALEASE or PRE_RELEASE" - exit 1 -fi diff --git a/.github/workflows/01-get-publish-version.yml b/.github/workflows/01-get-publish-version.yml index 1165fa876c6..e41a61c50a0 100644 --- a/.github/workflows/01-get-publish-version.yml +++ b/.github/workflows/01-get-publish-version.yml @@ -59,7 +59,7 @@ jobs: PRE_RELEASE: ${{ steps.releaseCheck.outputs.preRelease }} TAG: ${{ steps.extractTag.outputs.tag }} run: | - OUTPUT=$(./.github/scripts/package-version.sh) + OUTPUT=$(node .github/scripts/package-version.js) echo "version=$OUTPUT" >> $GITHUB_OUTPUT - name: ๐ŸŒณ Log Valid Version From 54a04750e63d43996d18efde4a16e850baf6e232 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 16:11:41 +0100 Subject: [PATCH 09/15] refactor: added dependency --- package-lock.json | 92 ++++++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 3efe4c0156f..dd36b76c3e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "cross-env": "^7.0.3", "dotenv": "^16.4.7", "eslint-plugin-prettier": "^5.2.1", + "find-versions": "^6.0.0", "fs-extra": "^11.2.0", "glob": "^11.0.0", "http-server": "14.1.1", @@ -15257,6 +15258,19 @@ "node": ">=16" } }, + "node_modules/convert-hrtime": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/convert-hrtime/-/convert-hrtime-5.0.0.tgz", + "integrity": "sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -19246,6 +19260,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-versions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-6.0.0.tgz", + "integrity": "sha512-2kCCtc+JvcZ86IGAz3Z2Y0A1baIz9fL31pH/0S1IqZr9Iwnjq8izfPtrCyQKO6TLMPELLsQMre7VDqeIKCsHkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver-regex": "^4.0.5", + "super-regex": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -19597,6 +19628,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/function-timeout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/function-timeout/-/function-timeout-1.0.2.tgz", + "integrity": "sha512-939eZS4gJ3htTHAldmyyuzlrD58P03fHG49v2JfFXbV6OhvZKRC9j2yAtdHw/zrp2zXHuv05zMIy40F0ge7spA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/function.prototype.name": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", @@ -32028,6 +32072,19 @@ "node": ">=10" } }, + "node_modules/semver-regex": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", + "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/send": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", @@ -33638,6 +33695,23 @@ "node": ">=8" } }, + "node_modules/super-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/super-regex/-/super-regex-1.0.0.tgz", + "integrity": "sha512-CY8u7DtbvucKuquCmOFEKhr9Besln7n9uN8eFbwcoGYWXOMW07u2o8njWaiXt11ylS3qoGF55pILjRmPlbodyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-timeout": "^1.0.1", + "time-span": "^5.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/superjson": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz", @@ -34282,6 +34356,22 @@ "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "dev": true }, + "node_modules/time-span": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/time-span/-/time-span-5.1.0.tgz", + "integrity": "sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "convert-hrtime": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", @@ -39891,7 +39981,7 @@ }, "showcases/next-showcase": { "dependencies": { - "next": "*", + "next": "latest", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/package.json b/package.json index 74f623d3dea..bfe984144e2 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "cross-env": "^7.0.3", "dotenv": "^16.4.7", "eslint-plugin-prettier": "^5.2.1", + "find-versions": "^6.0.0", "fs-extra": "^11.2.0", "glob": "^11.0.0", "http-server": "14.1.1", From 95d0bbd5da6d48334c3228e5d641591a50cc276c Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 16:45:17 +0100 Subject: [PATCH 10/15] Revert "refactor: added dependency" This reverts commit 54a04750e63d43996d18efde4a16e850baf6e232. --- package-lock.json | 92 +---------------------------------------------- package.json | 1 - 2 files changed, 1 insertion(+), 92 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd36b76c3e1..3efe4c0156f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,6 @@ "cross-env": "^7.0.3", "dotenv": "^16.4.7", "eslint-plugin-prettier": "^5.2.1", - "find-versions": "^6.0.0", "fs-extra": "^11.2.0", "glob": "^11.0.0", "http-server": "14.1.1", @@ -15258,19 +15257,6 @@ "node": ">=16" } }, - "node_modules/convert-hrtime": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/convert-hrtime/-/convert-hrtime-5.0.0.tgz", - "integrity": "sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -19260,23 +19246,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-versions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-6.0.0.tgz", - "integrity": "sha512-2kCCtc+JvcZ86IGAz3Z2Y0A1baIz9fL31pH/0S1IqZr9Iwnjq8izfPtrCyQKO6TLMPELLsQMre7VDqeIKCsHkA==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver-regex": "^4.0.5", - "super-regex": "^1.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -19628,19 +19597,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/function-timeout": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/function-timeout/-/function-timeout-1.0.2.tgz", - "integrity": "sha512-939eZS4gJ3htTHAldmyyuzlrD58P03fHG49v2JfFXbV6OhvZKRC9j2yAtdHw/zrp2zXHuv05zMIy40F0ge7spA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/function.prototype.name": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", @@ -32072,19 +32028,6 @@ "node": ">=10" } }, - "node_modules/semver-regex": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", - "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/send": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", @@ -33695,23 +33638,6 @@ "node": ">=8" } }, - "node_modules/super-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/super-regex/-/super-regex-1.0.0.tgz", - "integrity": "sha512-CY8u7DtbvucKuquCmOFEKhr9Besln7n9uN8eFbwcoGYWXOMW07u2o8njWaiXt11ylS3qoGF55pILjRmPlbodyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-timeout": "^1.0.1", - "time-span": "^5.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/superjson": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz", @@ -34356,22 +34282,6 @@ "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "dev": true }, - "node_modules/time-span": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/time-span/-/time-span-5.1.0.tgz", - "integrity": "sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "convert-hrtime": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", @@ -39981,7 +39891,7 @@ }, "showcases/next-showcase": { "dependencies": { - "next": "latest", + "next": "*", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/package.json b/package.json index bfe984144e2..74f623d3dea 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,6 @@ "cross-env": "^7.0.3", "dotenv": "^16.4.7", "eslint-plugin-prettier": "^5.2.1", - "find-versions": "^6.0.0", "fs-extra": "^11.2.0", "glob": "^11.0.0", "http-server": "14.1.1", From 4bdf083b06fd6b394069f548874eed9a241d687d Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 16:46:54 +0100 Subject: [PATCH 11/15] Reapply "refactor: added dependency" This reverts commit 95d0bbd5da6d48334c3228e5d641591a50cc276c. --- package-lock.json | 92 ++++++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 3efe4c0156f..dd36b76c3e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "cross-env": "^7.0.3", "dotenv": "^16.4.7", "eslint-plugin-prettier": "^5.2.1", + "find-versions": "^6.0.0", "fs-extra": "^11.2.0", "glob": "^11.0.0", "http-server": "14.1.1", @@ -15257,6 +15258,19 @@ "node": ">=16" } }, + "node_modules/convert-hrtime": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/convert-hrtime/-/convert-hrtime-5.0.0.tgz", + "integrity": "sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -19246,6 +19260,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-versions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-6.0.0.tgz", + "integrity": "sha512-2kCCtc+JvcZ86IGAz3Z2Y0A1baIz9fL31pH/0S1IqZr9Iwnjq8izfPtrCyQKO6TLMPELLsQMre7VDqeIKCsHkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver-regex": "^4.0.5", + "super-regex": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -19597,6 +19628,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/function-timeout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/function-timeout/-/function-timeout-1.0.2.tgz", + "integrity": "sha512-939eZS4gJ3htTHAldmyyuzlrD58P03fHG49v2JfFXbV6OhvZKRC9j2yAtdHw/zrp2zXHuv05zMIy40F0ge7spA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/function.prototype.name": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", @@ -32028,6 +32072,19 @@ "node": ">=10" } }, + "node_modules/semver-regex": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", + "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/send": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", @@ -33638,6 +33695,23 @@ "node": ">=8" } }, + "node_modules/super-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/super-regex/-/super-regex-1.0.0.tgz", + "integrity": "sha512-CY8u7DtbvucKuquCmOFEKhr9Besln7n9uN8eFbwcoGYWXOMW07u2o8njWaiXt11ylS3qoGF55pILjRmPlbodyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-timeout": "^1.0.1", + "time-span": "^5.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/superjson": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz", @@ -34282,6 +34356,22 @@ "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "dev": true }, + "node_modules/time-span": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/time-span/-/time-span-5.1.0.tgz", + "integrity": "sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "convert-hrtime": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", @@ -39891,7 +39981,7 @@ }, "showcases/next-showcase": { "dependencies": { - "next": "*", + "next": "latest", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/package.json b/package.json index 74f623d3dea..bfe984144e2 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "cross-env": "^7.0.3", "dotenv": "^16.4.7", "eslint-plugin-prettier": "^5.2.1", + "find-versions": "^6.0.0", "fs-extra": "^11.2.0", "glob": "^11.0.0", "http-server": "14.1.1", From cdd8dc3dc4ced1894565b9c2469e38c6e8e1b1aa Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 17:22:30 +0100 Subject: [PATCH 12/15] refactor: corrected this implementation --- .github/scripts/package-version.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/package-version.js b/.github/scripts/package-version.js index 1a6953656dd..5b6ac3cad06 100644 --- a/.github/scripts/package-version.js +++ b/.github/scripts/package-version.js @@ -6,7 +6,7 @@ const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; const GITHUB_SHA = process.env.GITHUB_SHA; function getSemverVersion(tag) { - return findVersions(tag, { loose: true })[0].toString().trim(); + return findVersions(tag); } const SEMVER_VERSION = getSemverVersion(TAG); From dfdc409ee5d79d0fe95d1426eccaf8b217ca36be Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Jan 2025 17:52:29 +0100 Subject: [PATCH 13/15] chore: another try --- .github/scripts/package-version.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/scripts/package-version.js b/.github/scripts/package-version.js index 5b6ac3cad06..4341a866fe8 100644 --- a/.github/scripts/package-version.js +++ b/.github/scripts/package-version.js @@ -5,11 +5,7 @@ const RELEASE = process.env.RELEASE === 'true'; const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; const GITHUB_SHA = process.env.GITHUB_SHA; -function getSemverVersion(tag) { - return findVersions(tag); -} - -const SEMVER_VERSION = getSemverVersion(TAG); +const SEMVER_VERSION = findVersions(TAG).toString(); if (RELEASE) { if (SEMVER_VERSION.includes('-')) { From 685847ac9e10f77eba2a603197f6fa434cd82f7b Mon Sep 17 00:00:00 2001 From: Nicolas Merget Date: Mon, 27 Jan 2025 12:10:10 +0100 Subject: [PATCH 14/15] chore: test typescript support for github scripts --- .github/scripts/build-gh-page.js | 65 --- .github/scripts/package-version.js | 32 -- .github/scripts/publish-npm.sh | 66 --- .github/workflows/01-get-publish-version.yml | 2 +- .github/workflows/03-deploy-gh-pages.yml | 7 +- .github/workflows/03-publish-packages.yml | 3 +- .xo-config.cjs | 6 +- package-lock.json | 523 ++++++++++++++++-- package.json | 2 + scripts/github/build-gh-page.js | 58 ++ .../github}/cleanup-gh-pages.js | 0 .../github}/get-playwright-version.js | 0 .../scripts => scripts/github}/get-release.js | 0 scripts/github/package-version.ts | 48 ++ scripts/github/publish-npm.js | 91 +++ scripts/package.json | 1 + scripts/tests/github/package-version.spec.ts | 22 + scripts/vitest.config.ts | 7 + 18 files changed, 725 insertions(+), 208 deletions(-) delete mode 100644 .github/scripts/build-gh-page.js delete mode 100644 .github/scripts/package-version.js delete mode 100644 .github/scripts/publish-npm.sh create mode 100644 scripts/github/build-gh-page.js rename {.github/scripts => scripts/github}/cleanup-gh-pages.js (100%) rename {.github/scripts => scripts/github}/get-playwright-version.js (100%) rename {.github/scripts => scripts/github}/get-release.js (100%) create mode 100644 scripts/github/package-version.ts create mode 100644 scripts/github/publish-npm.js create mode 100644 scripts/tests/github/package-version.spec.ts create mode 100644 scripts/vitest.config.ts diff --git a/.github/scripts/build-gh-page.js b/.github/scripts/build-gh-page.js deleted file mode 100644 index 98c7878daae..00000000000 --- a/.github/scripts/build-gh-page.js +++ /dev/null @@ -1,65 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import tar from 'tar'; - -const buildGitHubPage = () => { - const NAME = process.env.NAME; - const OWNER_NAME = process.env.OWNER_NAME; - const REPO_NAME = process.env.REPO_NAME; - const RELEASE = process.env.RELEASE === 'true'; - const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; - - if (!NAME) { - console.error('Error: Missing NAME variable'); - process.exit(1); - } - - console.log('โž• Create public dir'); - if (!fs.existsSync('public')) { - fs.mkdirSync('public'); - } - - console.log('๐Ÿ“ฅ Get gh-pages tar'); - fetch(`https://github.com/${OWNER_NAME}/${REPO_NAME}/tarball/gh-pages`) - .then((res) => { - if (!res.ok) { - throw new Error(`Failed to fetch tarball: ${res.statusText}`); - } - return res.arrayBuffer(); - }) - .then((buffer) => { - fs.writeFileSync('gh-pages.tar.gz', Buffer.from(buffer)); - console.log('๐Ÿ“ฆ Unpack Tar'); - return tar.x({ - file: 'gh-pages.tar.gz', - C: 'public', - strip: 1 - }); - }) - .then(() => { - if (RELEASE) { - console.log('๐Ÿ”ƒ Create redirect'); - const redirectContent = ``; - fs.writeFileSync( - path.join('public', 'index.html'), - redirectContent - ); - } - - console.log('๐Ÿ‘ฃ Move out dir'); - if (PRE_RELEASE || RELEASE) { - const versionDir = path.join('public', 'version'); - if (!fs.existsSync(versionDir)) { - console.log(' Make dir ./public/version'); - fs.mkdirSync(versionDir); - } - const nameDir = path.join(versionDir, NAME); - if (fs.existsSync(nameDir)) { - console.log(` Remove dir ./public/version/${NAME}`); - fs.rmdirSync(nameDir, { recursive: true }); - } - } - }) - .catch((err) => console.error(err)); -}; -export default buildGitHubPage; diff --git a/.github/scripts/package-version.js b/.github/scripts/package-version.js deleted file mode 100644 index 4341a866fe8..00000000000 --- a/.github/scripts/package-version.js +++ /dev/null @@ -1,32 +0,0 @@ -import findVersions from 'find-versions'; - -const TAG = process.env.TAG; -const RELEASE = process.env.RELEASE === 'true'; -const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; -const GITHUB_SHA = process.env.GITHUB_SHA; - -const SEMVER_VERSION = findVersions(TAG).toString(); - -if (RELEASE) { - if (SEMVER_VERSION.includes('-')) { - console.error( - `Version ${SEMVER_VERSION} contains hyphen, maybe you forgot to check the prerelease checkbox in GitHub release draft. A release should not have a hyphen!` - ); - process.exit(1); - } - console.log(SEMVER_VERSION); -} else if (PRE_RELEASE) { - if (SEMVER_VERSION.includes('-')) { - const GITHUB_SHA_SHORT = GITHUB_SHA.substring(0, 7); - const VALID_SEMVER_VERSION = `${SEMVER_VERSION}-${GITHUB_SHA_SHORT}`; - console.log(VALID_SEMVER_VERSION); - } else { - console.error( - `Version ${SEMVER_VERSION} doesn't contain a hyphen. A prerelease should have a hyphen!` - ); - process.exit(1); - } -} else { - console.error('nothing found in environment for RELEASE or PRE_RELEASE'); - process.exit(1); -} diff --git a/.github/scripts/publish-npm.sh b/.github/scripts/publish-npm.sh deleted file mode 100644 index 118e0e4d56d..00000000000 --- a/.github/scripts/publish-npm.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash - -if [[ -z $VALID_SEMVER_VERSION ]]; then - echo "Version is missing!" - exit 1 -fi - -if [[ $RELEASE == 'false' && $PRE_RELEASE == 'false' ]]; then - echo "RELEASE and PRE_RELEASE are false, there should be an error in the pipeline!" - exit 1 -fi - -echo "๐Ÿ›  Forge all packages version numbers" -echo "which package version ?: $VALID_SEMVER_VERSION" - -echo "goto build-outputs" -cd build-outputs || exit 1 - -# TODO: Add other build as well -for PACKAGE in 'foundations' 'migration' 'components' 'ngx-components' 'react-components' 'v-components' 'web-components'; do - echo "Start $PACKAGE bundle:" - - echo "๐Ÿ†š Update Version" - npm version --no-git-tag-version "$VALID_SEMVER_VERSION" --workspace=@db-ui/"$PACKAGE" - - if [[ $PACKAGE != 'foundations' && $PACKAGE != 'migration' ]]; then - echo "๐Ÿ•ต๏ธโ€ Set foundations dependency" - npm pkg set dependencies.@db-ui/foundations="$VALID_SEMVER_VERSION" --workspace=@db-ui/"$PACKAGE" - if [[ $PACKAGE != 'components' ]]; then - npm pkg set dependencies.@db-ui/components="$VALID_SEMVER_VERSION" --workspace=@db-ui/"$PACKAGE" - fi - fi - - echo "๐Ÿ“ฆ Create npm package" - npm pack --quiet --workspace=@db-ui/"$PACKAGE" -done - -TAG="latest" -if [[ $PRE_RELEASE == 'true' ]]; then - TAG="next" -fi - -echo "๐Ÿ“ฐ Publish Package to Registry with tag: $TAG" -for REGISTRY in 'GITHUB' 'NPM'; do - echo "๐Ÿ”’ Authenticate $REGISTRY NPM Registry" - - if [[ $REGISTRY == 'GITHUB' ]]; then - npm config set @db-ui:registry https://npm.pkg.github.com - npm set //npm.pkg.github.com/:_authToken "$GPR_TOKEN" - echo "๐Ÿ”‘ Authenticated with GitHub" - elif [[ $REGISTRY == 'NPM' ]]; then - npm config set @db-ui:registry https://registry.npmjs.org/ - npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN" - echo "๐Ÿ”‘ Authenticated with NPM" - else - echo "Could not authenticate with $REGISTRY" - exit 1 - fi - - # TODO: Add other build as well - for PACKAGE in 'foundations' 'migration' 'components' 'ngx-components' 'react-components' 'v-components' 'web-components'; do - echo "โคด Publish $PACKAGE with tag $TAG to $REGISTRY" - # https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow - npm publish --tag "$TAG" db-ui-"$PACKAGE"-"$VALID_SEMVER_VERSION".tgz --provenance - done -done diff --git a/.github/workflows/01-get-publish-version.yml b/.github/workflows/01-get-publish-version.yml index e41a61c50a0..f67f0e1a392 100644 --- a/.github/workflows/01-get-publish-version.yml +++ b/.github/workflows/01-get-publish-version.yml @@ -59,7 +59,7 @@ jobs: PRE_RELEASE: ${{ steps.releaseCheck.outputs.preRelease }} TAG: ${{ steps.extractTag.outputs.tag }} run: | - OUTPUT=$(node .github/scripts/package-version.js) + OUTPUT=$(tsx scripts/github/package-version.ts) echo "version=$OUTPUT" >> $GITHUB_OUTPUT - name: ๐ŸŒณ Log Valid Version diff --git a/.github/workflows/03-deploy-gh-pages.yml b/.github/workflows/03-deploy-gh-pages.yml index f2a4e6651dd..8534b33ad71 100644 --- a/.github/workflows/03-deploy-gh-pages.yml +++ b/.github/workflows/03-deploy-gh-pages.yml @@ -62,17 +62,14 @@ jobs: script: return context?.payload?.repository?.name - name: ๐Ÿ”จ Build page - uses: actions/github-script@v7 env: RELEASE: ${{ inputs.release }} PRE_RELEASE: ${{ inputs.preRelease }} NAME: ${{ steps.extract.outputs.name }} REPO_NAME: ${{ steps.repo-name.outputs.result }} OWNER_NAME: ${{ github.repository_owner }} - with: - script: | - const { default: buildGitHubPage } = await import('${{ github.workspace }}/.github/scripts/build-gh-page.js'); - return await buildGitHubPage(); + run: | + tsx .github/scripts/build-gh-page.js - name: ๐Ÿฅ… Deploy to GH-Pages uses: peaceiris/actions-gh-pages@v4 diff --git a/.github/workflows/03-publish-packages.yml b/.github/workflows/03-publish-packages.yml index 81f1be2ea48..efb65ad6cd2 100644 --- a/.github/workflows/03-publish-packages.yml +++ b/.github/workflows/03-publish-packages.yml @@ -38,8 +38,7 @@ jobs: - name: ๐Ÿ“ฐ Publish to NPM Registries run: | - chmod +rx ./.github/scripts/publish-npm.sh - ./.github/scripts/publish-npm.sh + tsx .github/scripts/publish-npm.js env: RELEASE: ${{ inputs.release }} PRE_RELEASE: ${{ inputs.preRelease }} diff --git a/.xo-config.cjs b/.xo-config.cjs index 60542fdfc0d..c1294404b93 100644 --- a/.xo-config.cjs +++ b/.xo-config.cjs @@ -1,6 +1,10 @@ module.exports = { prettier: true, - ignores: ['./showcases/nuxt-showcase/**', './packages/migration/**'], + ignores: [ + './showcases/nuxt-showcase/**', + './packages/migration/**', + './scripts/**' + ], overrides: [ { files: ['./showcases/angular-showcase/**'], diff --git a/package-lock.json b/package-lock.json index dd36b76c3e1..6dc156df23e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,10 +53,12 @@ "stylelint-config-sass-guidelines": "12.1.0", "stylelint-config-standard": "^36.0.0", "stylelint-use-logical": "2.1.2", + "tar": "^7.4.3", "tslib": "^2.8.1", "tsx": "^4.19.2", "typescript": "^5.4.5", "validate-branch-name": "^1.3.1", + "vitest": "^2.1.8", "xo": "^0.60.0" } }, @@ -6530,6 +6532,18 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "dev": true, + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -6812,6 +6826,36 @@ "node": ">= 6.0.0" } }, + "node_modules/@mapbox/node-pre-gyp/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@mapbox/node-pre-gyp/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6866,6 +6910,25 @@ "semver": "bin/semver.js" } }, + "node_modules/@mapbox/node-pre-gyp/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@mapbox/node-pre-gyp/node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -6881,6 +6944,22 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@mapbox/node-pre-gyp/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@mdx-js/loader": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@mdx-js/loader/-/loader-3.1.0.tgz", @@ -14099,6 +14178,15 @@ "balanced-match": "^1.0.0" } }, + "node_modules/cacache/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/cacache/node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -14155,6 +14243,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/cacache/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/cacache/node_modules/path-scurry": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", @@ -14171,6 +14271,56 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/cacache/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cacache/node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cacache/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacache/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -19879,6 +20029,71 @@ "giget": "dist/cli.mjs" } }, + "node_modules/giget/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/giget/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/giget/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/giget/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/giget/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/giget/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/git-config-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/git-config-path/-/git-config-path-2.0.0.tgz", @@ -27127,6 +27342,39 @@ "balanced-match": "^1.0.0" } }, + "node_modules/node-gyp/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-gyp/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/node-gyp/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/node-gyp/node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -27192,6 +27440,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/node-gyp/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-gyp/node_modules/nopt": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.1.tgz", @@ -27232,6 +27492,32 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/node-gyp/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-gyp/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/node-gyp/node_modules/which": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", @@ -28703,6 +28989,77 @@ "node": "^16.14.0 || >=18.0.0" } }, + "node_modules/pacote/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/pacote/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pacote/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pacote/node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/pacote/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pacote/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", @@ -34044,19 +34401,20 @@ } }, "node_modules/tar": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", - "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz", + "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==", + "dev": true, "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.0.1", + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" }, "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/tar-fs": { @@ -34087,53 +34445,146 @@ "node": ">=6" } }, + "node_modules/tar/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/tar/node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "dev": true, "engines": { - "node": ">=10" + "node": ">=18" } }, - "node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "node_modules/tar/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, "dependencies": { - "minipass": "^3.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": ">= 8" + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "node_modules/tar/node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, "dependencies": { - "yallist": "^4.0.0" + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/tar/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "node_modules/tar/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/tar/node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "node_modules/tar/node_modules/minizlib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz", + "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==", + "dev": true, + "dependencies": { + "minipass": "^7.0.4", + "rimraf": "^5.0.5" + }, "engines": { - "node": ">=8" + "node": ">= 18" } }, "node_modules/tar/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "dev": true, "bin": { - "mkdirp": "bin/cmd.js" + "mkdirp": "dist/cjs/src/bin.js" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/tar/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/tar/node_modules/rimraf": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", + "dev": true, + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "dev": true, + "engines": { + "node": ">=18" } }, "node_modules/tcp-port-used": { diff --git a/package.json b/package.json index bfe984144e2..0a22ad1da34 100644 --- a/package.json +++ b/package.json @@ -81,10 +81,12 @@ "stylelint-config-sass-guidelines": "12.1.0", "stylelint-config-standard": "^36.0.0", "stylelint-use-logical": "2.1.2", + "tar": "^7.4.3", "tslib": "^2.8.1", "tsx": "^4.19.2", "typescript": "^5.4.5", "validate-branch-name": "^1.3.1", + "vitest": "^2.1.8", "xo": "^0.60.0" }, "overrides": { diff --git a/scripts/github/build-gh-page.js b/scripts/github/build-gh-page.js new file mode 100644 index 00000000000..639051718c7 --- /dev/null +++ b/scripts/github/build-gh-page.js @@ -0,0 +1,58 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import tar from 'tar'; + +const NAME = process.env.NAME; +const OWNER_NAME = process.env.OWNER_NAME; +const REPO_NAME = process.env.REPO_NAME; +const RELEASE = process.env.RELEASE === 'true'; +const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; + +if (!NAME) { + console.error('Error: Missing NAME variable'); + process.exit(1); +} + +console.log('โž• Create public dir'); +if (!fs.existsSync('public')) { + fs.mkdirSync('public'); +} + +console.log('๐Ÿ“ฅ Get gh-pages tar'); + +const result = await fetch( + `https://github.com/${OWNER_NAME}/${REPO_NAME}/tarball/gh-pages` +); + +if (!result.ok) { + throw new Error(`Failed to fetch tarball: ${result.statusText}`); +} + +const buffer = await result.arrayBuffer(); +fs.writeFileSync('gh-pages.tar.gz', Buffer.from(buffer)); +console.log('๐Ÿ“ฆ Unpack Tar'); +await tar.x({ + file: 'gh-pages.tar.gz', + C: 'public', + strip: 1 +}); + +if (RELEASE) { + console.log('๐Ÿ”ƒ Create redirect'); + const redirectContent = ``; + fs.writeFileSync(path.join('public', 'index.html'), redirectContent); +} + +console.log('๐Ÿ‘ฃ Move out dir'); +if (PRE_RELEASE || RELEASE) { + const versionDir = path.join('public', 'version'); + if (!fs.existsSync(versionDir)) { + console.log('Make dir ./public/version'); + fs.mkdirSync(versionDir); + } + const nameDir = path.join(versionDir, NAME); + if (fs.existsSync(nameDir)) { + console.log(`Remove dir ./public/version/${NAME}`); + fs.rmdirSync(nameDir, { recursive: true }); + } +} diff --git a/.github/scripts/cleanup-gh-pages.js b/scripts/github/cleanup-gh-pages.js similarity index 100% rename from .github/scripts/cleanup-gh-pages.js rename to scripts/github/cleanup-gh-pages.js diff --git a/.github/scripts/get-playwright-version.js b/scripts/github/get-playwright-version.js similarity index 100% rename from .github/scripts/get-playwright-version.js rename to scripts/github/get-playwright-version.js diff --git a/.github/scripts/get-release.js b/scripts/github/get-release.js similarity index 100% rename from .github/scripts/get-release.js rename to scripts/github/get-release.js diff --git a/scripts/github/package-version.ts b/scripts/github/package-version.ts new file mode 100644 index 00000000000..f720a37b541 --- /dev/null +++ b/scripts/github/package-version.ts @@ -0,0 +1,48 @@ +import findVersions from 'find-versions'; + +export const packageVersion = () => { + const TAG: string | undefined = process.env.TAG; + const RELEASE: boolean = process.env.RELEASE === 'true'; + const PRE_RELEASE: boolean = process.env.PRE_RELEASE === 'true'; + const GITHUB_SHA: string | undefined = process.env.GITHUB_SHA; + + if (!TAG) { + console.error('TAG is not defined'); + process.exit(1); + } + + if (!GITHUB_SHA) { + console.error('GITHUB_SHA is not defined'); + process.exit(1); + } + + const SEMVER_VERSION: string = findVersions(TAG).toString(); + + if (RELEASE) { + if (SEMVER_VERSION.includes('-')) { + console.error( + `Version ${SEMVER_VERSION} contains hyphen, maybe you forgot to check the prerelease checkbox in GitHub release draft. A release should not have a hyphen!` + ); + process.exit(1); + } + console.log(SEMVER_VERSION); + } else if (PRE_RELEASE) { + if (SEMVER_VERSION.includes('-')) { + const GITHUB_SHA_SHORT: string = GITHUB_SHA.substring(0, 7); + const VALID_SEMVER_VERSION: string = `${SEMVER_VERSION}-${GITHUB_SHA_SHORT}`; + console.log(VALID_SEMVER_VERSION); + } else { + console.error( + `Version ${SEMVER_VERSION} doesn't contain a hyphen. A prerelease should have a hyphen!` + ); + process.exit(1); + } + } else { + console.error( + 'nothing found in environment for RELEASE or PRE_RELEASE' + ); + process.exit(1); + } +}; + +packageVersion(); diff --git a/scripts/github/publish-npm.js b/scripts/github/publish-npm.js new file mode 100644 index 00000000000..954e0009a1d --- /dev/null +++ b/scripts/github/publish-npm.js @@ -0,0 +1,91 @@ +import { execSync } from 'child_process'; + +const VALID_SEMVER_VERSION = process.env.VALID_SEMVER_VERSION; +const RELEASE = process.env.RELEASE === 'true'; +const PRE_RELEASE = process.env.PRE_RELEASE === 'true'; +const GPR_TOKEN = process.env.GPR_TOKEN; +const NPM_TOKEN = process.env.NPM_TOKEN; + +if (!VALID_SEMVER_VERSION) { + console.error('Version is missing!'); + process.exit(1); +} + +if (!RELEASE && !PRE_RELEASE) { + console.error( + 'RELEASE and PRE_RELEASE are false, there should be an error in the pipeline!' + ); + process.exit(1); +} + +console.log('๐Ÿ›  Forge all packages version numbers'); +console.log(`which package version ?: ${VALID_SEMVER_VERSION}`); + +console.log('goto build-outputs'); +process.chdir('build-outputs'); + +const packages = [ + 'foundations', + 'migration', + 'components', + 'ngx-components', + 'react-components', + 'v-components', + 'web-components' +]; + +for (const PACKAGE of packages) { + console.log(`Start ${PACKAGE} bundle:`); + + console.log('๐Ÿ†š Update Version'); + execSync( + `npm version --no-git-tag-version ${VALID_SEMVER_VERSION} --workspace=@db-ui/${PACKAGE}` + ); + + if (PACKAGE !== 'foundations' && PACKAGE !== 'migration') { + console.log('๐Ÿ•ต๏ธโ€ Set foundations dependency'); + execSync( + `npm pkg set dependencies.@db-ui/foundations=${VALID_SEMVER_VERSION} --workspace=@db-ui/${PACKAGE}` + ); + if (PACKAGE !== 'components') { + execSync( + `npm pkg set dependencies.@db-ui/components=${VALID_SEMVER_VERSION} --workspace=@db-ui/${PACKAGE}` + ); + } + } + + console.log('๐Ÿ“ฆ Create npm package'); + execSync(`npm pack --quiet --workspace=@db-ui/${PACKAGE}`); +} + +let TAG = 'latest'; +if (PRE_RELEASE) { + TAG = 'next'; +} + +console.log(`๐Ÿ“ฐ Publish Package to Registry with tag: ${TAG}`); +const registries = ['GITHUB', 'NPM']; + +for (const REGISTRY of registries) { + console.log(`๐Ÿ”’ Authenticate ${REGISTRY} NPM Registry`); + + if (REGISTRY === 'GITHUB') { + execSync('npm config set @db-ui:registry https://npm.pkg.github.com'); + execSync(`npm set //npm.pkg.github.com/:_authToken ${GPR_TOKEN}`); + console.log('๐Ÿ”‘ Authenticated with GitHub'); + } else if (REGISTRY === 'NPM') { + execSync('npm config set @db-ui:registry https://registry.npmjs.org/'); + execSync(`npm set //registry.npmjs.org/:_authToken ${NPM_TOKEN}`); + console.log('๐Ÿ”‘ Authenticated with NPM'); + } else { + console.error(`Could not authenticate with ${REGISTRY}`); + process.exit(1); + } + + packages.forEach((PACKAGE) => { + console.log(`โคด Publish ${PACKAGE} with tag ${TAG} to ${REGISTRY}`); + execSync( + `npm publish --tag ${TAG} db-ui-${PACKAGE}-${VALID_SEMVER_VERSION}.tgz --provenance` + ); + }); +} diff --git a/scripts/package.json b/scripts/package.json index b55730b657a..030807f3af9 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -63,6 +63,7 @@ "start:foundations": "npm run start --workspace=@db-ui/foundations", "test": "npm-run-all -p test:*", "test:migration": "npm run test --workspace=@db-ui/migration", + "test:scripts": "vitest run --config vitest.config.ts", "update:icon-fonts": "npm-run-all generate:icon-fonts generate:icon-types" }, "devDependencies": { diff --git a/scripts/tests/github/package-version.spec.ts b/scripts/tests/github/package-version.spec.ts new file mode 100644 index 00000000000..dd8b56ab418 --- /dev/null +++ b/scripts/tests/github/package-version.spec.ts @@ -0,0 +1,22 @@ +import { describe, expect, test } from 'vitest'; +import { execSync } from 'child_process'; + +describe('package-version', () => { + test('release', async () => { + process.env.TAG = '1.2.3'; + process.env.GITHUB_SHA = 'abcdefg'; + process.env.RELEASE = 'true'; + process.env.PRE_RELEASE = 'false'; + const result = execSync(`npx tsx github/package-version.ts`); + expect(result.toString().trim()).toEqual('1.2.3'); + }); + + test('pre-release', async () => { + process.env.TAG = '1.2.3-0'; + process.env.GITHUB_SHA = 'abcdefg'; + process.env.RELEASE = 'false'; + process.env.PRE_RELEASE = 'true'; + const result = execSync(`npx tsx github/package-version.ts`); + expect(result.toString().trim()).toEqual('1.2.3-0-abcdefg'); + }); +}); diff --git a/scripts/vitest.config.ts b/scripts/vitest.config.ts new file mode 100644 index 00000000000..d5f1139db2d --- /dev/null +++ b/scripts/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + include: ['tests/**/*.{test,spec}.?(c|m)[jt]s?(x)'] + } +}); From 8c0c52dce54659b71641ff35f3ba85003cfaa47b Mon Sep 17 00:00:00 2001 From: Nicolas Merget Date: Mon, 27 Jan 2025 12:53:56 +0100 Subject: [PATCH 15/15] chore: update paths for github scripts --- .github/workflows/01-get-playwright-version.yml | 2 +- .github/workflows/01-get-publish-version.yml | 2 +- .github/workflows/03-deploy-gh-pages.yml | 2 +- .github/workflows/03-publish-packages.yml | 2 +- .github/workflows/cleanup.yml | 2 +- package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/01-get-playwright-version.yml b/.github/workflows/01-get-playwright-version.yml index b9ced0d03fb..53b2029e8dd 100644 --- a/.github/workflows/01-get-playwright-version.yml +++ b/.github/workflows/01-get-playwright-version.yml @@ -27,7 +27,7 @@ jobs: with: result-encoding: string script: | - const { default: getPlaywrightVersion } = await import('${{ github.workspace }}/.github/scripts/get-playwright-version.js'); + const { default: getPlaywrightVersion } = await import('${{ github.workspace }}/scripts/github/get-playwright-version.js'); return await getPlaywrightVersion(); - name: ๐Ÿ’€ Killing me softly diff --git a/.github/workflows/01-get-publish-version.yml b/.github/workflows/01-get-publish-version.yml index f67f0e1a392..a8edc5fce4f 100644 --- a/.github/workflows/01-get-publish-version.yml +++ b/.github/workflows/01-get-publish-version.yml @@ -33,7 +33,7 @@ jobs: - name: ๐Ÿ’ƒ๐Ÿ•บ Check if release or prerelease id: releaseCheck run: | - OUTPUT=$(node .github/scripts/get-release.js) + OUTPUT=$(node scripts/github/get-release.js) if [[ $OUTPUT == "RELEASE" ]]; then echo "release=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/03-deploy-gh-pages.yml b/.github/workflows/03-deploy-gh-pages.yml index 8534b33ad71..cecf8c299bb 100644 --- a/.github/workflows/03-deploy-gh-pages.yml +++ b/.github/workflows/03-deploy-gh-pages.yml @@ -69,7 +69,7 @@ jobs: REPO_NAME: ${{ steps.repo-name.outputs.result }} OWNER_NAME: ${{ github.repository_owner }} run: | - tsx .github/scripts/build-gh-page.js + tsx scripts/github/build-gh-page.js - name: ๐Ÿฅ… Deploy to GH-Pages uses: peaceiris/actions-gh-pages@v4 diff --git a/.github/workflows/03-publish-packages.yml b/.github/workflows/03-publish-packages.yml index efb65ad6cd2..440a7c4ba47 100644 --- a/.github/workflows/03-publish-packages.yml +++ b/.github/workflows/03-publish-packages.yml @@ -38,7 +38,7 @@ jobs: - name: ๐Ÿ“ฐ Publish to NPM Registries run: | - tsx .github/scripts/publish-npm.js + tsx scripts/github/publish-npm.js env: RELEASE: ${{ inputs.release }} PRE_RELEASE: ${{ inputs.preRelease }} diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index a0f2cee5d14..74736815393 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -28,7 +28,7 @@ jobs: with: result-encoding: json script: | - const { default: cleanUpPages } = await import('${{ github.workspace }}/.github/scripts/cleanup-gh-pages.js'); + const { default: cleanUpPages } = await import('${{ github.workspace }}/scripts/github/cleanup-gh-pages.js'); return await cleanUpPages({github, context}); - name: ๐Ÿฅ… Deploy to GH-Pages diff --git a/package.json b/package.json index 5de494a19b8..f673a4171b8 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "test": "npm run test --workspace=scripts", "test:react-components": "playwright test -c output/react/playwright.config.ts --ui", "test:vue-components": "playwright test -c output/vue/playwright.config.ts --ui", - "update:dependency:playwright": "node .github/scripts/update-playwright.js" + "update:dependency:playwright": "node scripts/github/update-playwright.js" }, "devDependencies": { "@axe-core/playwright": "^4.10.1",