From 50327f65f681f76c5c6de9a4a20cdd179c4ee0c7 Mon Sep 17 00:00:00 2001 From: fabiovincenzi Date: Fri, 25 Apr 2025 10:56:26 +0200 Subject: [PATCH 1/2] chore: enable TS declarations, add build step to workflow, update ignores --- .github/workflows/sample-publish.yml | 25 +++++++++++++++++++------ .npmignore | 11 ++++++++++- package.json | 2 ++ tsconfig.json | 15 +++++++++++---- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sample-publish.yml b/.github/workflows/sample-publish.yml index 005af5ce1..552148e0e 100644 --- a/.github/workflows/sample-publish.yml +++ b/.github/workflows/sample-publish.yml @@ -9,7 +9,7 @@ permissions: contents: read jobs: - build: + build-and-publish: runs-on: ubuntu-latest steps: - name: Harden Runner @@ -17,14 +17,27 @@ jobs: with: egress-policy: audit - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 + - name: Checkout repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Setup Node.js # Setup .npmrc file to publish to npm + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 with: node-version: '18.x' registry-url: 'https://registry.npmjs.org' - - name: publish sample package - run: npm install --include peer && npm publish --access=public + + - name: Install dependencies + working-directory: plugins/git-proxy-plugin-samples + run: npm ci + + - name: Build TypeScript + working-directory: plugins/git-proxy-plugin-samples + run: npm run build + + - name: Install peers and publish working-directory: plugins/git-proxy-plugin-samples + run: | + npm install --include=peer + npm publish --access=public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.npmignore b/.npmignore index 27087e67d..baaf02578 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,12 @@ # This file required to override .gitignore when publishing to npm +src/ +tests/ +*.test.ts + +tsconfig.json +jest.config.js +.eslintrc.js +.prettierrc + website/ -plugins/ +plugins/ \ No newline at end of file diff --git a/package.json b/package.json index 757dfbd92..22d66f8e7 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,8 @@ "name": "@finos/git-proxy", "version": "1.10.0", "description": "Deploy custom push protections and policies on top of Git.", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "cli": "node ./packages/git-proxy-cli/index.js", "client": "vite --config vite.config.js", diff --git a/tsconfig.json b/tsconfig.json index 805153d01..331c876ef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,13 +7,20 @@ "jsx": "react-jsx", "moduleResolution": "Node", "strict": true, - "noEmit": true, "skipLibCheck": true, - "isolatedModules": true, + "isolatedModules": false, "module": "CommonJS", "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "resolveJsonModule": true + "resolveJsonModule": true, + + "declaration": true, + "declarationMap": true, + "outDir": "./dist", + "rootDir": "./src", + "noEmit": false, + "types": ["node"] }, - "include": ["src"] + "include": ["src"], + "exclude": ["node_modules", "dist", "**/*.test.ts"] } From aed35decd03659ab93d00d3ba3f9f5efe4050b9e Mon Sep 17 00:00:00 2001 From: fabiovincenzi Date: Fri, 25 Apr 2025 10:56:26 +0200 Subject: [PATCH 2/2] chore: enable TS declarations, add build step to workflow, update ignores --- .github/workflows/sample-publish.yml | 25 +++++++++++++++++++------ .npmignore | 13 ++++++++++--- package.json | 2 ++ tsconfig.json | 17 +++++++++++------ 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.github/workflows/sample-publish.yml b/.github/workflows/sample-publish.yml index b6db78b02..ab63a5cbf 100644 --- a/.github/workflows/sample-publish.yml +++ b/.github/workflows/sample-publish.yml @@ -9,7 +9,7 @@ permissions: contents: read jobs: - build: + build-and-publish: runs-on: ubuntu-latest steps: - name: Harden Runner @@ -17,14 +17,27 @@ jobs: with: egress-policy: audit - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + - name: Checkout repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Setup Node.js # Setup .npmrc file to publish to npm + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 with: node-version: '20.x' registry-url: 'https://registry.npmjs.org' - - name: publish sample package - run: npm install --include peer && npm publish --access=public + + - name: Install dependencies + working-directory: plugins/git-proxy-plugin-samples + run: npm ci + + - name: Build TypeScript + working-directory: plugins/git-proxy-plugin-samples + run: npm run build + + - name: Install peers and publish working-directory: plugins/git-proxy-plugin-samples + run: | + npm install --include=peer + npm publish --access=public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.npmignore b/.npmignore index 286c7a75f..baaf02578 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,12 @@ # This file required to override .gitignore when publishing to npm +src/ +tests/ +*.test.ts + +tsconfig.json +jest.config.js +.eslintrc.js +.prettierrc + website/ -plugins/ -experimental/ -cypress/ +plugins/ \ No newline at end of file diff --git a/package.json b/package.json index 40885046d..2d526e19b 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,8 @@ "name": "@finos/git-proxy", "version": "1.17.2", "description": "Deploy custom push protections and policies on top of Git.", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "cli": "node ./packages/git-proxy-cli/index.js", "client": "vite --config vite.config.js", diff --git a/tsconfig.json b/tsconfig.json index a389ca8c7..331c876ef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,15 +7,20 @@ "jsx": "react-jsx", "moduleResolution": "Node", "strict": true, - "noEmit": true, - "declaration": true, "skipLibCheck": true, - "isolatedModules": true, + "isolatedModules": false, "module": "CommonJS", "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "resolveJsonModule": true + "resolveJsonModule": true, + + "declaration": true, + "declarationMap": true, + "outDir": "./dist", + "rootDir": "./src", + "noEmit": false, + "types": ["node"] }, - "include": ["."], - "exclude": ["experimental/**", "plugins/**"] + "include": ["src"], + "exclude": ["node_modules", "dist", "**/*.test.ts"] }