diff --git a/.github/workflows/ci_release.yml b/.github/workflows/ci_release.yml index 84d4f88d..ea60b8e1 100644 --- a/.github/workflows/ci_release.yml +++ b/.github/workflows/ci_release.yml @@ -9,6 +9,7 @@ on: required: true type: choice options: + - -- all -- - core - layout - list-loader @@ -43,6 +44,6 @@ jobs: GH_TOKEN: ${{ secrets.DSI_HUG_BOT_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.DSI_HUG_NPM_TOKEN }} with: - working-directory: 'projects/${{ inputs.package }}' + working-directory: ${{ (inputs.package == '-- all --') && '.' || format('projects/{0}', inputs.package) }} dry-run: ${{ inputs.dry-run }} release: true diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..753ea359 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +# Make sure to use the official npm registry +registry=https://registry.npmjs.org/ diff --git a/package-lock.json b/package-lock.json index 24ec1d11..7c5eb193 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3646,7 +3646,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, - "license": "Apache-2.0", "peer": true, "bin": { "tsc": "bin/tsc", @@ -4253,7 +4252,6 @@ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "ajv": "^6.12.4", @@ -4278,7 +4276,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", @@ -4296,7 +4293,6 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "Python-2.0", "peer": true }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { @@ -4304,7 +4300,6 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "balanced-match": "^1.0.0", @@ -4316,7 +4311,6 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "type-fest": "^0.20.2" @@ -4333,7 +4327,6 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "argparse": "^2.0.1" @@ -4347,7 +4340,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { @@ -4355,7 +4347,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "license": "ISC", "peer": true, "dependencies": { "brace-expansion": "^1.1.7" @@ -4369,7 +4360,6 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "license": "(MIT OR CC0-1.0)", "peer": true, "engines": { "node": ">=10" @@ -4383,7 +4373,6 @@ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4391,17 +4380,17 @@ }, "node_modules/@fontsource-variable/material-symbols-outlined": { "version": "5.0.34", - "resolved": "https://nxrm.hisaas.hcuge.ch/repository/npm-all/@fontsource-variable/material-symbols-outlined/-/material-symbols-outlined-5.0.34.tgz", + "resolved": "https://registry.npmjs.org/@fontsource-variable/material-symbols-outlined/-/material-symbols-outlined-5.0.34.tgz", "integrity": "sha512-dC6BoXU93VMjNlfbn4YRdqsSOFp6Smue2KZgZJ8wy2x0OeyA73hgJyb5i6mV6JZnuaiJHMwqTfwJQ3FtSPKFnw==" }, "node_modules/@fontsource/material-icons": { "version": "4.5.4", - "resolved": "https://nxrm.hisaas.hcuge.ch/repository/npm-all/@fontsource/material-icons/-/material-icons-4.5.4.tgz", + "resolved": "https://registry.npmjs.org/@fontsource/material-icons/-/material-icons-4.5.4.tgz", "integrity": "sha512-YGmXkkEdu6EIgpFKNmB/nIXzZocwSmbI01Ninpmml8x8BT0M6RR++V1KqOfpzZ6Cw/FQ2/KYonQ3x4IY/4VRRA==" }, "node_modules/@fontsource/roboto": { "version": "4.5.8", - "resolved": "https://nxrm.hisaas.hcuge.ch/repository/npm-all/@fontsource/roboto/-/roboto-4.5.8.tgz", + "resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-4.5.8.tgz", "integrity": "sha512-CnD7zLItIzt86q4Sj3kZUiLcBk1dSk81qcqgMGaZe7SQ1P8hFNxhMl5AZthK1zrDM5m74VVhaOpuMGIL4gagaA==" }, "node_modules/@gar/promisify": { @@ -4564,7 +4553,6 @@ "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "deprecated": "Use @eslint/config-array instead", "dev": true, - "license": "Apache-2.0", "peer": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.2", @@ -4580,7 +4568,6 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "balanced-match": "^1.0.0", @@ -4592,7 +4579,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "license": "ISC", "peer": true, "dependencies": { "brace-expansion": "^1.1.7" @@ -4606,7 +4592,6 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, - "license": "Apache-2.0", "peer": true, "engines": { "node": ">=12.22" @@ -4622,7 +4607,6 @@ "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "deprecated": "Use @eslint/object-schema instead", "dev": true, - "license": "BSD-3-Clause", "peer": true }, "node_modules/@istanbuljs/load-nyc-config": { @@ -7389,7 +7373,6 @@ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true, - "license": "ISC", "peer": true }, "node_modules/@webassemblyjs/ast": { @@ -9997,7 +9980,6 @@ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/deepmerge": { @@ -10233,7 +10215,6 @@ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, - "license": "Apache-2.0", "peer": true, "dependencies": { "esutils": "^2.0.2" @@ -11142,7 +11123,6 @@ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -11677,7 +11657,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", @@ -11695,7 +11674,6 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "color-convert": "^2.0.1" @@ -11712,7 +11690,6 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "Python-2.0", "peer": true }, "node_modules/eslint/node_modules/brace-expansion": { @@ -11720,7 +11697,6 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "balanced-match": "^1.0.0", @@ -11732,7 +11708,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "ansi-styles": "^4.1.0", @@ -11750,7 +11725,6 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "color-name": "~1.1.4" @@ -11764,7 +11738,6 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/eslint/node_modules/escape-string-regexp": { @@ -11772,7 +11745,6 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": ">=10" @@ -11786,7 +11758,6 @@ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, - "license": "BSD-2-Clause", "peer": true, "dependencies": { "esrecurse": "^4.3.0", @@ -11804,7 +11775,6 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, - "license": "ISC", "peer": true, "dependencies": { "is-glob": "^4.0.3" @@ -11818,7 +11788,6 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "type-fest": "^0.20.2" @@ -11835,7 +11804,6 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": ">=8" @@ -11846,7 +11814,6 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "argparse": "^2.0.1" @@ -11860,7 +11827,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/eslint/node_modules/minimatch": { @@ -11868,7 +11834,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "license": "ISC", "peer": true, "dependencies": { "brace-expansion": "^1.1.7" @@ -11882,7 +11847,6 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "has-flag": "^4.0.0" @@ -11896,7 +11860,6 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "license": "(MIT OR CC0-1.0)", "peer": true, "engines": { "node": ">=10" @@ -12225,7 +12188,6 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/fastq": { @@ -12272,7 +12234,6 @@ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "flat-cache": "^3.0.4" @@ -12413,7 +12374,6 @@ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "flatted": "^3.2.9", @@ -13991,7 +13951,6 @@ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": ">=8" @@ -14678,7 +14637,6 @@ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/json-parse-even-better-errors": { @@ -14719,7 +14677,6 @@ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, - "license": "MIT", "peer": true }, "node_modules/json5": { @@ -15068,7 +15025,6 @@ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "json-buffer": "3.0.1" @@ -15229,7 +15185,6 @@ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "prelude-ls": "^1.2.1", @@ -17391,7 +17346,6 @@ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "deep-is": "^0.1.3", @@ -18958,7 +18912,6 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": ">= 0.8.0" @@ -18966,7 +18919,7 @@ }, "node_modules/prettier": { "version": "3.3.2", - "resolved": "https://nxrm.hisaas.hcuge.ch/repository/npm-all/prettier/-/prettier-3.3.2.tgz", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", "dev": true, "bin": { @@ -21113,7 +21066,6 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": ">=8" @@ -21794,7 +21746,6 @@ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, - "license": "MIT", "peer": true, "dependencies": { "prelude-ls": "^1.2.1" @@ -22621,7 +22572,6 @@ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, - "license": "MIT", "peer": true, "engines": { "node": ">=0.10.0" @@ -22841,7 +22791,7 @@ }, "projects/layout": { "name": "@hug/ngx-layout", - "version": "1.1.2", + "version": "1.1.3", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -22852,12 +22802,12 @@ "@angular/core": ">= 14", "@angular/material": ">= 14", "@hug/ngx-core": "1.1.7", - "@hug/ngx-sidenav": "1.1.1" + "@hug/ngx-sidenav": "1.1.2" } }, "projects/list-loader": { "name": "@hug/ngx-list-loader", - "version": "1.1.2", + "version": "1.1.3", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -22898,7 +22848,7 @@ }, "projects/numeric-stepper": { "name": "@hug/ngx-numeric-stepper", - "version": "1.1.3", + "version": "1.1.4", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -22945,7 +22895,7 @@ }, "projects/sidenav": { "name": "@hug/ngx-sidenav", - "version": "1.1.1", + "version": "1.1.2", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -22959,7 +22909,7 @@ }, "projects/snackbar": { "name": "@hug/ngx-snackbar", - "version": "1.1.2", + "version": "1.1.3", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -22988,7 +22938,7 @@ }, "projects/status": { "name": "@hug/ngx-status", - "version": "1.1.1", + "version": "1.1.2", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -23000,13 +22950,13 @@ "@angular/material": ">= 14", "@hug/ngx-core": "1.1.7", "@hug/ngx-message-box": "1.1.2", - "@hug/ngx-snackbar": "1.1.2", + "@hug/ngx-snackbar": "1.1.3", "rxjs": ">= 7.0.0" } }, "projects/time-picker": { "name": "@hug/ngx-time-picker", - "version": "1.1.2", + "version": "1.1.3", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -23018,14 +22968,14 @@ "@angular/forms": ">= 14", "@angular/material": ">= 14", "@hug/ngx-core": "1.1.7", - "@hug/ngx-numeric-stepper": "1.1.3", + "@hug/ngx-numeric-stepper": "1.1.4", "date-fns": "^2.30.0", "rxjs": ">= 7.0.0" } }, "projects/tooltip": { "name": "@hug/ngx-tooltip", - "version": "1.1.2", + "version": "1.1.3", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -23042,7 +22992,7 @@ }, "projects/user-card": { "name": "@hug/ngx-user-card", - "version": "1.1.1", + "version": "1.1.2", "license": "GPL-3.0-only", "dependencies": { "tslib": "^2.6.3" @@ -23066,8 +23016,8 @@ "@angular/core": ">= 14", "@angular/material": ">= 14", "@hug/ngx-core": "1.1.7", - "@hug/ngx-tooltip": "1.1.2", - "@hug/ngx-user-card": "1.1.1" + "@hug/ngx-tooltip": "1.1.3", + "@hug/ngx-user-card": "1.1.2" } } } diff --git a/package.json b/package.json index ff91df6a..0fa6c507 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,13 @@ "private": true, "scripts": { "ncu": "npx npm-check-updates -i --target=minor --dep=dev,peer,optional,prod --format=group --packageFile='{,projects/**/}package.json'", - "lint": "eslint . --fix", "prepare": "husky || true", "new-package": "ng g .:new-package", - "release:dry-run": "node -r @swc-node/register ./scripts/release.ts --verbose --dry-run", + "lint": "nx run-many -t lint", + "test:ci": "nx run-many -t test:ci", + "build": "nx run-many -t build:ng --verbose", + "release": "node -r @swc-node/register ./scripts/release.ts --verbose", + "release:dry-run": "npm run release -- --dry-run", "postinstall": "patch-package", "start": "ng serve", "prettier": "npx prettier . --write" @@ -39,10 +42,10 @@ "@angular/platform-browser": "~14.3.0", "@angular/platform-browser-dynamic": "~14.3.0", "@angular/router": "~14.3.0", + "date-fns": "~2.30.0", "@fontsource-variable/material-symbols-outlined": "~5.0.19", "@fontsource/material-icons": "4.5.4", "@fontsource/roboto": "4.5.8", - "date-fns": "~2.30.0", "lodash-es": "~4.17.21", "rxjs": "~7.8.1", "tslib": "~2.6.3", @@ -103,7 +106,7 @@ } }, "lint-staged": { - "**/*.{js,ts}": [ + "**/*.{js,json,ts,html}": [ "eslint --fix" ], "**/*.{html,scss,json}": [ diff --git a/projects/layout/CHANGELOG.md b/projects/layout/CHANGELOG.md index 7416a849..fa9bb0f1 100644 --- a/projects/layout/CHANGELOG.md +++ b/projects/layout/CHANGELOG.md @@ -1,3 +1,20 @@ +## 1.1.3 (2024-07-08) + +### 🐛 Fixes + +- theming ([79feb6e](https://github.com/DSI-HUG/ngx-components/commit/79feb6e)) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +- **@hug/ngx-sidenav:** upgrade to v1.1.2 ([92ee575](https://github.com/DSI-HUG/ngx-components/commit/92ee575)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot +- Serge + ## 1.1.0 (2024-06-26) ### 🚀 Features diff --git a/projects/layout/package.json b/projects/layout/package.json index ac5efbe2..148fa519 100644 --- a/projects/layout/package.json +++ b/projects/layout/package.json @@ -40,7 +40,7 @@ "@angular/cdk": ">= 14", "@angular/material": ">= 14", "@hug/ngx-core": "1.1.7", - "@hug/ngx-sidenav": "1.1.1" + "@hug/ngx-sidenav": "1.1.2" }, "dependencies": { "tslib": "^2.6.3" diff --git a/projects/list-loader/CHANGELOG.md b/projects/list-loader/CHANGELOG.md index 25dc85c5..7d13d3b3 100644 --- a/projects/list-loader/CHANGELOG.md +++ b/projects/list-loader/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.1.3 (2024-07-08) + +### 🐛 Fixes + +- theming ([79feb6e](https://github.com/DSI-HUG/ngx-components/commit/79feb6e)) + +### ❤️ Thank You + +- Serge + ## 1.1.1 (2024-06-17) ### 🚀 Features diff --git a/projects/list-loader/package.json b/projects/list-loader/package.json index f57b2bdc..8fd10415 100644 --- a/projects/list-loader/package.json +++ b/projects/list-loader/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-list-loader", - "version": "1.1.2", + "version": "1.1.3", "description": "HUG Angular - list loader component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", diff --git a/projects/numeric-stepper/CHANGELOG.md b/projects/numeric-stepper/CHANGELOG.md index b542bb35..d50a6092 100644 --- a/projects/numeric-stepper/CHANGELOG.md +++ b/projects/numeric-stepper/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.1.4 (2024-07-08) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot + ## 1.1.2 (2024-06-24) ### 🌱 Dependencies diff --git a/projects/numeric-stepper/package.json b/projects/numeric-stepper/package.json index 900c6579..aec9f3bf 100644 --- a/projects/numeric-stepper/package.json +++ b/projects/numeric-stepper/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-numeric-stepper", - "version": "1.1.3", + "version": "1.1.4", "description": "HUG Angular - numeric stepper component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", diff --git a/projects/sidenav/CHANGELOG.md b/projects/sidenav/CHANGELOG.md index 6c130768..fa341674 100644 --- a/projects/sidenav/CHANGELOG.md +++ b/projects/sidenav/CHANGELOG.md @@ -1,3 +1,18 @@ +## 1.1.2 (2024-07-08) + +### 🐛 Fixes + +- theming ([79feb6e](https://github.com/DSI-HUG/ngx-components/commit/79feb6e)) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot +- Serge + ## 1.1.0 (2024-06-26) ### 🚀 Features diff --git a/projects/sidenav/package.json b/projects/sidenav/package.json index 89273552..86e5bfa7 100644 --- a/projects/sidenav/package.json +++ b/projects/sidenav/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-sidenav", - "version": "1.1.1", + "version": "1.1.2", "description": "HUG Angular - sidenav component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", diff --git a/projects/snackbar/CHANGELOG.md b/projects/snackbar/CHANGELOG.md index a3d885ac..97ba7a38 100644 --- a/projects/snackbar/CHANGELOG.md +++ b/projects/snackbar/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.1.3 (2024-07-08) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot + ## 1.1.1 (2024-06-24) ### 🌱 Dependencies diff --git a/projects/snackbar/package.json b/projects/snackbar/package.json index 6e464074..b367ac04 100644 --- a/projects/snackbar/package.json +++ b/projects/snackbar/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-snackbar", - "version": "1.1.2", + "version": "1.1.3", "description": "HUG Angular - snackbar component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", diff --git a/projects/status/CHANGELOG.md b/projects/status/CHANGELOG.md index 7a64fcd6..b10dd7aa 100644 --- a/projects/status/CHANGELOG.md +++ b/projects/status/CHANGELOG.md @@ -1,3 +1,15 @@ +## 1.1.2 (2024-07-08) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +- **@hug/ngx-snackbar:** upgrade to v1.1.3 ([20a211c](https://github.com/DSI-HUG/ngx-components/commit/20a211c)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot + ## 1.1.0 (2024-06-24) ### 🚀 Features diff --git a/projects/status/package.json b/projects/status/package.json index c40827f2..6c8b38be 100644 --- a/projects/status/package.json +++ b/projects/status/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-status", - "version": "1.1.1", + "version": "1.1.2", "description": "HUG Angular - status component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", @@ -41,7 +41,7 @@ "@angular/material": ">= 14", "rxjs": ">= 7.0.0", "@hug/ngx-core": "1.1.7", - "@hug/ngx-snackbar": "1.1.2", + "@hug/ngx-snackbar": "1.1.3", "@hug/ngx-message-box": "1.1.2" }, "dependencies": { diff --git a/projects/time-picker/CHANGELOG.md b/projects/time-picker/CHANGELOG.md index 17f598c3..96394858 100644 --- a/projects/time-picker/CHANGELOG.md +++ b/projects/time-picker/CHANGELOG.md @@ -1,3 +1,15 @@ +## 1.1.3 (2024-07-08) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +- **@hug/ngx-numeric-stepper:** upgrade to v1.1.4 ([197b1ad](https://github.com/DSI-HUG/ngx-components/commit/197b1ad)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot + ## 1.1.1 (2024-06-24) ### 🌱 Dependencies diff --git a/projects/time-picker/package.json b/projects/time-picker/package.json index 292eb401..755351ed 100644 --- a/projects/time-picker/package.json +++ b/projects/time-picker/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-time-picker", - "version": "1.1.2", + "version": "1.1.3", "description": "HUG Angular - time picker component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", @@ -38,7 +38,7 @@ "rxjs": ">= 7.0.0", "date-fns": "^2.30.0", "@hug/ngx-core": "1.1.7", - "@hug/ngx-numeric-stepper": "1.1.3" + "@hug/ngx-numeric-stepper": "1.1.4" }, "dependencies": { "tslib": "^2.6.3" diff --git a/projects/tooltip/CHANGELOG.md b/projects/tooltip/CHANGELOG.md index 99eabcea..683efaa9 100644 --- a/projects/tooltip/CHANGELOG.md +++ b/projects/tooltip/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.1.3 (2024-07-08) + +### 🌱 Dependencies + +- **@hug/ngx-core:** upgrade to v1.1.7 ([b0f15b9](https://github.com/DSI-HUG/ngx-components/commit/b0f15b9)) + +### ❤️ Thank You + +- dsi-hug-bot @dsi-hug-bot + ## 1.1.1 (2024-06-24) ### 🐛 Fixes diff --git a/projects/tooltip/package.json b/projects/tooltip/package.json index 21b9f591..268fac58 100644 --- a/projects/tooltip/package.json +++ b/projects/tooltip/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-tooltip", - "version": "1.1.2", + "version": "1.1.3", "description": "HUG Angular - tooltip component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", diff --git a/projects/user-card/CHANGELOG.md b/projects/user-card/CHANGELOG.md index 41ae0965..246de0f5 100644 --- a/projects/user-card/CHANGELOG.md +++ b/projects/user-card/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.1.2 (2024-07-08) + +### 🐛 Fixes + +- theming ([79feb6e](https://github.com/DSI-HUG/ngx-components/commit/79feb6e)) + +### ❤️ Thank You + +- Serge + ## 1.1.0 (2024-06-26) ### 🚀 Features diff --git a/projects/user-card/package.json b/projects/user-card/package.json index bc503c99..6aa9da85 100644 --- a/projects/user-card/package.json +++ b/projects/user-card/package.json @@ -1,6 +1,6 @@ { "name": "@hug/ngx-user-card", - "version": "1.1.1", + "version": "1.1.2", "description": "HUG Angular - user-card component", "homepage": "https://github.com/dsi-hug/ngx-components", "license": "GPL-3.0-only", diff --git a/projects/user-tooltip/package.json b/projects/user-tooltip/package.json index 72064567..0d101746 100644 --- a/projects/user-tooltip/package.json +++ b/projects/user-tooltip/package.json @@ -34,8 +34,8 @@ "@angular/core": ">= 14", "@angular/material": ">= 14", "@hug/ngx-core": "1.1.7", - "@hug/ngx-tooltip": "1.1.2", - "@hug/ngx-user-card": "1.1.1" + "@hug/ngx-tooltip": "1.1.3", + "@hug/ngx-user-card": "1.1.2" }, "dependencies": { "tslib": "^2.6.3" diff --git a/scripts/release.ts b/scripts/release.ts index 8e165c90..0e654b22 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -6,257 +6,310 @@ import { copyFileSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { releaseChangelog, releasePublish, releaseVersion } from 'nx/release'; import { PublishOptions } from 'nx/src/command-line/release/command-object'; +import { VersionData } from 'nx/src/command-line/release/version'; +import { ProjectsConfigurations } from 'nx/src/config/workspace-json-project-json'; import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph'; import { PackageJson } from 'nx/src/utils/package-json'; import { workspaceRoot } from 'nx/src/utils/workspace-root'; import * as yargs from 'yargs'; -const { yellow, blue, red, green, gray, white, bgBlue } = chalk; +const { yellow, blue, red, green, gray, white, cyan, bgBlue } = chalk; -void (async (): Promise => { - const exec = (message: string | undefined, cmd: string, args: string[]): void => { - if (message) { - console.log(message); +interface Options { + projects: string[]; + dryRun: boolean; + verbose: boolean; +} + +const exec = (message: string, cmd: string, args: string[], options: Options, newLine = false): void => { + console.log(`${message}${options.dryRun ? yellow(' [dry-run]') : ''}${newLine ? '\n' : ''}`); + if (options.verbose) { + console.log(`${cmd} ${args.join(' ')}`); + } + if (!options.dryRun) { + const result = spawnSync(cmd, args, { stdio: 'inherit', cwd: workspaceRoot }); + if (result.error) { + throw result.error; } - if (options.verbose) { - console.log(`\n${cmd} ${args.join(' ')}`); + if (result.status !== 0) { + throw new Error(`Command failed with exit code ${result.status}`); } - if (!options.dryRun) { - const result = spawnSync(cmd, args, { stdio: 'inherit', cwd: workspaceRoot }); - if (result.error) { - throw result.error; - } - if (result.status !== 0) { - throw new Error(`Command failed with exit code ${result.status}`); + } +}; + +/** + * Currently `nx release` does not allow to easily change the folder to be published. + * + * `nx.json#targetDefaults.nx-release-publish.options.packageRoot` could be used but can only interpolate: + * - {projectName}: which resolved to '@hug/ngx-abc' (ie. package.json#name) + * - {projectRoot}: which resolved to 'projects/abc' + * And what we need is actually `abc` because Angular generates projects in `dist/abc`. + * So to make it work, we use the hidden option (__overrides_unparsed__) and publish each project individually. + */ +const publishProjects = async ( + projectsToRelease: string[], + projects: ProjectsConfigurations['projects'], + options: Options +): Promise => { + let processStatus = 0; + if (!options.dryRun) { + for (const project of projectsToRelease) { + const projectName = projects[project].root.substring('projects/'.length); + const publishStatus = await releasePublish({ + __overrides_unparsed__: `--packageRoot=./dist/${projectName}`, + projects: [project], + dryRun: options.dryRun, + verbose: options.verbose + } as PublishOptions); + if (publishStatus !== 0) { + processStatus = publishStatus; } } - }; - - const options = await yargs - .version(false) - .option('projects', { - description: 'Projects filter to use for the release script', - type: 'array', - string: true, - default: [] - }) - .option('dry-run', { - description: 'Whether or not to perform a dry-run of the release process, defaults to false', - type: 'boolean', - default: false - }) - .option('verbose', { - description: 'Whether or not to enable verbose logging, defaults to false', - type: 'boolean', - default: false - }) - .parseAsync(); - - /** - * 1. Resolve new project version - * 2. Update `projects//package.json` with new version - * 3. Update npm lock file - * 4. Stage changed files with git - */ - const { workspaceVersion, projectsVersionData } = await releaseVersion({ - projects: options.projects, - stageChanges: true, - gitCommit: false, - dryRun: options.dryRun, - verbose: options.verbose - }); - - /** - * 5. Determine affected projects and exit if none - */ - const projectsToRelease = Object.keys(projectsVersionData).filter(key => { - const { newVersion, currentVersion } = projectsVersionData[key]; - return (newVersion && (newVersion !== currentVersion)); - }); - if (projectsToRelease.length === 0) { - console.log('No affected projects found to be published'); - return process.exit(0); + } else { + console.log(`\n${bgBlue(' HUG ')} ${blue('Publishing to npm')}${yellow(' [dry-run]')}\n`); } + return processStatus; +}; +/** + * Currently `nx release` publishes packages from their source directory by default. + * + * So we need to make sure `dist` are in sync and used for publishing instead. + * + * TODO: remove this script if one day this feature is supported by `nx release` directly + * @see https://github.com/nrwl/nx/issues/21855#issuecomment-1977360480 + */ +const updateProjectsDists = ( + projectsToRelease: string[], + projects: ProjectsConfigurations['projects'], + projectsVersionData: VersionData, + options: Options +): void => { + console.log(`\n${bgBlue(' HUG ')} ${blue('Synchronizing dist packages')}${options.dryRun ? yellow(' [dry-run]') : ''}`); + projectsToRelease.forEach(project => { + const projectRoot = projects[project].root; + const projectName = projectRoot.substring('projects/'.length); + const projectNewVersion = projectsVersionData[project].newVersion ?? ''; + const distPackageJsonPath = join('dist', projectName, 'package.json'); + const distChangelogPath = join('dist', projectName, 'CHANGELOG.md'); - /** - * 6. Update `projects//CHANGELOG.md` - * 7. Stage changed files with git - * 8. Commit all previously staged files in git - * chore(release): publish [skip ci] - * - project: @hug/ngx-xyz 1.2.3 - * 9. Tag commit with git - * @hug/ngx-xyz@1.2.3 - * 10. Push to git remote - * 11. Create GitHub release - */ - await releaseChangelog({ - projects: options.projects, - version: workspaceVersion, - versionData: projectsVersionData, - stageChanges: true, - gitCommit: true, - gitCommitMessage: 'chore(release): publish [skip ci]', - gitTag: true, - dryRun: options.dryRun, - verbose: options.verbose + console.log(`\n${cyan(projects[project].name ?? '')} New version ${projectNewVersion} written to ${distPackageJsonPath}`); + if (!options.dryRun) { + const distPackageJson = JSON.parse(readFileSync(join(workspaceRoot, projectRoot, 'package.json'), 'utf8')) as PackageJson; + distPackageJson.version = projectNewVersion; + writeFileSync(join(workspaceRoot, distPackageJsonPath), JSON.stringify(distPackageJson, null, 4), { encoding: 'utf8' }); + } + + console.log(`${cyan(projects[project].name ?? '')} Changelog updated in ${distChangelogPath}`); + if (!options.dryRun) { + copyFileSync(join(workspaceRoot, projectRoot, 'CHANGELOG.md'), join(workspaceRoot, distChangelogPath)); + } }); +}; - /** - * Ensures consistent versioning across interdependent packages in the monorepo. - * - * It reads the current version of each package and updates any other packages that reference - * it in their `peerDependencies` to maintain version synchronization. - * - * TODO: remove this script if one day this feature is supported by `nx release` directly - * @see https://github.com/nrwl/nx/issues/22776 - * @see https://github.com/nrwl/nx/discussions/23388 - * - * 12. Synchronize interdependencies - * - Update project's package.json file - * - Update npm lock file - * - Stage changed files with git - * - Commit all previously staged files in git - * deps(@hug/ngx-xyz): upgrade to v1.2.3 - * [skip ci] - * 13. Push to git remote - */ - const projectGraph = await createProjectGraphAsync({ exitOnError: true }); - const { projects } = readProjectsConfigurationFromProjectGraph(projectGraph); - const workspaces = Object.values(projects).map(project => ({ - packageJsonPath: join(project.root, 'package.json'), - packageJson: JSON.parse(readFileSync(join(workspaceRoot, project.root, 'package.json'), 'utf8')) as PackageJson - })); +/** + * Ensures consistent versioning across interdependent packages in the monorepo. + * + * It reads the current version of each package and updates any other packages that reference + * it in their `peerDependencies` to maintain version synchronization. + * + * TODO: remove this script if one day this feature is supported by `nx release` directly + * @see https://github.com/nrwl/nx/issues/22776 + * @see https://github.com/nrwl/nx/discussions/23388 + */ +const updateProjectsPeerDeps = ( + projectsToRelease: string[], + projects: ProjectsConfigurations['projects'], + projectsVersionData: VersionData, + options: Options +): boolean => { let packageJsonFiles: string[] = []; let changesDetected = false; - console.log(`\n${bgBlue(' HUG ')} ${blue('Synchronizing peer interdependencies')}${options.dryRun ? yellow(' [dry-run]') : ''}`); - workspaces.forEach(workspace => { - workspaces.forEach(workspace2 => { - const peerDependencies = workspace2.packageJson.peerDependencies ?? {}; - if (Object.prototype.hasOwnProperty.call(peerDependencies, workspace.packageJson.name)) { - const version = peerDependencies[workspace.packageJson.name]; - if (!version.includes(workspace.packageJson.version)) { + console.log(`\n${bgBlue(' HUG ')} ${blue('Synchronizing inter peer dependencies')}${options.dryRun ? yellow(' [dry-run]') : ''}`); + projectsToRelease.forEach(projectToRelease => { + const projectToReleaseNewVersion = projectsVersionData[projectToRelease].newVersion ?? ''; + + Object.values(projects).forEach(project => { + const packageJsonPath = join(project.root, 'package.json'); + const packageJson = JSON.parse(readFileSync(join(workspaceRoot, packageJsonPath), 'utf8')) as PackageJson; + const peerDependencies = packageJson.peerDependencies ?? {}; + + if (Object.prototype.hasOwnProperty.call(peerDependencies, projectToRelease)) { + const version = peerDependencies[projectToRelease]; + if (!version.includes(projectToReleaseNewVersion)) { changesDetected = true; const versionRange = version.match(/(^[^\d]*)\d.*/)?.[1] ?? ''; - const newVersion = `${versionRange}${workspace.packageJson.version}`; + const newVersion = `${versionRange}${projectToReleaseNewVersion}`; if (!packageJsonFiles.length) { - console.log(`\n- ${blue(workspace.packageJson.name)}`); + console.log(blue(`\n- ${projectToRelease}`)); } - console.log(`\n${white('UPDATE')} ${workspace2.packageJsonPath}${options.dryRun ? yellow(' [dry-run]') : ''}\n`); + console.log(`\n${white('UPDATE')} ${packageJsonPath}${options.dryRun ? yellow(' [dry-run]') : ''}\n`); console.log(gray(' "peerDependencies": {')); - console.log(red(`- "${workspace.packageJson.name}": "${version}"`)); - console.log(green(`+ "${workspace.packageJson.name}": "${newVersion}"`)); + console.log(red(`- "${projectToRelease}": "${version}"`)); + console.log(green(`+ "${projectToRelease}": "${newVersion}"`)); console.log(gray(' }')); if (!options.dryRun) { - peerDependencies[workspace.packageJson.name] = newVersion; - workspace2.packageJson.peerDependencies = peerDependencies; - writeFileSync(join(workspaceRoot, workspace2.packageJsonPath), JSON.stringify(workspace2.packageJson, null, 4), { encoding: 'utf8' }); + peerDependencies[projectToRelease] = newVersion; + packageJson.peerDependencies = peerDependencies; + writeFileSync(join(workspaceRoot, packageJsonPath), JSON.stringify(packageJson, null, 4), { encoding: 'utf8' }); } - packageJsonFiles.push(workspace2.packageJsonPath); + packageJsonFiles.push(packageJsonPath); } } }); if (packageJsonFiles.length) { + exec('\nUpdating npm lock file:', 'npm', ['install'], options); + exec('\nStaging changed files with git:', 'git', ['add', 'package-lock.json', ...packageJsonFiles], options); exec( - `\n${bgBlue(' HUG ')} ${blue('Updating npm lock file')}${options.dryRun ? yellow(' [dry-run]') : ''}\n`, - 'npm', ['install'] - ); - exec( - `\n${bgBlue(' HUG ')} ${blue('Staging changed files with git')}${options.dryRun ? yellow(' [dry-run]') : ''}\n`, - 'git', ['add', 'package-lock.json', ...packageJsonFiles] - ); - exec( - `\n${bgBlue(' HUG ')} ${blue('Comitting changes with git')}${options.dryRun ? yellow(' [dry-run]') : ''}\n`, - 'git', ['commit', '--message', `deps(${workspace.packageJson.name}): upgrade to v${workspace.packageJson.version}`, '--message', '[skip ci]'] + '\nComitting changes with git:', + 'git', ['commit', '--message', `deps(${projectToRelease}): upgrade to v${projectToReleaseNewVersion}`, '--message', '[skip ci]'], + options ); packageJsonFiles = []; } }); + if (changesDetected) { exec( - `\n${bgBlue(' HUG ')} ${blue('Pushing to git remote')}${options.dryRun ? yellow(' [dry-run]') : ''}\n`, - 'git', ['push', '--follow-tags', '--no-verify', '--atomic'] + `\n${bgBlue(' HUG ')} ${blue('Pushing to git remote')}`, + 'git', ['push', '--follow-tags', '--no-verify', '--atomic'], + options, true ); } else { console.log('\nNo changes were needed, versions already in sync.'); } + return changesDetected; +}; + +const updateProjectsVersions = async (gitCommitMessage: string, options: Options): Promise<{ + projectsToRelease: string[]; + workspaceVersion: (string | null) | undefined; + projectsVersionData: VersionData; +}> => { + const { workspaceVersion, projectsVersionData } = await releaseVersion({ + projects: options.projects, + stageChanges: true, + gitCommit: true, + gitCommitMessage, + dryRun: options.dryRun, + verbose: options.verbose + }); + const projectsToRelease = Object.keys(projectsVersionData).filter(key => { + const { newVersion, currentVersion } = projectsVersionData[key]; + return (newVersion && (newVersion !== currentVersion)); + }); + if (projectsToRelease.length === 0) { + console.log('No affected projects found to be published'); + return process.exit(0); + } + return { projectsToRelease, workspaceVersion, projectsVersionData }; +}; + +void (async (): Promise => { + const projectGraph = await createProjectGraphAsync({ exitOnError: true }); + const { projects } = readProjectsConfigurationFromProjectGraph(projectGraph); + const options = await yargs + .version(false) + .option('projects', { + description: 'Projects filter to use for the release script', + type: 'array', + string: true, + default: [] + }) + .option('dry-run', { + description: 'Whether or not to perform a dry-run of the release process, defaults to false', + type: 'boolean', + default: false + }) + .option('verbose', { + description: 'Whether or not to enable verbose logging, defaults to false', + type: 'boolean', + default: false + }) + .parseAsync(); + /** - * Currently `nx release` does not update package-lock file correctly. - * - * TODO: remove this script if one day this feature is supported by `nx release` directly - * @see https://github.com/nrwl/nx/issues/26660 - * - * 14. Synchronize `package-lock.json` file + * 1. Resolve new versions of projects using semantic versioning + * 2. Update every projects `package.json` file with their new version + * 3. Update npm lock file + * 4. Stage changed files with git + * 5. Commit all previously staged files in git + * chore(release): update projects versions [skip ci] + * - project: @hug/ngx-abc 1.2.3 + * - project: @hug/ngx-xyz 4.5.6 */ - console.log(`\n${bgBlue(' HUG ')} ${blue('Synchronizing npm lock file')}${options.dryRun ? yellow(' [dry-run]') : ''}`); - exec(undefined, 'npm', ['install']); - exec(undefined, 'git', ['add', 'package.json', 'package-lock.json']); - exec(undefined, 'git', ['commit', '--message', 'chore: synchronize package.json and package-lock.json', '--message', '[skip ci]']); - exec(undefined, 'git', ['push', '--follow-tags', '--no-verify', '--atomic']); + let updates = await updateProjectsVersions('chore(release): update projects versions [skip ci]', options); /** - * Currently `nx release` publishes packages from their source directory by default. - * - * So we need to make sure `dist` are in sync and published instead. - * - * TODO: remove this script if one day this feature is supported by `nx release` directly - * @see https://github.com/nrwl/nx/issues/21855#issuecomment-1977360480 - * - * 15. Update project(s) `package.json` and `CHANGELOG.md` in dist + * 6. Synchronize inter peer dependencies + * For each project: + * - Update project's package.json file + * - Update npm lock file + * - Stage changed files with git + * - Commit all previously staged files in git + * deps(@hug/ngx-abc): upgrade to v1.2.3 + * [skip ci] + * 7. Push to git remote */ - console.log(`\n${bgBlue(' HUG ')} ${blue('Synchronizing dist packages')}${options.dryRun ? yellow(' [dry-run]') : ''}`); - projectsToRelease.forEach(project => { - const projectRoot = projects[project].root; - const projectName = projectRoot.substring('projects/'.length); - const projectNewVersion = projectsVersionData[project].newVersion ?? ''; - const distPackageJsonPath = join('dist', projectName, 'package.json'); - const distChangelogPath = join('dist', projectName, 'CHANGELOG.md'); + const needReUpdate = updateProjectsPeerDeps(updates.projectsToRelease, projects, updates.projectsVersionData, options); - console.log(`\n${blue(projects[project].name ?? '')} New version ${projectNewVersion} written to ${distPackageJsonPath}`); - if (!options.dryRun) { - const distPackageJson = JSON.parse(readFileSync(join(workspaceRoot, projectRoot, 'package.json'), 'utf8')) as PackageJson; - distPackageJson.version = projectNewVersion; - writeFileSync(join(workspaceRoot, distPackageJsonPath), JSON.stringify(distPackageJson, null, 4), { encoding: 'utf8' }); - } + /** + * If multiple projects were be released, synchronizing inter peer dependencies might have affected some of them. + * So we need to resolve new versions of projects once more. + * + * 8. Resolve new versions of projects using semantic versioning + * 9. Update every projects `package.json` file with their new version + * 10. Update npm lock file + * 11. Stage changed files with git + * 12. Commit all previously staged files in git + * chore(release): re-update projects versions [skip ci] + * - project: @hug/ngx-abc 1.2.3 + * - project: @hug/ngx-xyz 4.5.6 + */ + if (needReUpdate && (options.projects?.length > 1)) { + updates = await updateProjectsVersions('chore(release): re-update projects versions [skip ci]', options); + } - console.log(`${blue(projects[project].name ?? '')} Changelog updated in ${distChangelogPath}`); - if (!options.dryRun) { - copyFileSync(join(workspaceRoot, projectRoot, 'CHANGELOG.md'), join(workspaceRoot, distChangelogPath)); - } + /** + * 13. Update every projects `CHANGELOG.md` file + * 14. Stage changed files with git + * 15. Commit all previously staged files in git + * chore(release): update projects changelogs [skip ci] + * - project: @hug/ngx-abc 1.2.3 + * - project: @hug/ngx-xyz 4.5.6 + * 16. Tag commit with git + * @hug/ngx-abc@1.2.3 + * @hug/ngx-xyz@5.6.7 + * 17. Push to git remote + * 18. Create GitHub releases + */ + await releaseChangelog({ + projects: updates.projectsToRelease, + version: updates.workspaceVersion, + versionData: updates.projectsVersionData, + stageChanges: true, + gitCommit: true, + gitCommitMessage: 'chore(release): update projects changelogs [skip ci]', + gitTag: true, + dryRun: options.dryRun, + verbose: options.verbose }); /** - * Currently `nx release` does not allow to easily change the folder to be published. - * - * `nx.json#targetDefaults.nx-release-publish.options.packageRoot` could be used but can only interpolate: - * - {projectName}: which resolved to '@hug/ngx-xyz' (ie. package.json#name) - * - {projectRoot}: which resolved to 'projects/xyz' - * And what we need is actually `xyz` because Angular generates projects in `dist/xyz`. - * So to make it work, we use the hidden option (__overrides_unparsed__) and publish each project individually. - * - * 16. Publish to npm + * 19. Update projects `package.json` and `CHANGELOG.md` in their dist folder */ - let processStatus = 0; - if (!options.dryRun) { - for (const project of projectsToRelease) { - const projectName = projects[project].root.substring('projects/'.length); - const publishStatus = await releasePublish({ - __overrides_unparsed__: `--packageRoot=./dist/${projectName}`, - projects: [project], - dryRun: options.dryRun, - verbose: options.verbose - } as PublishOptions); - if (publishStatus !== 0) { - processStatus = publishStatus; - } - } - } + updateProjectsDists(updates.projectsToRelease, projects, updates.projectsVersionData, options); + + /** + * 20. Publish projects to npm + */ + const publishStatus = await publishProjects(updates.projectsToRelease, projects, options); - return process.exit(processStatus); + return process.exit(publishStatus); })();