Skip to content

Commit

Permalink
Switch to pnpm (#1134)
Browse files Browse the repository at this point in the history
* Switch to pnpm

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

* Use corepack in workflow

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

---------

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu authored Jun 4, 2024
1 parent df888c3 commit 3b698cd
Show file tree
Hide file tree
Showing 22 changed files with 5,985 additions and 10,044 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/dockertests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ jobs:
./contrib/free_disk_space.sh
- name: npm install, build and test
run: |
npm install
npm test
corepack enable
corepack pnpm install
corepack pnpm test
mkdir -p bomresults repotests
env:
CI: true
Expand Down Expand Up @@ -93,8 +94,9 @@ jobs:
./contrib/free_disk_space.sh
- name: npm install, build and test
run: |
npm install
npm test
corepack enable
corepack pnpm install
corepack pnpm test
mkdir -p bomresults repotests
env:
CI: true
Expand Down Expand Up @@ -138,7 +140,8 @@ jobs:
./contrib/free_disk_space.sh
- name: npm install, build and test
run: |
npm install
corepack enable
corepack pnpm install
mkdir -p bomresults
env:
CI: true
Expand Down Expand Up @@ -176,7 +179,8 @@ jobs:
java-version: ${{ matrix.java-version }}
- name: npm install, build
run: |
npm install
corepack enable
corepack pnpm install
mkdir bomresults
env:
CI: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/java-reachables-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: npm install, build
run: |
npm install
npm run build --if-present
corepack enable
corepack pnpm install
mkdir -p repotests
mkdir -p bomresults
- uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
node-version-file: .nvmrc
- name: Check Linting
run: |
npm install
npm run lint:check
corepack enable
corepack pnpm install
corepack pnpm run lint:check
env:
CI: true
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
python-version: 3.11
- name: npm install, build and test
run: |
npm install
npm run build --if-present
npm test
corepack enable
corepack pnpm install
corepack pnpm test
env:
CI: true
- name: check sbom for vulns
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@ jobs:
- name: Release npm package
if: startsWith(github.ref, 'refs/tags/')
run: |
corepack enable
corepack pnpm install
npm config set //npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
echo "cyclonedx:registry=https://npm.pkg.github.com" > ~/.npmrc
npm publish --access=public --@cyclonedx:registry='https://npm.pkg.github.com'
corepack pnpm publish --access=public --@cyclonedx:registry='https://npm.pkg.github.com'
echo "cyclonedx:registry=https://registry.npmjs.org" > ~/.npmrc
npm publish --provenance --access=public --@cyclonedx:registry='https://registry.npmjs.org'
corepack pnpm publish --provenance --access=public --@cyclonedx:registry='https://registry.npmjs.org'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: jsr publish
if: startsWith(github.ref, 'refs/tags/')
run: |
npm install
corepack enable
corepack pnpm install
npx jsr publish --allow-dirty
continue-on-error: true
env:
Expand Down Expand Up @@ -109,7 +112,8 @@ jobs:
continue-on-error: true
- name: Attach cdx sbom
run: |
npm install
corepack enable
corepack pnpm install
node bin/cdxgen.js -t docker -o bom.json ghcr.io/cyclonedx/cdxgen:latest
oras attach --artifact-type sbom/cyclonedx ghcr.io/cyclonedx/cdxgen:latest ./bom.json:application/json
oras discover -o tree ghcr.io/cyclonedx/cdxgen:latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-atom-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
java-version: '21'
- name: npm install, build and test
run: |
npm install
npm run build --if-present
corepack enable
corepack pnpm install
mkdir -p repotests
mkdir -p bomresults
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/repotests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
run: choco install -y bazel
- name: npm install, build and test
run: |
npm install
npm run build --if-present
npm test
corepack enable
corepack pnpm install
corepack pnpm test
mkdir -p repotests
mkdir -p bomresults
mkdir -p denoresults
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/snapshot-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ jobs:

- name: Atom, cdxgen, sdkman, custom-json-diff installs
run: |
cdxgen_version=$(npm pack | tail -1)
npm install -g "$cdxgen_version"
corepack enable
cdxgen_version=$(corepack pnpm pack | tail -1)
corepack pnpm install -g "$cdxgen_version"
python -m pip install --upgrade pip
python -m pip install pytest
git clone https://github.com/appthreat/cdxgen-samples.git /home/runner/work/samples
git clone https://github.com/appthreat/custom-json-diff.git /home/runner/work/custom-json-diff
cd /home/runner/work/custom-json-diff
python -m pip install .
npm install -g @appthreat/atom
corepack pnpm install -g @appthreat/atom
curl -s "https://get.sdkman.io" | bash
source "/home/runner/.sdkman/bin/sdkman-init.sh"
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,14 @@ Please check out our [contribute to CycloneDX/cdxgen documentation][github-contr
Before raising a PR, please run the following commands.

```bash
corepack enable
corepack pnpm install
# Generate types using jsdoc syntax
npm run gen-types
corepack pnpm run gen-types
# Run biomejs formatter and linter with auto fix
npm run lint
corepack pnpm run lint
# Run jest tests
npm test
corepack pnpm test
```

<!-- LINK LABELS -->
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ RUN set -e; \
&& gem --version \
&& bundler --version
COPY . /opt/cdxgen
RUN cd /opt/cdxgen && npm install --omit=dev \
RUN cd /opt/cdxgen && corepack enable && corepack pnpm install --prod \
&& mkdir -p /opt/cdxgen-node-cache \
&& chown -R cyclonedx:cyclonedx /opt/cdxgen /opt/cdxgen-node-cache \
&& chmod a-w -R /opt \
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile-bun
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL maintainer="cyclonedx" \
org.opencontainers.image.authors="Prabhu Subramanian <prabhu@appthreat.com>" \
org.opencontainers.image.source="https://github.com/cyclonedx/cdxgen" \
org.opencontainers.image.url="https://github.com/cyclonedx/cdxgen" \
org.opencontainers.image.version="10.5.x" \
org.opencontainers.image.version="10.6.x" \
org.opencontainers.image.vendor="cyclonedx" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.title="cdxgen" \
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile-deno
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL maintainer="cyclonedx" \
org.opencontainers.image.authors="Prabhu Subramanian <prabhu@appthreat.com>" \
org.opencontainers.image.source="https://github.com/cyclonedx/cdxgen" \
org.opencontainers.image.url="https://github.com/cyclonedx/cdxgen" \
org.opencontainers.image.version="10.5.x" \
org.opencontainers.image.version="10.6.x" \
org.opencontainers.image.vendor="cyclonedx" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.title="cdxgen" \
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile-ppc64
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ RUN set -e; \
&& gem --version \
&& bundler --version
COPY . /opt/cdxgen
RUN cd /opt/cdxgen && npm install --omit=dev \
RUN cd /opt/cdxgen && corepack enable && corepack pnpm install --prod \
&& chown -R cyclonedx:cyclonedx /opt/cdxgen \
&& chmod a-w -R /opt \
&& rm -rf /root/.cache /var/cache/yum /root/.cargo \
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "10.5.2",
"version": "10.6.0",
"exports": "./index.js",
"compilerOptions": {
"allowJs": true,
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "10.5.2",
"version": "10.6.0",
"exports": "./index.js",
"include": ["*.js", "bin/**", "data/**", "types/**"],
"exclude": ["test/", "docs/", "contrib/", "ci/", "tools_config/"]
Expand Down
Loading

0 comments on commit 3b698cd

Please sign in to comment.