Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/ship-legal-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@asyncapi/parser": patch
"@asyncapi/multi-parser": patch
"@asyncapi/openapi-schema-parser": patch
---

Ship the Apache-2.0 `LICENSE` and the `NOTICE` file inside the published tarballs, and add the repository
README to the two packages that had none. `LICENSE` and `README.md` were already listed in each package's
`files` array, but those entries resolve inside `packages/<pkg>/`, where neither file exists.
5 changes: 5 additions & 0 deletions packages/multi-parser/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ node_modules
/cjs
/browser
*.tgz

# copied from the repo root by prepublishOnly (scripts/copy-legal.js)
LICENSE
NOTICE
README.md
4 changes: 3 additions & 1 deletion packages/multi-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"/esm",
"/cjs",
"LICENSE",
"NOTICE",
"README.md"
],
"scripts": {
Expand All @@ -36,7 +37,8 @@
"generate:readme:toc": "markdown-toc -i \"../../README.md\"",
"generate:assets": "npm run generate:readme:toc",
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
"prepublishOnly": "npm run generate:assets"
"copy:legal": "node ../../scripts/copy-legal.js",
"prepublishOnly": "npm run copy:legal && npm run generate:assets"
},
"dependencies": {
"@asyncapi/avro-schema-parser": "^3.0.3",
Expand Down
4 changes: 4 additions & 0 deletions packages/openapi-schema-parser/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ node_modules
/lib
/esm
/cjs

# copied from the repo root by prepublishOnly (scripts/copy-legal.js)
LICENSE
NOTICE
4 changes: 3 additions & 1 deletion packages/openapi-schema-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"/esm",
"/cjs",
"LICENSE",
"NOTICE",
"README.md"
],
"scripts": {
Expand All @@ -47,7 +48,8 @@
"generate:readme:toc": "markdown-toc -i \"README.md\"",
"generate:assets": "npm run build && npm run generate:readme:toc",
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
"prepublishOnly": "npm run generate:assets"
"copy:legal": "node ../../scripts/copy-legal.js",
"prepublishOnly": "npm run copy:legal && npm run generate:assets"
},
"dependencies": {
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/parser/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ node_modules
/browser
*.tgz
.turbo

# copied from the repo root by prepublishOnly (scripts/copy-legal.js)
LICENSE
NOTICE
README.md
4 changes: 3 additions & 1 deletion packages/parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"/cjs",
"/browser",
"LICENSE",
"NOTICE",
"README.md"
],
"scripts": {
Expand All @@ -40,7 +41,8 @@
"generate:readme:toc": "markdown-toc -i \"../../README.md\"",
"generate:assets": "npm run generate:readme:toc",
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
"prepublishOnly": "npm run generate:assets"
"copy:legal": "node ../../scripts/copy-legal.js",
"prepublishOnly": "npm run copy:legal && npm run generate:assets"
},
"dependencies": {
"@asyncapi/specs": "^6.11.1",
Expand Down
18 changes: 18 additions & 0 deletions scripts/copy-legal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copy the monorepo-root legal and readme files into the package being published.
// npm only packs files that exist inside the package directory, so without this the published tarballs
// contain no LICENSE and no NOTICE - see the "files" array in each packages/*/package.json.
const fs = require('fs');

Check warning on line 4 in scripts/copy-legal.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `node:fs` over `fs`.

See more on https://sonarcloud.io/project/issues?id=asyncapi_parser-js&issues=AaARP4AS3ej0ChNoZNK7&open=AaARP4AS3ej0ChNoZNK7&pullRequest=1226
const path = require('path');

Check warning on line 5 in scripts/copy-legal.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `node:path` over `path`.

See more on https://sonarcloud.io/project/issues?id=asyncapi_parser-js&issues=AaARP4AS3ej0ChNoZNK8&open=AaARP4AS3ej0ChNoZNK8&pullRequest=1226

const root = path.join(__dirname, '..');
const pkg = process.cwd();

for (const name of ['LICENSE', 'NOTICE']) {
fs.copyFileSync(path.join(root, name), path.join(pkg, name));
}

// Only fall back to the monorepo README for packages that do not ship one of their own;
// @asyncapi/openapi-schema-parser has its own and it must not be overwritten.
if (!fs.existsSync(path.join(pkg, 'README.md'))) {
fs.copyFileSync(path.join(root, 'README.md'), path.join(pkg, 'README.md'));
}
Loading