Skip to content

Commit 8533c7f

Browse files
authored
Support for deno in devenv (#1827)
* Support for deno in devenv Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> Use @appthreat/sqlite3 in deno Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Use @appthreat/sqlite3 in deno Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Use @appthreat/sqlite3 in deno Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * lint fix Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Update sqlite3 to 6.0.3 to get pre-built binaries for napi 10 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Force build from source on certain old images Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> --------- Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
1 parent 504e2bf commit 8533c7f

30 files changed

+289
-204
lines changed

.devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"customizations": {
33
"vscode": {
4-
"extensions": ["mkhl.direnv"]
4+
"extensions": [
5+
"mkhl.direnv"
6+
]
57
}
68
},
79
"image": "ghcr.io/cachix/devenv/devcontainer:latest",

.github/workflows/nodejs.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,15 @@ jobs:
8181
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,osRelease,homedir --allow-write --allow-net --include=./data --include=./package.json --output cdxgenx.exe bin/cdxgen.js
8282
.\cdxgenx.exe --help
8383
(Get-FileHash .\cdxgenx.exe).hash | Out-File -FilePath .\cdxgenx.exe.sha256
84-
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,osRelease,homedir --allow-write --allow-net --node-modules-dir=auto --allow-ffi --allow-scripts=npm:sqlite3@5.1.7 --include=./data --include=./package.json --include=node_modules/.deno/sqlite3@5.1.7/node_modules/sqlite3/build/Release --output evinse.exe bin/evinse.js
84+
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,osRelease,homedir --allow-write --allow-net --node-modules-dir=auto --allow-ffi --allow-scripts=npm:@appthreat/sqlite3@6.0.3 --include=./data --include=./package.json --include=node_modules/sqlite3/build/Release --output evinse.exe bin/evinse.js
8585
.\evinse.exe --help
8686
(Get-FileHash .\evinse.exe).hash | Out-File -FilePath .\evinse.exe.sha256
8787
artifact: cdxgenx.exe
8888
- os: macos
8989
build: |
90-
rm -rf node_modules
91-
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net --include=./data --include=./package.json --target x86_64-apple-darwin --output cdxgenx-darwin-amd64 bin/cdxgen.js
92-
./cdxgenx-darwin-amd64 --help
93-
shasum -a 256 cdxgenx-darwin-amd64 > cdxgenx-darwin-amd64.sha256
94-
rm -rf node_modules
9590
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net --include=./data --include=./package.json --target aarch64-apple-darwin --output cdxgenx-darwin-arm64 bin/cdxgen.js
9691
shasum -a 256 cdxgenx-darwin-arm64 > cdxgenx-darwin-arm64.sha256
97-
rm -rf node_modules
98-
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net --node-modules-dir=auto --allow-ffi --allow-scripts=npm:sqlite3@5.1.7 --include=./data --include=./package.json --include=node_modules/.deno/sqlite3@5.1.7/node_modules/sqlite3/build/Release --target aarch64-apple-darwin --output evinse-darwin-arm64 bin/evinse.js
92+
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net --node-modules-dir=auto --allow-ffi --allow-scripts=npm:@appthreat/sqlite3@6.0.3 --include=./data --include=./package.json --include=node_modules/sqlite3/build/Release --target aarch64-apple-darwin --output evinse-darwin-arm64 bin/evinse.js
9993
shasum -a 256 evinse-darwin-arm64 > evinse-darwin-arm64.sha256
10094
./evinse-darwin-arm64 --help
10195
artifact: cdxgenx-darwin-arm64
@@ -105,17 +99,25 @@ jobs:
10599
shasum -a 256 cdxgenx > cdxgenx.sha256
106100
chmod + cdxgenx
107101
./cdxgenx --help
108-
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net --node-modules-dir=auto --allow-ffi --allow-scripts=npm:sqlite3@5.1.7 --include=./data --include=./package.json --include=node_modules/.deno/sqlite3@5.1.7/node_modules/sqlite3/build/Release --output evinse bin/evinse.js
102+
deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net --node-modules-dir=auto --allow-ffi --allow-scripts=npm:@appthreat/sqlite3@6.0.3 --include=./data --include=./package.json --include=node_modules/sqlite3/build/Release --output evinse bin/evinse.js
109103
shasum -a 256 evinse > evinse.sha256
110104
chmod + evinse
111105
./evinse --help
112106
artifact: cdxgenx
113107
runs-on: ${{ matrix.os }}-latest
114108
steps:
115109
- uses: actions/checkout@v4
110+
- name: Use Node.js
111+
uses: actions/setup-node@v4
112+
with:
113+
node-version: '24.x'
116114
- uses: denoland/setup-deno@v2
117115
with:
118116
deno-version: v${{ matrix.deno_version }}
117+
- name: pnpm install, build and test
118+
run: |
119+
npm install -g pnpm@latest
120+
pnpm install --config.strict-dep-builds=true --package-import-method copy --frozen-lockfile
119121
- name: deno compile
120122
run: |
121123
deno info bin/cdxgen.js

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ Use `pnpm add -g` command to quickly test the main branch.
534534
```shell
535535
corepack pnpm bin -g
536536
corepack pnpm setup
537-
corepack pnpm add -g --allow-build sqlite3 https://github.com/CycloneDX/cdxgen
537+
corepack pnpm add -g --allow-build @appthreat/sqlite3 https://github.com/CycloneDX/cdxgen
538538
cdxgen --help
539539
```
540540

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"formatter": {
5252
"enabled": true,
53-
"ignore": ["types/**", "contrib/**"],
53+
"ignore": ["types/**", "contrib/**", ".devcontainer.json"],
5454
"indentStyle": "space",
5555
"indentWidth": 2
5656
},

ci/Dockerfile-deno

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ RUN set -e; \
8888
&& python${PYTHON_VERSION} -m pip install --no-cache-dir --upgrade setuptools==77.0.3 wheel pip virtualenv \
8989
&& python${PYTHON_VERSION} -m pip install --no-cache-dir --upgrade pipenv poetry blint atom-tools uv --target /opt/pypi \
9090
&& curl -fsSL https://deno.land/x/install/install.sh | sh \
91-
&& deno install -g --node-modules-dir=auto --allow-scripts=npm:sqlite3@5.1.7 --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net -n cdxgen "npm:@cyclonedx/cdxgen/cdxgen" \
91+
&& deno install -g --node-modules-dir=auto --allow-scripts=npm:@appthreat/sqlite3@6.0.3 --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net -n cdxgen "npm:@cyclonedx/cdxgen/cdxgen" \
9292
&& deno install -g --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write -n atom "npm:@appthreat/atom/atom" \
9393
&& deno install -g --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write -n astgen "npm:@appthreat/atom/astgen" \
9494
&& deno install -g --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write -n phpastgen "npm:@appthreat/atom/phpastgen" \

ci/base-images/debian/Dockerfile.dotnet6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ ENV DOTNET_GENERATE_ASPNET_CERTIFICATE=false \
88
NUGET_XMLDOC_MODE=skip \
99
DOTNET_RUNNING_IN_CONTAINER=true \
1010
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
11-
NVM_DIR="/root/.nvm"
11+
NVM_DIR="/root/.nvm" \
12+
npm_config_build_from_source=true
1213
ENV PATH=${PATH}:/root/.nvm/versions/node/v${NODE_VERSION}/bin:/usr/local/bin:/root/.local/bin:
1314

1415
COPY ci/base-images/debian/install.sh /tmp/

ci/base-images/debian/Dockerfile.dotnet8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ ENV DOTNET_GENERATE_ASPNET_CERTIFICATE=false \
88
NUGET_XMLDOC_MODE=skip \
99
DOTNET_RUNNING_IN_CONTAINER=true \
1010
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
11-
NVM_DIR="/root/.nvm"
11+
NVM_DIR="/root/.nvm" \
12+
npm_config_build_from_source=true
1213
ENV PATH=${PATH}:/root/.nvm/versions/node/v${NODE_VERSION}/bin:/usr/local/bin:/root/.local/bin:
1314

1415
COPY ci/base-images/debian/install.sh /tmp/

ci/base-images/debian/Dockerfile.ruby18

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ ENV JAVA_VERSION=$JAVA_VERSION \
1515
BUNDLER_VERSION=$BUNDLER_VERSION \
1616
RAKE_VERSION=$RAKE_VERSION \
1717
RMAGICK_VERSION=$RMAGICK_VERSION \
18-
BUNDLE_SILENCE_ROOT_WARNING=true
18+
BUNDLE_SILENCE_ROOT_WARNING=true \
19+
npm_config_build_from_source=true
1920
ENV PATH=/usr/local/rvm/gems/ruby-${RUBY_VERSION}/bin:/usr/local/rvm/gems/ruby-${RUBY_VERSION}@global/bin:/usr/local/rvm/rubies/ruby-${RUBY_VERSION}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin:${PATH}:/usr/local/bin:/root/.local/bin:/root/.rbenv/bin:
2021

2122
COPY ci/base-images/debian/install.sh /tmp/

ci/base-images/debian/Dockerfile.ruby26

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ ENV JAVA_VERSION=$JAVA_VERSION \
99
ATOM_RUBY_VERSION=$ATOM_RUBY_VERSION \
1010
BUNDLE_SILENCE_ROOT_WARNING=true \
1111
JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8" \
12-
NVM_DIR="/root/.nvm"
12+
NVM_DIR="/root/.nvm" \
13+
npm_config_build_from_source=true
1314
ENV PATH=/root/.nvm/versions/node/v${NODE_VERSION}/bin:${PATH}:/usr/local/bin:/root/.local/bin:/root/.rbenv/bin:
1415

1516
COPY ci/base-images/debian/install.sh /tmp/

ci/base-images/opensuse/Dockerfile.python310

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ENV CC=gcc \
88
LANGUAGE=en_US.UTF-8 \
99
GOPATH=/opt/app-root/go \
1010
npm_config_python=/usr/bin/python3.10 \
11+
npm_config_build_from_source=true \
1112
PYTHONPATH=/opt/pypi:${PYTHONPATH}
1213

1314
ENV PATH=${PATH}:/usr/local/bin:/opt/pypi/bin:${GOPATH}/bin:/usr/local/go/bin:

0 commit comments

Comments
 (0)