Skip to content

Commit 46596b2

Browse files
authored
Generate notice file (#359)
1 parent 53363f2 commit 46596b2

File tree

8 files changed

+174
-2
lines changed

8 files changed

+174
-2
lines changed

.github/workflows/release-pr.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
6060
echo "changelog_file=$TMPFILE" >> $GITHUB_OUTPUT
6161
62+
- name: Generate notice file
63+
run: yarn run generate-notice
64+
6265
- name: lint fix
6366
if: ${{ inputs.version != '0.0.0' }}
6467
run: yarn run fix
@@ -70,7 +73,7 @@ jobs:
7073
COMMIT_SHA=$(git rev-parse --short HEAD)
7174
BRANCH=releases/draft-$COMMIT_SHA-$(date +%s)
7275
git checkout -b $BRANCH
73-
git add **/CHANGELOG.md **/package.json package.json
76+
git add **/CHANGELOG.md **/package.json package.json **/NOTICE.md
7477
git status
7578
git commit -m "Changelog & version bump to ${{ inputs.version }}"
7679
git push origin HEAD

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"build": "yarn workspaces foreach run build",
1919
"clean": "yarn workspaces foreach run clean",
2020
"fix": "yarn workspaces foreach run fix",
21-
"conventional-changelog": "conventional-changelog"
21+
"conventional-changelog": "conventional-changelog",
22+
"generate-notice": "yarn workspaces foreach run generate-notice"
2223
},
2324
"repository": {
2425
"type": "git",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (2022) Databricks, Inc.
2+
3+
This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
4+
5+
---
6+
7+
This Software contains code from the following open source projects:
8+
9+
| Name | Installed version | License | Code |
10+
| :------------------------------------------------------------------------- | :---------------- | :--------- | :------------------------------------------------------------- |
11+
| [data-uri-to-buffer](https://www.npmjs.com/package/data-uri-to-buffer) | 4.0.0 | MIT | git://github.com/TooTallNate/node-data-uri-to-buffer.git |
12+
| [fetch-blob](https://www.npmjs.com/package/fetch-blob) | 3.2.0 | MIT | https://github.com/node-fetch/fetch-blob.git |
13+
| [formdata-polyfill](https://www.npmjs.com/package/formdata-polyfill) | 4.0.10 | MIT | git+https://[email protected]/jimmywarting/FormData.git |
14+
| [ini](https://www.npmjs.com/package/ini) | 3.0.1 | ISC | https://github.com/npm/ini.git |
15+
| [inversify](https://www.npmjs.com/package/inversify) | 6.0.1 | MIT | https://github.com/inversify/InversifyJS.git |
16+
| [node-domexception](https://www.npmjs.com/package/node-domexception) | 1.0.0 | MIT | git+https://github.com/jimmywarting/node-domexception.git |
17+
| [node-fetch](https://www.npmjs.com/package/node-fetch) | 3.3.0 | MIT | https://github.com/node-fetch/node-fetch.git |
18+
| [reflect-metadata](https://www.npmjs.com/package/reflect-metadata) | 0.1.13 | Apache-2.0 | https://github.com/rbuckton/reflect-metadata.git |
19+
| [web-streams-polyfill](https://www.npmjs.com/package/web-streams-polyfill) | 3.2.1 | MIT | git+https://github.com/MattiasBuelens/web-streams-polyfill.git |

packages/databricks-sdk-js/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"clean": "rm -rf dist node_modules",
2323
"openapi:fetch": "./scripts/fetch_openapi.sh 4609d709fc94a1b8dbe79ac78a1cece281fdaeff",
2424
"openapi:generate": "./scripts/generate_openapi.sh v0.2.0 && yarn run build",
25+
"generate-notice": "../../scripts/generate_notice.sh",
2526
"fix": "eslint src --ext ts --fix && prettier . --write",
2627
"test:lint": "eslint src --ext ts && prettier . -c",
2728
"test:unit": "ts-mocha --type-check 'src/**/*.test.ts'",
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Copyright (2022) Databricks, Inc.
2+
3+
This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
4+
5+
---
6+
7+
This Software contains code from the following open source projects:
8+
9+
| Name | Installed version | License | Code |
10+
| :------------------------------------------------------------------------------------------- | :---------------- | :----------- | :------------------------------------------------------------- |
11+
| [@colors/colors](https://www.npmjs.com/package/@colors/colors) | 1.5.0 | MIT | http://github.com/DABH/colors.js.git |
12+
| [@dabh/diagnostics](https://www.npmjs.com/package/@dabh/diagnostics) | 2.0.3 | MIT | git://github.com/3rd-Eden/diagnostics.git |
13+
| [@microsoft/fast-element](https://www.npmjs.com/package/@microsoft/fast-element) | 1.11.0 | MIT | git+https://github.com/Microsoft/fast.git |
14+
| [@microsoft/fast-foundation](https://www.npmjs.com/package/@microsoft/fast-foundation) | 2.47.0 | MIT | git+https://github.com/Microsoft/fast.git |
15+
| [@microsoft/fast-react-wrapper](https://www.npmjs.com/package/@microsoft/fast-react-wrapper) | 0.1.48 | MIT | git+https://github.com/Microsoft/fast.git |
16+
| [@microsoft/fast-web-utilities](https://www.npmjs.com/package/@microsoft/fast-web-utilities) | 5.4.1 | MIT | git+https://github.com/Microsoft/fast.git |
17+
| [@vscode/debugadapter](https://www.npmjs.com/package/@vscode/debugadapter) | 1.58.0 | MIT | https://github.com/microsoft/vscode-debugadapter-node.git |
18+
| [@vscode/debugprotocol](https://www.npmjs.com/package/@vscode/debugprotocol) | 1.58.0 | MIT | https://github.com/microsoft/vscode-debugadapter-node.git |
19+
| [@vscode/webview-ui-toolkit](https://www.npmjs.com/package/@vscode/webview-ui-toolkit) | 1.2.1 | MIT | git+https://github.com/microsoft/vscode-webview-ui-toolkit.git |
20+
| [ansi-to-html](https://www.npmjs.com/package/ansi-to-html) | 0.7.2 | MIT | https://github.com/rburns/ansi-to-html.git |
21+
| [async](https://www.npmjs.com/package/async) | 3.2.4 | MIT | https://github.com/caolan/async.git |
22+
| [color-convert](https://www.npmjs.com/package/color-convert) | 1.9.3 | MIT | Qix-/color-convert |
23+
| [color-name](https://www.npmjs.com/package/color-name) | 1.1.3 | MIT | [email protected]:dfcreative/color-name.git |
24+
| [color-name](https://www.npmjs.com/package/color-name) | 1.1.4 | MIT | [email protected]:colorjs/color-name.git |
25+
| [color-string](https://www.npmjs.com/package/color-string) | 1.9.1 | MIT | Qix-/color-string |
26+
| [color](https://www.npmjs.com/package/color) | 3.2.1 | MIT | Qix-/color |
27+
| [colorspace](https://www.npmjs.com/package/colorspace) | 1.1.4 | MIT | https://github.com/3rd-Eden/colorspace |
28+
| [data-uri-to-buffer](https://www.npmjs.com/package/data-uri-to-buffer) | 4.0.0 | MIT | git://github.com/TooTallNate/node-data-uri-to-buffer.git |
29+
| [enabled](https://www.npmjs.com/package/enabled) | 2.0.0 | MIT | git://github.com/3rd-Eden/enabled.git |
30+
| [entities](https://www.npmjs.com/package/entities) | 2.2.0 | BSD-2-Clause | git://github.com/fb55/entities.git |
31+
| [exenv-es6](https://www.npmjs.com/package/exenv-es6) | 1.1.1 | MIT | git+https://github.com/chrisdholt/exenv-es6.git |
32+
| [fecha](https://www.npmjs.com/package/fecha) | 4.2.3 | MIT | https://[email protected]/taylorhakes/fecha.git |
33+
| [fetch-blob](https://www.npmjs.com/package/fetch-blob) | 3.2.0 | MIT | https://github.com/node-fetch/fetch-blob.git |
34+
| [fn.name](https://www.npmjs.com/package/fn.name) | 1.1.0 | MIT | https://github.com/3rd-Eden/fn.name |
35+
| [formdata-polyfill](https://www.npmjs.com/package/formdata-polyfill) | 4.0.10 | MIT | git+https://[email protected]/jimmywarting/FormData.git |
36+
| [inherits](https://www.npmjs.com/package/inherits) | 2.0.4 | ISC | git://github.com/isaacs/inherits |
37+
| [ini](https://www.npmjs.com/package/ini) | 3.0.1 | ISC | https://github.com/npm/ini.git |
38+
| [inversify](https://www.npmjs.com/package/inversify) | 6.0.1 | MIT | https://github.com/inversify/InversifyJS.git |
39+
| [is-arrayish](https://www.npmjs.com/package/is-arrayish) | 0.3.2 | MIT | https://github.com/qix-/node-is-arrayish.git |
40+
| [is-stream](https://www.npmjs.com/package/is-stream) | 2.0.1 | MIT | sindresorhus/is-stream |
41+
| [kuler](https://www.npmjs.com/package/kuler) | 2.0.0 | MIT | https://github.com/3rd-Eden/kuler |
42+
| [logform](https://www.npmjs.com/package/logform) | 2.4.2 | MIT | git+https://github.com/winstonjs/logform.git |
43+
| [ms](https://www.npmjs.com/package/ms) | 2.1.3 | MIT | vercel/ms |
44+
| [node-domexception](https://www.npmjs.com/package/node-domexception) | 1.0.0 | MIT | git+https://github.com/jimmywarting/node-domexception.git |
45+
| [node-fetch](https://www.npmjs.com/package/node-fetch) | 3.3.0 | MIT | https://github.com/node-fetch/node-fetch.git |
46+
| [one-time](https://www.npmjs.com/package/one-time) | 1.0.0 | MIT | https://github.com/3rd-Eden/one-time.git |
47+
| [readable-stream](https://www.npmjs.com/package/readable-stream) | 3.6.0 | MIT | git://github.com/nodejs/readable-stream |
48+
| [reflect-metadata](https://www.npmjs.com/package/reflect-metadata) | 0.1.13 | Apache-2.0 | https://github.com/rbuckton/reflect-metadata.git |
49+
| [safe-buffer](https://www.npmjs.com/package/safe-buffer) | 5.2.1 | MIT | git://github.com/feross/safe-buffer.git |
50+
| [safe-stable-stringify](https://www.npmjs.com/package/safe-stable-stringify) | 2.4.1 | MIT | git+https://github.com/BridgeAR/safe-stable-stringify.git |
51+
| [simple-swizzle](https://www.npmjs.com/package/simple-swizzle) | 0.2.2 | MIT | qix-/node-simple-swizzle |
52+
| [stack-trace](https://www.npmjs.com/package/stack-trace) | 0.0.10 | MIT | git://github.com/felixge/node-stack-trace.git |
53+
| [string_decoder](https://www.npmjs.com/package/string_decoder) | 1.3.0 | MIT | git://github.com/nodejs/string_decoder.git |
54+
| [tabbable](https://www.npmjs.com/package/tabbable) | 5.3.3 | MIT | git+https://github.com/focus-trap/tabbable.git |
55+
| [text-hex](https://www.npmjs.com/package/text-hex) | 1.0.0 | MIT | https://github.com/3rd-Eden/text-hex |
56+
| [triple-beam](https://www.npmjs.com/package/triple-beam) | 1.3.0 | MIT | git+https://github.com/winstonjs/triple-beam.git |
57+
| [tslib](https://www.npmjs.com/package/tslib) | 1.14.1 | 0BSD | https://github.com/Microsoft/tslib.git |
58+
| [util-deprecate](https://www.npmjs.com/package/util-deprecate) | 1.0.2 | MIT | git://github.com/TooTallNate/util-deprecate.git |
59+
| [web-streams-polyfill](https://www.npmjs.com/package/web-streams-polyfill) | 3.2.1 | MIT | git+https://github.com/MattiasBuelens/web-streams-polyfill.git |
60+
| [winston-transport](https://www.npmjs.com/package/winston-transport) | 4.5.0 | MIT | [email protected]:winstonjs/winston-transport.git |
61+
| [winston](https://www.npmjs.com/package/winston) | 3.8.2 | MIT | https://github.com/winstonjs/winston.git |

packages/databricks-vscode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@
533533
"test:cov": "nyc yarn run test:unit",
534534
"test": "yarn run test:lint && yarn run test:unit",
535535
"clean": "rm -rf node_modules out .vscode-test",
536+
"generate-notice": "../../scripts/generate_notice.sh",
536537
"ts-node": "ts-node"
537538
},
538539
"dependencies": {

scripts/generate_notice.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const fs = require("fs/promises");
2+
3+
const header = `Copyright (2022) Databricks, Inc.
4+
5+
This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
6+
***
7+
This Software contains code from the following open source projects:
8+
9+
`;
10+
11+
async function* crawlLicenses(start) {
12+
try {
13+
const stat = await fs.stat(start);
14+
if (!stat.isDirectory()) {
15+
return;
16+
}
17+
} catch (e) {
18+
return;
19+
}
20+
21+
for (const folder of await fs.readdir(start)) {
22+
if (folder.startsWith(".")) {
23+
continue;
24+
}
25+
26+
if (folder.startsWith("@")) {
27+
yield* crawlLicenses(start + "/" + folder);
28+
continue;
29+
}
30+
31+
const path = start + "/" + folder;
32+
33+
try {
34+
const link = await fs.readlink(path);
35+
if (link === ".." || link === "../..") {
36+
continue;
37+
}
38+
} catch (e) {}
39+
40+
const pkg = JSON.parse(
41+
await fs.readFile(path + "/package.json", "utf8")
42+
);
43+
yield {
44+
name: pkg.name,
45+
version: pkg.version,
46+
license: pkg.license,
47+
repository: pkg.repository.url || pkg.repository,
48+
};
49+
yield* crawlLicenses(path + "/node_modules");
50+
}
51+
}
52+
53+
async function main() {
54+
let notice =
55+
header +
56+
`| Name | Installed version | License | Code |
57+
| :--------------- | :---------------- | :----------- | :--------------------------------------------------- |\n`;
58+
59+
let deps = {};
60+
for await (let dep of crawlLicenses(process.cwd() + "/node_modules")) {
61+
deps[dep.name + "@" + dep.version] = dep;
62+
}
63+
const depNames = Object.keys(deps).sort();
64+
65+
for (let depName of depNames) {
66+
const dep = deps[depName];
67+
if (dep.name.startsWith("@databricks")) {
68+
continue;
69+
}
70+
notice += `| [${dep.name}](https://www.npmjs.com/package/${dep.name}) | ${dep.version} | ${dep.license} | ${dep.repository} |\n`;
71+
}
72+
// eslint-disable-next-line no-console
73+
console.log(notice);
74+
}
75+
76+
main();

scripts/generate_notice.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
7+
8+
yarn workspaces focus --production
9+
node $DIR/generate_notice.js > NOTICE.md
10+
yarn install

0 commit comments

Comments
 (0)