Skip to content

Commit e489ade

Browse files
Merge master into feature/LSP-gamma
2 parents e0a843e + dbc58d9 commit e489ade

File tree

7 files changed

+10625
-1
lines changed

7 files changed

+10625
-1
lines changed

.github/workflows/setup-release-candidate.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
run: |
3232
echo "BRANCH_NAME=release/rc-$(date +%Y%m%d)" >> $GITHUB_OUTPUT
3333
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Generate license attribution
38+
run: npm run scan-licenses
39+
3440
- name: Create RC Branch
3541
env:
3642
BRANCH_NAME: ${{ steps.branch-name.outputs.BRANCH_NAME }}
@@ -41,5 +47,9 @@ jobs:
4147
# Create RC branch from specified commit
4248
git checkout -b $BRANCH_NAME
4349
50+
# Add generated license files
51+
git add LICENSE-THIRD-PARTY
52+
git commit -m "Update third-party license attribution for $BRANCH_NAME"
53+
4454
# Push RC branch
4555
git push origin $BRANCH_NAME

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ packages/*/resources/css/icons.css
5757

5858
# Created by `npm run webRun` when testing extension in web mode
5959
.vscode-test-web
60+
61+
# License scanning output
62+
licenses-full.json

LICENSE-THIRD-PARTY

Lines changed: 10428 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ We want your feedback!
5656
- [File an issue](https://github.com/aws/aws-toolkit-vscode/issues/new?labels=bug&template=bug_report.md)
5757
- Or [send a pull request](CONTRIBUTING.md)!
5858

59+
## License Scanning
60+
61+
To generate license reports and attribution documents for third-party dependencies:
62+
63+
```bash
64+
npm run scan-licenses
65+
66+
# Or run directly
67+
./scripts/scan-licenses.sh
68+
```
69+
70+
This generates:
71+
72+
- `LICENSE-THIRD-PARTY` - Attribution document for distribution
73+
- `licenses-full.json` - Complete license data
74+
5975
## License
6076

6177
This project and the subprojects within **(AWS Toolkit for Visual Studio Code, Amazon Q for Visual Studio Code)** is distributed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"reset": "npm run clean && ts-node ./scripts/clean.ts node_modules && npm install",
3939
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present",
4040
"mergeReports": "ts-node ./scripts/mergeReports.ts",
41-
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
41+
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/",
42+
"scan-licenses": "ts-node ./scripts/scan-licenses.ts"
4243
},
4344
"devDependencies": {
4445
"@aws-toolkits/telemetry": "^1.0.329",

scripts/scan-licenses.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
banner()
3+
{
4+
echo "*****************************************"
5+
echo "** AWS Toolkit License Scanner **"
6+
echo "*****************************************"
7+
echo ""
8+
}
9+
10+
help()
11+
{
12+
banner
13+
echo "Usage: ./scan-licenses.sh"
14+
echo ""
15+
echo "This script scans the npm dependencies in the current project"
16+
echo "and generates license reports and attribution documents."
17+
echo ""
18+
}
19+
20+
gen_attribution(){
21+
echo ""
22+
echo " == Generating Attribution Document =="
23+
npm install -g oss-attribution-generator
24+
generate-attribution
25+
if [ -d "oss-attribution" ]; then
26+
mv oss-attribution/attribution.txt LICENSE-THIRD-PARTY
27+
rm -rf oss-attribution
28+
echo "Attribution document generated: LICENSE-THIRD-PARTY"
29+
else
30+
echo "Warning: oss-attribution directory not found"
31+
fi
32+
}
33+
34+
gen_full_license_report(){
35+
echo ""
36+
echo " == Generating Full License Report =="
37+
npm install -g license-checker
38+
license-checker --json > licenses-full.json
39+
echo "Full license report generated: licenses-full.json"
40+
}
41+
42+
main()
43+
{
44+
banner
45+
46+
# Check if we're in the right directory
47+
if [ ! -f "package.json" ]; then
48+
echo "Error: package.json not found. Please run this script from the project root."
49+
exit 1
50+
fi
51+
52+
# Check if node_modules exists
53+
if [ ! -d "node_modules" ]; then
54+
echo "node_modules not found. Running npm install..."
55+
npm install
56+
if [ $? -ne 0 ]; then
57+
echo "Error: npm install failed"
58+
exit 1
59+
fi
60+
fi
61+
62+
echo "Scanning licenses for AWS Toolkit VS Code project..."
63+
echo "Project root: $(pwd)"
64+
echo ""
65+
66+
gen_attribution
67+
gen_full_license_report
68+
69+
echo ""
70+
echo "=== License Scan Complete ==="
71+
echo "Generated files:"
72+
echo " - LICENSE-THIRD-PARTY (attribution document)"
73+
echo " - licenses-full.json (complete license data)"
74+
echo ""
75+
}
76+
77+
if [ "$1" = "--help" ] || [ "$1" = "-h" ]
78+
then
79+
help
80+
exit 0
81+
else
82+
main
83+
fi

scripts/scan-licenses.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env node
2+
3+
import { execSync } from 'child_process'
4+
import { existsSync, rmSync, renameSync, writeFileSync } from 'fs'
5+
import { join } from 'path'
6+
7+
function banner() {
8+
console.log('*****************************************')
9+
console.log('** AWS Toolkit License Scanner **')
10+
console.log('*****************************************')
11+
console.log('')
12+
}
13+
14+
function genAttribution() {
15+
console.log('')
16+
console.log(' == Generating Attribution Document ==')
17+
18+
try {
19+
execSync('npm install -g oss-attribution-generator', { stdio: 'inherit' })
20+
execSync('generate-attribution', { stdio: 'inherit' })
21+
22+
if (existsSync('oss-attribution')) {
23+
renameSync(join('oss-attribution', 'attribution.txt'), 'LICENSE-THIRD-PARTY')
24+
rmSync('oss-attribution', { recursive: true, force: true })
25+
console.log('Attribution document generated: LICENSE-THIRD-PARTY')
26+
} else {
27+
console.log('Warning: oss-attribution directory not found')
28+
}
29+
} catch (error) {
30+
console.error('Error generating attribution:', error)
31+
}
32+
}
33+
34+
function genFullLicenseReport() {
35+
console.log('')
36+
console.log(' == Generating Full License Report ==')
37+
38+
try {
39+
execSync('npm install -g license-checker', { stdio: 'inherit' })
40+
const licenseData = execSync('license-checker --json', { encoding: 'utf8' })
41+
writeFileSync('licenses-full.json', licenseData)
42+
console.log('Full license report generated: licenses-full.json')
43+
} catch (error) {
44+
console.error('Error generating license report:', error)
45+
}
46+
}
47+
48+
function main() {
49+
banner()
50+
51+
if (!existsSync('package.json')) {
52+
console.error('Error: package.json not found. Please run this script from the project root.')
53+
process.exit(1)
54+
}
55+
56+
if (!existsSync('node_modules')) {
57+
console.log('node_modules not found. Running npm install...')
58+
try {
59+
execSync('npm install', { stdio: 'inherit' })
60+
} catch (error) {
61+
console.error('Error running npm install:', error)
62+
process.exit(1)
63+
}
64+
}
65+
66+
console.log('Scanning licenses for AWS Toolkit VS Code project...')
67+
console.log(`Project root: ${process.cwd()}`)
68+
console.log('')
69+
70+
genAttribution()
71+
genFullLicenseReport()
72+
73+
console.log('')
74+
console.log('=== License Scan Complete ===')
75+
console.log('Generated files:')
76+
console.log(' - LICENSE-THIRD-PARTY (attribution document)')
77+
console.log(' - licenses-full.json (complete license data)')
78+
console.log('')
79+
}
80+
81+
if (require.main === module) {
82+
main()
83+
}

0 commit comments

Comments
 (0)