From 6431ea589a9fa299d781fa139e8171d71992919a Mon Sep 17 00:00:00 2001 From: Loxeris Date: Tue, 16 Jul 2024 10:44:39 +0200 Subject: [PATCH] ci: test npm publishing --- .github/workflows/deployment.yml | 13 +++++-------- .npmrc | 1 - package-lock.json | 6 +++--- package.json | 4 ++-- packages/diracx-web-components/package.json | 7 +++++-- packages/diracx-web-extension-example/README.md | 4 ++-- .../diracx-web-extension-example/package-lock.json | 2 +- packages/diracx-web-extension-example/package.json | 2 +- .../src/app/(dashboard)/layout.tsx | 9 +++------ .../src/app/(dashboard)/page.tsx | 6 +++--- .../src/app/auth/layout.tsx | 2 +- .../src/app/auth/page.tsx | 2 +- .../diracx-web-extension-example/src/app/layout.tsx | 2 +- .../src/example-extension/applicationList.ts | 4 ++-- .../components/applications/testApp.tsx | 4 ++-- packages/diracx-web/package.json | 2 +- packages/diracx-web/src/app/(dashboard)/layout.tsx | 7 ++----- packages/diracx-web/src/app/(dashboard)/page.tsx | 4 ++-- packages/diracx-web/src/app/auth/layout.tsx | 2 +- packages/diracx-web/src/app/auth/page.tsx | 2 +- 20 files changed, 39 insertions(+), 46 deletions(-) delete mode 100644 .npmrc diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 460ca3c9..9738c665 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -30,8 +30,7 @@ jobs: build-deploy-library-package: runs-on: ubuntu-latest - needs: release-please - if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && needs.release-please.outputs.release_created == 'true' }} + if: ${{ github.event_name == 'push' }} permissions: contents: read packages: write @@ -41,18 +40,16 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 'latest' - registry-url: 'https://npm.pkg.github.com' - # Defaults to the user or organization that owns the workflow file - scope: '@diracgrid' + registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci # Release Please has already incremented versions and published tags, so we just - # need to publish all unpublished versions to GitHub here - - name: Publish to GitHub Packages + # need to publish all unpublished versions to NPM here + - name: Publish to NPM env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} run: npx lerna publish from-package --no-push --no-private --yes build-deploy-dev-image: diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 588b6160..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -@diracgrid:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c300f966..550e5e85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1605,7 +1605,7 @@ "ms": "^2.1.1" } }, - "node_modules/@diracgrid/diracx-web-components": { + "node_modules/@dirac-grid/test-lib": { "resolved": "packages/diracx-web-components", "link": true }, @@ -20663,7 +20663,7 @@ "hasInstallScript": true, "dependencies": { "@axa-fr/react-oidc": "^7.22.6", - "@diracgrid/diracx-web-components": "^0.1.0-a1", + "@dirac-grid/test-lib": "^0.1.0-a1", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/icons-material": "^5.15.18", @@ -20703,7 +20703,7 @@ } }, "packages/diracx-web-components": { - "name": "@diracgrid/diracx-web-components", + "name": "@dirac-grid/test-lib", "version": "0.1.0-a1", "license": "GPL-3.0", "dependencies": { diff --git a/package.json b/package.json index f01fcb5d..dd082fef 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "dev": "lerna run dev --parallel", "test": "lerna run test", "build": "lerna run build", - "build-lib": "lerna run build --scope @diracgrid/diracx-web-components", + "build-lib": "lerna run build --scope @dirac-grid/test-lib", "lint": "lerna run lint", "ts-lint": "lerna run ts-lint", - "pack": "npm pack -w @diracgrid/diracx-web-components" + "pack": "npm pack -w @dirac-grid/test-lib" } } diff --git a/packages/diracx-web-components/package.json b/packages/diracx-web-components/package.json index 2d28fb89..de788846 100644 --- a/packages/diracx-web-components/package.json +++ b/packages/diracx-web-components/package.json @@ -1,8 +1,11 @@ { - "name": "@diracgrid/diracx-web-components", - "version": "0.1.0-a1", + "name": "@dirac-grid/test-lib", + "version": "0.1.0-a1-test", "repository": "https://github.com/DIRACGrid/diracx-web", "description": "Useful components for diracx-web", + "publishConfig": { + "access": "public" + }, "scripts": { "build": "tsup --minify", "dev": "tsup --watch", diff --git a/packages/diracx-web-extension-example/README.md b/packages/diracx-web-extension-example/README.md index 1d9be297..200fdc63 100644 --- a/packages/diracx-web-extension-example/README.md +++ b/packages/diracx-web-extension-example/README.md @@ -81,8 +81,8 @@ To add new apps to your extension, you can create new components in your extensi It is then pretty easy to add them to DiracX Web by extending the `applicationList` from `diracx-web-components/components`, and passing the new list to the `ApplicationProvider` from `diracx-web-components/contexts`. ```tsx -import { ApplicationProvider } from "@diracgrid/diracx-web-components/contexts"; -import { applicationList } from "@diracgrid/diracx-web-components/components"; +import { ApplicationProvider } from "@dirac-grid/test-lib/contexts"; +import { applicationList } from "@dirac-grid/test-lib/components"; const newApp = { name: "New App", diff --git a/packages/diracx-web-extension-example/package-lock.json b/packages/diracx-web-extension-example/package-lock.json index 7db587c9..fc1a3b4b 100644 --- a/packages/diracx-web-extension-example/package-lock.json +++ b/packages/diracx-web-extension-example/package-lock.json @@ -11,7 +11,7 @@ "license": "GPL-3.0-only", "dependencies": { "autoprefixer": "10.4.19", - "@diracgrid/diracx-web-components": "^0.1.0", + "@dirac-grid/test-lib": "^0.1.0", "next": "14.2.3", "react": "^18", "react-dom": "^18" diff --git a/packages/diracx-web-extension-example/package.json b/packages/diracx-web-extension-example/package.json index 8118b1fc..960b2773 100644 --- a/packages/diracx-web-extension-example/package.json +++ b/packages/diracx-web-extension-example/package.json @@ -11,7 +11,7 @@ "postinstall": "node ./node_modules/@axa-fr/react-oidc/bin/copy-service-worker-files.mjs public" }, "dependencies": { - "@diracgrid/diracx-web-components": "file:diracx-web-components-0.1.0.tgz", + "@dirac-grid/test-lib": "file:diracx-web-components-0.1.0.tgz", "autoprefixer": "10.4.19", "next": "14.2.3", "react": "^18", diff --git a/packages/diracx-web-extension-example/src/app/(dashboard)/layout.tsx b/packages/diracx-web-extension-example/src/app/(dashboard)/layout.tsx index 8f2d9386..445f4246 100644 --- a/packages/diracx-web-extension-example/src/app/(dashboard)/layout.tsx +++ b/packages/diracx-web-extension-example/src/app/(dashboard)/layout.tsx @@ -3,15 +3,12 @@ import * as React from "react"; import CssBaseline from "@mui/material/CssBaseline"; import { Box } from "@mui/material"; import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles"; -import { - OIDCSecure, - Dashboard, -} from "@diracgrid/diracx-web-components/components"; +import { OIDCSecure, Dashboard } from "@dirac-grid/test-lib/components"; import { ApplicationsProvider, NavigationProvider, -} from "@diracgrid/diracx-web-components/contexts"; -import { useMUITheme } from "@diracgrid/diracx-web-components/hooks"; +} from "@dirac-grid/test-lib/contexts"; +import { useMUITheme } from "@dirac-grid/test-lib/hooks"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { applicationList } from "@/example-extension/applicationList"; import { defaultSections } from "@/example-extension/defaultSections"; diff --git a/packages/diracx-web-extension-example/src/app/(dashboard)/page.tsx b/packages/diracx-web-extension-example/src/app/(dashboard)/page.tsx index 5f08ed8b..84176b3a 100644 --- a/packages/diracx-web-extension-example/src/app/(dashboard)/page.tsx +++ b/packages/diracx-web-extension-example/src/app/(dashboard)/page.tsx @@ -1,8 +1,8 @@ "use client"; import React, { useEffect } from "react"; -import { UserDashboard } from "@diracgrid/diracx-web-components/components"; -import { ApplicationsContext } from "@diracgrid/diracx-web-components/contexts"; -import { useSearchParamsUtils } from "@diracgrid/diracx-web-components/hooks"; +import { UserDashboard } from "@dirac-grid/test-lib/components"; +import { ApplicationsContext } from "@dirac-grid/test-lib/contexts"; +import { useSearchParamsUtils } from "@dirac-grid/test-lib/hooks"; import { applicationList } from "@/example-extension/applicationList"; export default function Page() { diff --git a/packages/diracx-web-extension-example/src/app/auth/layout.tsx b/packages/diracx-web-extension-example/src/app/auth/layout.tsx index afdc051c..4f4557ac 100644 --- a/packages/diracx-web-extension-example/src/app/auth/layout.tsx +++ b/packages/diracx-web-extension-example/src/app/auth/layout.tsx @@ -1,7 +1,7 @@ "use client"; import React from "react"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { NavigationProvider } from "@diracgrid/diracx-web-components/contexts"; +import { NavigationProvider } from "@dirac-grid/test-lib/contexts"; export default function AuthLayout({ children, diff --git a/packages/diracx-web-extension-example/src/app/auth/page.tsx b/packages/diracx-web-extension-example/src/app/auth/page.tsx index 6c38e087..b1f09f73 100644 --- a/packages/diracx-web-extension-example/src/app/auth/page.tsx +++ b/packages/diracx-web-extension-example/src/app/auth/page.tsx @@ -1,5 +1,5 @@ "use client"; -import { LoginForm } from "@diracgrid/diracx-web-components/components"; +import { LoginForm } from "@dirac-grid/test-lib/components"; export default function Page() { return ; diff --git a/packages/diracx-web-extension-example/src/app/layout.tsx b/packages/diracx-web-extension-example/src/app/layout.tsx index fbacebef..74456852 100644 --- a/packages/diracx-web-extension-example/src/app/layout.tsx +++ b/packages/diracx-web-extension-example/src/app/layout.tsx @@ -2,7 +2,7 @@ import { Inter } from "next/font/google"; import { OIDCConfigurationProvider, ThemeProvider, -} from "@diracgrid/diracx-web-components/contexts"; +} from "@dirac-grid/test-lib/contexts"; const inter = Inter({ subsets: ["latin"] }); diff --git a/packages/diracx-web-extension-example/src/example-extension/applicationList.ts b/packages/diracx-web-extension-example/src/example-extension/applicationList.ts index 5da7647f..0b3f6fa5 100644 --- a/packages/diracx-web-extension-example/src/example-extension/applicationList.ts +++ b/packages/diracx-web-extension-example/src/example-extension/applicationList.ts @@ -1,5 +1,5 @@ -import { applicationList } from "@diracgrid/diracx-web-components/components"; -import { ApplicationConfig } from "@diracgrid/diracx-web-components/types"; +import { applicationList } from "@dirac-grid/test-lib/components"; +import { ApplicationConfig } from "@dirac-grid/test-lib/types"; import { BugReport } from "@mui/icons-material"; import TestApp from "@/example-extension/components/applications/testApp"; diff --git a/packages/diracx-web-extension-example/src/example-extension/components/applications/testApp.tsx b/packages/diracx-web-extension-example/src/example-extension/components/applications/testApp.tsx index b730eb4b..f9fb92db 100644 --- a/packages/diracx-web-extension-example/src/example-extension/components/applications/testApp.tsx +++ b/packages/diracx-web-extension-example/src/example-extension/components/applications/testApp.tsx @@ -1,8 +1,8 @@ "use client"; import * as React from "react"; import { useOidcAccessToken } from "@axa-fr/react-oidc"; -import { ApplicationHeader } from "@diracgrid/diracx-web-components/components"; -import { useOIDCContext } from "@diracgrid/diracx-web-components/hooks"; +import { ApplicationHeader } from "@dirac-grid/test-lib/components"; +import { useOIDCContext } from "@dirac-grid/test-lib/hooks"; import { Box } from "@mui/material"; /** diff --git a/packages/diracx-web/package.json b/packages/diracx-web/package.json index 709f0f96..c9e25201 100644 --- a/packages/diracx-web/package.json +++ b/packages/diracx-web/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@axa-fr/react-oidc": "^7.22.6", - "@diracgrid/diracx-web-components": "^0.1.0-a1", + "@dirac-grid/test-lib": "^0.1.0-a1", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/icons-material": "^5.15.18", diff --git a/packages/diracx-web/src/app/(dashboard)/layout.tsx b/packages/diracx-web/src/app/(dashboard)/layout.tsx index e244e043..345b1537 100644 --- a/packages/diracx-web/src/app/(dashboard)/layout.tsx +++ b/packages/diracx-web/src/app/(dashboard)/layout.tsx @@ -1,11 +1,8 @@ "use client"; import React from "react"; import { Box } from "@mui/material"; -import { DiracXWebProviders } from "@diracgrid/diracx-web-components/contexts"; -import { - OIDCSecure, - Dashboard, -} from "@diracgrid/diracx-web-components/components"; +import { DiracXWebProviders } from "@dirac-grid/test-lib/contexts"; +import { OIDCSecure, Dashboard } from "@dirac-grid/test-lib/components"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; export default function DashboardLayout({ diff --git a/packages/diracx-web/src/app/(dashboard)/page.tsx b/packages/diracx-web/src/app/(dashboard)/page.tsx index 14e8c395..71dbea37 100644 --- a/packages/diracx-web/src/app/(dashboard)/page.tsx +++ b/packages/diracx-web/src/app/(dashboard)/page.tsx @@ -4,8 +4,8 @@ import { useSearchParams } from "next/navigation"; import { UserDashboard, applicationList, -} from "@diracgrid/diracx-web-components/components"; -import { ApplicationsContext } from "@diracgrid/diracx-web-components/contexts"; +} from "@dirac-grid/test-lib/components"; +import { ApplicationsContext } from "@dirac-grid/test-lib/contexts"; export default function Page() { const searchParams = useSearchParams(); diff --git a/packages/diracx-web/src/app/auth/layout.tsx b/packages/diracx-web/src/app/auth/layout.tsx index fe296c17..eceedcdd 100644 --- a/packages/diracx-web/src/app/auth/layout.tsx +++ b/packages/diracx-web/src/app/auth/layout.tsx @@ -1,6 +1,6 @@ "use client"; import React from "react"; -import { DiracXWebProviders } from "@diracgrid/diracx-web-components/contexts"; +import { DiracXWebProviders } from "@dirac-grid/test-lib/contexts"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; export default function AuthLayout({ diff --git a/packages/diracx-web/src/app/auth/page.tsx b/packages/diracx-web/src/app/auth/page.tsx index 6c38e087..b1f09f73 100644 --- a/packages/diracx-web/src/app/auth/page.tsx +++ b/packages/diracx-web/src/app/auth/page.tsx @@ -1,5 +1,5 @@ "use client"; -import { LoginForm } from "@diracgrid/diracx-web-components/components"; +import { LoginForm } from "@dirac-grid/test-lib/components"; export default function Page() { return ;