From 8d8965e49a6c68e0129c68b854b3550521b293f5 Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Wed, 20 Mar 2024 11:26:58 +0100 Subject: [PATCH 1/2] config: Changes package name to include scope --- package.json | 10 +++++----- vite.config.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9210525..07a39c2 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "design-system-marque-blanche", + "name": "@octo-technology/dsocto", "version": "1.0.0", - "main": "./dist/design-system-marque-blanche.cjs", - "module": "./dist/design-system-marque-blanche.js", + "main": "./dist/dsocto.cjs", + "module": "./dist/dsocto.js", "exports": { ".": { - "import": "./dist/design-system-marque-blanche.js", - "require": "./dist/design-system-marque-blanche.cjs" + "import": "./dist/dsocto.js", + "require": "./dist/dsocto.cjs" } }, "type": "module", diff --git a/vite.config.ts b/vite.config.ts index 2702034..5f5c5ca 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,8 +11,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'src/main.ts'), - name: 'design-system-marque-blanche', - fileName: 'design-system-marque-blanche' + name: 'dsocto', + fileName: 'dsocto' }, rollupOptions: { // make sure to externalize deps that shouldn't be bundled From 8a60098ff9032b526d9dc57280136288587b78ec Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Wed, 20 Mar 2024 17:01:03 +0100 Subject: [PATCH 2/2] CI: Add package publication to workflow --- .github/workflows/CD.yml | 25 +++++++++++++++++++++++++ .gitignore | 2 ++ .npmignore | 34 ++++++++++++++++++++++++++++++++++ package.json | 4 ++++ 4 files changed, 65 insertions(+) create mode 100644 .npmignore diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index c1eed73..dd7c2f6 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -35,3 +35,28 @@ jobs: uses: actions/deploy-pages@v4 with: artifact_name: "storybook-latest" + publish-package: + needs: build + permissions: + packages: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + # TODO: add version to a .nvmrc or at least a variable + node-version: 18.12.1 + cache: npm + registry-url: 'https://npm.pkg.github.com' + - name: Install + run: npm ci --omit=dev --prefer-offline + - name: Download dist + uses: actions/download-artifact@v4 + with: + name: "lib-latest" + path: "./dist" + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 4f6a59a..865e3d1 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ coverage *storybook.log storybook-static + +.npmrc diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..cea99ea --- /dev/null +++ b/.npmignore @@ -0,0 +1,34 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +*.tsbuildinfo + +*storybook.log +storybook-static + +.npmrc diff --git a/package.json b/package.json index 07a39c2..de724e8 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,10 @@ "require": "./dist/dsocto.cjs" } }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, + "repository": "https://github.com/octo-technology/Design-System---Marque-Blanche.git", "type": "module", "scripts": { "build": "vite build",