Skip to content

chore: set up 3rd-party license generation#11640

Merged
jcfranco merged 5 commits intodevfrom
jcfranco/11546-add-third-party-copyright-licensing
Mar 1, 2025
Merged

chore: set up 3rd-party license generation#11640
jcfranco merged 5 commits intodevfrom
jcfranco/11546-add-third-party-copyright-licensing

Conversation

@jcfranco
Copy link
Copy Markdown
Member

@jcfranco jcfranco commented Feb 27, 2025

Related Issue: #11546

Summary

This adds a utility script that generates 3rd-party license information for each package.

Notes

  • file name is THIRD-PARTY-LICENSES.md (TPL)
  • TPL is referenced in each package's README
  • all packages are set up to generate a TPL (except the internal @esri/eslint-config-calcite package)
    • if there are no 3rd-party dependencies, it will display an appropriate message
  • relies on https://www.npmjs.com/package/generate-license-file
  • packages will now include TPL when published
  • util script (util:update-3rd-party-licenses) can be called from the monorepo root or from individual packages

@github-actions github-actions Bot added the chore Issues with changes that don't modify src or test files. label Feb 27, 2025
@jcfranco jcfranco added the skip visual snapshots Pull requests that do not need visual regression testing. label Feb 27, 2025
@jcfranco jcfranco force-pushed the jcfranco/11546-add-third-party-copyright-licensing branch 3 times, most recently from 8706ce6 to 18411cf Compare February 27, 2025 20:22
@jcfranco jcfranco force-pushed the jcfranco/11546-add-third-party-copyright-licensing branch from 18411cf to dd3de94 Compare February 27, 2025 20:39
@jcfranco jcfranco marked this pull request as ready for review February 27, 2025 23:09
Copy link
Copy Markdown
Contributor

@benelan benelan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice this looks good! So we have to remember to rerun that script whenever a dependency gets added to any of the packages, right?

I wonder if we should automatically run the script before publishing just in case we forget at some point. At least that way the package's license will be included.

You could run the script and git add **/THIRD-PARTY-LICENSES.md before committing here:

# The "|| true" prevents failure if there are no changes
git add package-lock.json || true
# The release-please PR only updates when there are new deployable
# commits, e.g., fixes, features, or breaking changes. This is fine
# but it means autogenerated files can become outdated.
#
# Lerna will only publish when the working tree is clean, so changes
# to autogenerated files cause the release to fail.
#
# The workaround is to commit the files before releasing so everything
# will be up to date in the dists. The commit will be discarded once
# the container is destroyed, and then the autogenerated files will be
# updated in a subsequent PR.
git commit -m "build(deps): update package-lock" || true

Comment thread support/createThirdPartyLicenses.ts Outdated
"@esri/eslint-plugin-calcite-components",
];

const licenses = await getProjectLicenses(".package.json", {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "./package.json" or "package.json"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch. 🎣 It seems that generate-license-file's file path logic was unintentionally handling this case.

@jcfranco
Copy link
Copy Markdown
Member Author

jcfranco commented Mar 1, 2025

You could run the script and git add **/THIRD-PARTY-LICENSES.md before committing here:

Great idea. I've updated the deploy-next action to run the script and stage the license files as suggested. LMK if further tweaks are needed.

@jcfranco jcfranco merged commit 56adcf8 into dev Mar 1, 2025
@jcfranco jcfranco deleted the jcfranco/11546-add-third-party-copyright-licensing branch March 1, 2025 22:29
benelan added a commit that referenced this pull request Mar 6, 2025
* origin/dev: (80 commits)
  build(deps): update nx monorepo to v20.4.6 (#11662)
  build(deps): update arcgis to ^4.32.7 (#11648)
  build: update browserslist db (#11639)
  build(deps): update eslint (#11670)
  build(deps): update dependency chromatic to v11.26.1 (#11669)
  build(deps): update dependency rollup to v4.34.9 (#11661)
  build(deps): update dependency tsx to v4.19.3 (#11658)
  chore: release next
  docs(text-area): update limitText description (#11672)
  feat(block, block-section): add `expanded` property and deprecate `open` property (#11582)
  feat(list-item, list): add `expanded` property and deprecate `open` property (#11003)
  chore: release next
  fix(tabs): redisplay close button when more than one tab is closable (#11492)
  test(shell-panel): Fix token story set up (#11635)
  chore: set up 3rd-party license generation (#11640)
  build(deps): update dependency happy-dom to v17.1.8 (#11649)
  build(deps): update dependency prettier to v3.5.2 (#11642)
  build(deps): update dependency happy-dom to v17.1.6 (#11641)
  chore: release next
  fix(card-group): Restore default gap spacing (#11638)
  ...
benelan added a commit that referenced this pull request Mar 31, 2025
**Related Issue:** #11640

## Summary

Apparently [`generate-license-file`](https://www.npmjs.com/package/generate-license-file)
installs our packages locally somewhere in order to generate the 3rd
party licenses. The licenses script uses the version in `package.json`,
so running it before publishing causes the following [error], since the
version doesn't exist yet:

```text
Error: Command failed: npm install --no-workspaces
npm error code ETARGET
npm error notarget No matching version found for @esri/calcite-components@3.1.0.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
```

This moves the 3rd party license generation to the scheduled workflow. A
pull request will be created with any licensing changes.

[error]: https://github.com/Esri/calcite-design-system/actions/runs/14076068483/job/39419195501#step:5:1288
benelan added a commit that referenced this pull request May 14, 2025
**Related Issue:** #11640

## Summary

Apparently [`generate-license-file`](https://www.npmjs.com/package/generate-license-file)
installs our packages locally somewhere in order to generate the 3rd
party licenses. The licenses script uses the version in `package.json`,
so running it before publishing causes the following [error], since the
version doesn't exist yet:

```text
Error: Command failed: npm install --no-workspaces
npm error code ETARGET
npm error notarget No matching version found for @esri/calcite-components@3.1.0.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
```

This moves the 3rd party license generation to the scheduled workflow. A
pull request will be created with any licensing changes.

[error]: https://github.com/Esri/calcite-design-system/actions/runs/14076068483/job/39419195501#step:5:1288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Issues with changes that don't modify src or test files. skip visual snapshots Pull requests that do not need visual regression testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants