From 74e7ada804bfe7a76b0972af859f57ebd2dc1270 Mon Sep 17 00:00:00 2001 From: Josep Boix Requesens Date: Tue, 2 Jul 2024 14:13:21 +0200 Subject: [PATCH] fix: publish pillarbox-suite to npm Automated the process of publishing pillarbox-suite packages to npm by updating necessary configurations and workflows. Changes include: - Updated GitHub Actions workflows to automate the publishing process to npm. - Modified package.json files to ensure correct npm configuration. - Added a LICENSE file to each package and updated the `create` script to automatically include one. --- .github/workflows/github-page.yml | 5 ----- .github/workflows/preview.yml | 5 ----- .github/workflows/quality.yml | 5 ----- .github/workflows/release.yml | 7 +------ docs/README.md | 15 +-------------- package-lock.json | 15 +++++++-------- package.json | 4 ++++ packages/pillarbox-playlist/LICENSE | 21 +++++++++++++++++++++ packages/pillarbox-playlist/README.md | 17 ++--------------- packages/pillarbox-playlist/package.json | 5 +++-- packages/skip-button/LICENSE | 21 +++++++++++++++++++++ packages/skip-button/README.md | 16 ++-------------- packages/skip-button/package.json | 5 +++-- scripts/create.js | 8 +++++++- scripts/template/LICENSE | 21 +++++++++++++++++++++ scripts/template/README.md.hbs | 17 ++--------------- scripts/template/package.json.hbs | 3 ++- 17 files changed, 97 insertions(+), 93 deletions(-) create mode 100644 packages/pillarbox-playlist/LICENSE create mode 100644 packages/skip-button/LICENSE create mode 100644 scripts/template/LICENSE diff --git a/.github/workflows/github-page.yml b/.github/workflows/github-page.yml index 09749fc..f3ef89b 100644 --- a/.github/workflows/github-page.yml +++ b/.github/workflows/github-page.yml @@ -16,11 +16,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20 - always-auth: true - registry-url: https://npm.pkg.github.com/ - scope: '@srgssr' - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 1cc3819..6462970 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -21,11 +21,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20 - always-auth: true - registry-url: https://npm.pkg.github.com/ - scope: '@srgssr' - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 97b92b8..4bf2162 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -18,11 +18,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20 - always-auth: true - registry-url: https://npm.pkg.github.com/ - scope: '@srgssr' - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55b8757..78776bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,11 +23,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20 - always-auth: true - registry-url: https://npm.pkg.github.com/ - scope: '@srgssr' - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies env : @@ -45,4 +40,4 @@ jobs: run: npm run release:ci -ws env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/docs/README.md b/docs/README.md index c338d7b..58b5514 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,20 +15,7 @@ To use the components in this suite, you need the following installed on your sy ## Quick Start -To get started with this suite, follow these steps: - -Add the `@srgssr` registry to your `.npmrc` file: - -```plaintext -//npm.pkg.github.com/:_authToken=TOKEN -@srgssr:registry=https://npm.pkg.github.com -``` - -Generate a personal access token on the [Personal Access Tokens page][token-settings]. For more -information on using tokens with GitHub packages, -visit: [Authenticating with a Personal Access Token][token-guide]. - -Clone this repository: +To get started with this suite, clone this repository: ```shell git clone https://github.com/SRGSSR/pillarbox-web-suite.git diff --git a/package-lock.json b/package-lock.json index 43b27f5..8df6195 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5874,10 +5874,9 @@ "link": true }, "node_modules/@srgssr/pillarbox-web": { - "version": "1.12.1", - "resolved": "https://npm.pkg.github.com/download/@srgssr/pillarbox-web/1.12.1/3f44c09ac56e6356c98ef3a9b583bcc4b5108e1c", - "integrity": "sha512-B2XJziRMJvlzXiPO2frNLl0SzEFQ8+1URzEbh9itd8dpABrtg5XGDA7rl2j7ZPpfTselGC7VCNaiQd28KGMKAQ==", - "license": "MIT", + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@srgssr/pillarbox-web/-/pillarbox-web-1.12.2.tgz", + "integrity": "sha512-DetyxIVre5RaSnWNsJRjir5qzur5tZ83NCkOB2bQ3qVr7PfL66vRDnke1ApueuPXtLfyUWSOBKVBZM1NUW6ZMA==", "dependencies": { "video.js": "^8.11.8", "videojs-contrib-eme": "^3.11.2" @@ -23606,10 +23605,10 @@ }, "packages/pillarbox-playlist": { "name": "@srgssr/pillarbox-playlist", - "version": "1.0.0", + "version": "1.2.0", "license": "MIT", "devDependencies": { - "@srgssr/pillarbox-web": "^1.12.1" + "@srgssr/pillarbox-web": "^1.12.2" }, "peerDependencies": { "video.js": "^8.0.0" @@ -23617,10 +23616,10 @@ }, "packages/skip-button": { "name": "@srgssr/skip-button", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "peerDependencies": { - "@srgssr/pillarbox-web": "^1.12.1" + "@srgssr/pillarbox-web": "^1.12.2" } } } diff --git a/package.json b/package.json index 2c44188..be63067 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,14 @@ "description": "A suite of plugins and themes for pillarbox-web", "version": "0.0.1", "license": "MIT", + "author": "SRG SSR", "repository": { "type": "git", "url": "git+https://github.com/SRGSSR/pillarbox-web-suite.git" }, + "publishConfig": { + "access": "public" + }, "homepage": "https://srgssr.github.io/pillarbox-web-suite", "type": "module", "workspaces": [ diff --git a/packages/pillarbox-playlist/LICENSE b/packages/pillarbox-playlist/LICENSE new file mode 100644 index 0000000..d9ef7ca --- /dev/null +++ b/packages/pillarbox-playlist/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 SRG SSR + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/pillarbox-playlist/README.md b/packages/pillarbox-playlist/README.md index aab969b..323e1cd 100644 --- a/packages/pillarbox-playlist/README.md +++ b/packages/pillarbox-playlist/README.md @@ -12,20 +12,7 @@ To use this plugin, you need the following installed on your system: ## Quick Start -To get started with this plugin, follow these steps: - -Add the `@srgssr` registry to your `.npmrc` file: - -```plaintext -//npm.pkg.github.com/:_authToken=TOKEN -@srgssr:registry=https://npm.pkg.github.com -``` - -Generate a personal access token on the [Personal Access Tokens page][token-settings]. For more -information on using tokens with GitHub packages, -visit: [Authenticating with a Personal Access Token][token-guide]. - -You can now install it through `npm` the following command: +To get started with this plugin, install it through the following command: ```bash npm install --save @srgssr/pillarbox-web @srgssr/pillarbox-playlist @@ -181,7 +168,7 @@ http://localhost:4200/?language=fr ## Licensing -This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for more +This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. [main-readme]: ../../docs/README.md#Contributing diff --git a/packages/pillarbox-playlist/package.json b/packages/pillarbox-playlist/package.json index cd00668..718dbb6 100644 --- a/packages/pillarbox-playlist/package.json +++ b/packages/pillarbox-playlist/package.json @@ -3,12 +3,13 @@ "description": "Add Playlist management capabilities to video.js", "version": "1.2.0", "license": "MIT", + "author": "SRG SSR", "repository": { "type": "git", "url": "git+https://github.com/SRGSSR/pillarbox-web-suite.git" }, "publishConfig": { - "registry": "https://npm.pkg.github.com/" + "access": "public" }, "homepage": "https://srgssr.github.io/pillarbox-web-suite/pillarbox-playlist", "type": "module", @@ -51,6 +52,6 @@ "video.js": "^8.0.0" }, "devDependencies": { - "@srgssr/pillarbox-web": "^1.12.1" + "@srgssr/pillarbox-web": "^1.12.2" } } diff --git a/packages/skip-button/LICENSE b/packages/skip-button/LICENSE new file mode 100644 index 0000000..d9ef7ca --- /dev/null +++ b/packages/skip-button/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 SRG SSR + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/skip-button/README.md b/packages/skip-button/README.md index 2deb156..742a814 100644 --- a/packages/skip-button/README.md +++ b/packages/skip-button/README.md @@ -12,19 +12,7 @@ To use this component, you need the following installed on your system: ## Quick Start -To get started with this component, follow these steps: - -Add the `@srgssr` registry to your `.npmrc` file: - -```plaintext -//npm.pkg.github.com/:_authToken=TOKEN -@srgssr:registry=https://npm.pkg.github.com -``` - -Generate an authentication token by following this -guide: [Authenticating with a personal access token][generate-token] - -You can now install it through `npm` the following command: +To get started with this component, install it through the following command: ```bash npm install --save @srgssr/pillarbox-web @srgssr/skip-button @@ -88,7 +76,7 @@ http://localhost:4200/?language=fr&urn=urn:rts:video:14318206 ## Licensing -This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for more +This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. [main-readme]: ../../docs/README.md#Contributing diff --git a/packages/skip-button/package.json b/packages/skip-button/package.json index 6c3df56..2d24fa0 100644 --- a/packages/skip-button/package.json +++ b/packages/skip-button/package.json @@ -3,12 +3,13 @@ "description": "A button to skip certain parts of the content, such as opening credits or end credits", "version": "1.0.1", "license": "MIT", + "author": "SRG SSR", "repository": { "type": "git", "url": "git+https://github.com/SRGSSR/pillarbox-web-suite.git" }, "publishConfig": { - "registry": "https://npm.pkg.github.com/" + "access": "public" }, "homepage": "https://srgssr.github.io/pillarbox-web-suite/skip-button", "type": "module", @@ -44,6 +45,6 @@ "test": "vitest run --silent --coverage --coverage.reporter text" }, "peerDependencies": { - "@srgssr/pillarbox-web": "^1.12.1" + "@srgssr/pillarbox-web": "^1.12.2" } } diff --git a/scripts/create.js b/scripts/create.js index 768faec..b695c3e 100644 --- a/scripts/create.js +++ b/scripts/create.js @@ -30,7 +30,12 @@ export default function(plop) { { type: 'input', name: 'name', - message: data => `What is the name of your ${data.type}?` + message: data => `What is the name of your ${data.type}?`, + validate: (value) => { + if ((/.+/).test(value)) { return true; } + + return 'Package name is required'; + } }, { type: 'confirm', @@ -52,6 +57,7 @@ export default function(plop) { ] : undefined }, data: { + currentYear: new Date().getFullYear(), importAlias: data.platform === 'pillarbox' ? '@srgssr/pillarbox-web' : 'video.js' } } diff --git a/scripts/template/LICENSE b/scripts/template/LICENSE new file mode 100644 index 0000000..678498c --- /dev/null +++ b/scripts/template/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) {{currentYear}} SRG SSR + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/scripts/template/README.md.hbs b/scripts/template/README.md.hbs index 348eff7..765b25e 100644 --- a/scripts/template/README.md.hbs +++ b/scripts/template/README.md.hbs @@ -13,20 +13,7 @@ To use this {{lowerCase type}}, you need the following installed on your system: ## Quick Start -To get started with this {{lowerCase type}}, follow these steps: - -Add the `@srgssr` registry to your `.npmrc` file: - -```plaintext -//npm.pkg.github.com/:_authToken=TOKEN -@srgssr:registry=https://npm.pkg.github.com -``` - -Generate a personal access token on the [Personal Access Tokens page][token-settings]. For more -information on using tokens with GitHub packages, -visit: [Authenticating with a Personal Access Token][token-guide]. - -You can now install it through `npm` the following command: +To get started with this {{lowerCase type}}, install it through the following command: ```bash npm install --save {{importAlias}} @srgssr/{{kebabCase name}} @@ -91,7 +78,7 @@ http://localhost:4200/?language=fr&urn=urn:rts:video:14318206 ## Licensing -This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for more +This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. [main-readme]: ../../docs/README.md#Contributing diff --git a/scripts/template/package.json.hbs b/scripts/template/package.json.hbs index dfe34ff..dce2341 100644 --- a/scripts/template/package.json.hbs +++ b/scripts/template/package.json.hbs @@ -2,12 +2,13 @@ "name": "@srgssr/{{kebabCase name}}", "version": "0.0.1", "license": "MIT", + "author": "SRG SSR", "repository": { "type": "git", "url": "git+https://github.com/SRGSSR/pillarbox-web-suite.git" }, "publishConfig": { - "registry": "https://npm.pkg.github.com/" + "access": "public" }, "homepage": "https://srgssr.github.io/pillarbox-web-suite/{{kebabCase name}}", "type": "module",