Skip to content

Commit 23e67b2

Browse files
committed
Add support for vendored dependencies
1 parent 9054f27 commit 23e67b2

File tree

6 files changed

+41
-6
lines changed

6 files changed

+41
-6
lines changed

.github/scripts/update-3rdparty-licenses.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ else
3535
echo " --no-scancode-strategy \\"
3636
echo " --no-github-sbom-strategy \\"
3737
echo " https://github.com/datadog/dd-trace-js > LICENSE-3rdparty.csv"
38-
echo "3. Commit the updated LICENSE-3rdparty.csv file"
39-
echo "4. Push your changes"
38+
echo "3. Append vendored dependencies:"
39+
echo " cat .github/vendored-dependencies.csv >> LICENSE-3rdparty.csv"
40+
echo "4. Commit the updated LICENSE-3rdparty.csv file"
41+
echo "5. Push your changes"
4042
echo ""
4143
echo "This helps keep the 3rd-party license information accurate."
4244
exit 1

.github/vendored-dependencies.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"aws-lambda-nodejs-runtime-interface-client","https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/v2.1.0/src/utils/UserFunction.ts","['Apache-2.0']","['Amazon.com Inc. or its affiliates']"
2+
"is-git-url","https://github.com/jonschlinkert/is-git-url/blob/396965ffabf2f46656c8af4c47bef1d69f09292e/index.js#L9C15-L9C87","['MIT']","['Jon Schlinkert']"

.github/workflows/update-3rdparty-licenses.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3737
with:
3838
repository: DataDog/dd-license-attribution
39-
ref: 848797a26d0cfd009482976d05af7f492bb5242c
39+
ref: 8a4624fd08a16717ffbf92d389e65fa609a4f067
4040
path: dd-license-attribution
4141

4242
- name: Install dd-license-attribution
@@ -71,6 +71,10 @@ jobs:
7171
--no-github-sbom-strategy \
7272
"${REPOSITORY_URL}" > LICENSE-3rdparty.csv
7373
74+
- name: Append vendored dependencies
75+
run: |
76+
cat .github/vendored-dependencies.csv >> LICENSE-3rdparty.csv
77+
7478
- name: Run LICENSE-3rdparty.csv update check
7579
env:
7680
PR_AUTHOR: ${{ github.event.pull_request.user.login }}

LICENSE-3rdparty.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@
7070
"ttl-set","https://github.com/watson/ttl-set","['MIT']","['Thomas Watson']"
7171
"undici-types","https://github.com/nodejs/undici","['MIT']","['nodejs']"
7272
"yocto-queue","https://github.com/sindresorhus/yocto-queue","['MIT']","['Sindre Sorhus']"
73-
73+
"aws-lambda-nodejs-runtime-interface-client","https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/v2.1.0/src/utils/UserFunction.ts","['Apache-2.0']","['Amazon.com Inc. or its affiliates']"
74+
"is-git-url","https://github.com/jonschlinkert/is-git-url/blob/396965ffabf2f46656c8af4c47bef1d69f09292e/index.js#L9C15-L9C87","['MIT']","['Jon Schlinkert']"

packages/dd-trace/src/lambda/runtime/ritm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Modifications copyright 2022 Datadog, Inc.
44
*
55
* Some functions are part of aws-lambda-nodejs-runtime-interface-client
6-
* https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/main/src/utils/UserFunction.ts
6+
* https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/v2.1.0/src/utils/UserFunction.ts
77
*/
88
'use strict'
99

scripts/check_licenses.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22
'use strict'
33

4-
const { createReadStream } = require('node:fs')
4+
const { createReadStream, existsSync } = require('node:fs')
55
const { join } = require('node:path')
66
const readline = require('node:readline')
77
const { execSync } = require('node:child_process')
@@ -55,6 +55,9 @@ function getProdDeps () {
5555
}
5656
}
5757

58+
// Add vendored dependencies
59+
addVendoredDeps(deps)
60+
5861
return deps
5962
}
6063

@@ -71,6 +74,29 @@ function collectFromTrees (trees, deps) {
7174
}
7275
}
7376

77+
function addVendoredDeps (deps) {
78+
const vendoredDepsPath = join(__dirname, '..', '.github', 'vendored-dependencies.csv')
79+
80+
// If the vendored dependencies file doesn't exist, skip
81+
if (!existsSync(vendoredDepsPath)) {
82+
return
83+
}
84+
85+
const fs = require('node:fs')
86+
const content = fs.readFileSync(vendoredDepsPath, 'utf8')
87+
88+
for (const line of content.split('\n')) {
89+
const trimmed = line.trim()
90+
if (!trimmed) continue // Skip empty lines
91+
92+
const columns = line.split(',')
93+
const component = columns[0]
94+
95+
// Strip quotes from the component name and add to deps
96+
deps.add(component.replaceAll(/^"|"$/g, ''))
97+
}
98+
}
99+
74100
function checkLicenses (typeDeps) {
75101
const missing = []
76102
const extraneous = []

0 commit comments

Comments
 (0)