Skip to content

Commit 51edb5a

Browse files
committed
update to use csproj if present, fallback to generated if not.
1 parent 1a77478 commit 51edb5a

File tree

5 files changed

+394
-56
lines changed

5 files changed

+394
-56
lines changed

Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
# Build on the official .NET SDK image (Debian-based)
2-
# Using 8.0 LTS for stability and long-term support
31
FROM mcr.microsoft.com/dotnet/sdk:8.0
42

5-
# Install Node.js (required for the script)
63
RUN apt-get update && apt-get install -y --no-install-recommends curl \
74
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
85
&& apt-get install -y --no-install-recommends nodejs \
96
&& apt-get clean \
107
&& rm -rf /var/lib/apt/lists/*
118

12-
# Create a workspace and copy entrypoint script
9+
COPY convert-nuget.js package.json package-lock.json /tool/
1310
WORKDIR /tool
14-
COPY convert-nuget.js /tool/convert-nuget.js
11+
RUN npm install --production && chmod +x convert-nuget.js
1512

16-
RUN chmod +x /tool/convert-nuget.js
17-
18-
# Default entrypoint: process current working directory
13+
# Default working directory (can be overridden with -w)
1914
# The working directory should be mounted as a volume when running:
2015
# docker run -v "$(pwd):/workspace" -w /workspace <image> [options]
16+
WORKDIR /workspace
2117
ENTRYPOINT ["node", "/tool/convert-nuget.js"]

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Recursively searches for `packages.config` files and converts each to `packages.
55
## Manual Usage
66

77
```bash
8-
node convert-nuget.js [--tfm <TFM>] [--root <DIR>]
8+
node convert-nuget.js [--tfm <TFM>] [--root <DIR>] [--fail-on-skipped]
99

1010
# Example: scan from current directory
1111
node convert-nuget.js
@@ -15,6 +15,9 @@ node convert-nuget.js --tfm net48
1515

1616
# Example: scan from a specific directory
1717
node convert-nuget.js --root ./projects
18+
19+
# Example: fail if any packages are skipped due to incompatibility
20+
node convert-nuget.js --fail-on-skipped
1821
```
1922

2023
## Local Docker Usage
@@ -26,13 +29,14 @@ Pull the Docker image from GitHub Container Registry and run it locally:
2629
docker pull ghcr.io/semgrep/convert-nuget
2730

2831
# Run the conversion (scan from current directory)
29-
docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/semgrep/convert-nuget
32+
# Note: -w /workspace is optional since /workspace is the default working directory
33+
docker run --rm -v $(pwd):/workspace ghcr.io/semgrep/convert-nuget
3034

3135
# Run the conversion (scan from a specific subdirectory)
32-
docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/semgrep/convert-nuget --root /workspace/some/subdirectory
36+
docker run --rm -v $(pwd):/workspace ghcr.io/semgrep/convert-nuget --root /workspace/some/subdirectory
3337

3438
# Run with custom target framework
35-
docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/semgrep/convert-nuget --tfm net48
39+
docker run --rm -v $(pwd):/workspace ghcr.io/semgrep/convert-nuget --tfm net48
3640
```
3741

3842
## Docker CI Usage
@@ -41,17 +45,17 @@ docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/semgrep/convert-nuget
4145
# GitHub Actions example
4246
- name: Convert packages.config
4347
run: |
44-
docker run -v ${{ github.workspace }}:/workspace -w /workspace ghcr.io/semgrep/convert-nuget
48+
docker run -v ${{ github.workspace }}:/workspace ghcr.io/semgrep/convert-nuget
4549
4650
# GitLab CI example
4751
convert-nuget:
4852
script:
49-
- docker run -v $PWD:/workspace -w /workspace ghcr.io/semgrep/convert-nuget
53+
- docker run -v $PWD:/workspace ghcr.io/semgrep/convert-nuget
5054
```
5155
5256
```bash
53-
# Command line
54-
docker run -v $(pwd):/workspace -w /workspace ghcr.io/semgrep/convert-nuget
57+
# Command line (note: -w /workspace is optional)
58+
docker run -v $(pwd):/workspace ghcr.io/semgrep/convert-nuget
5559
```
5660

5761
## GitHub Actions Usage
@@ -79,7 +83,7 @@ jobs:
7983

8084
- name: Convert packages.config
8185
run: |
82-
docker run -v "${{ github.workspace }}:/workspace" -w /workspace ghcr.io/semgrep/convert-nuget
86+
docker run -v "${{ github.workspace }}:/workspace" ghcr.io/semgrep/convert-nuget
8387
8488
- name: Commit updated lock files (if any)
8589
run: |
@@ -108,4 +112,5 @@ jobs:
108112
109113
- `--tfm <TFM>`: Target framework moniker (default: `net472`)
110114
- `--root <DIR>`: Root directory to search (default: current working directory)
115+
- `--fail-on-skipped`: Exit with error code 2 if any packages are skipped due to incompatibility (default: warnings only)
111116
- `-h, --help`: Show help message

0 commit comments

Comments
 (0)