Skip to content

Commit

Permalink
generate third party notice files (#3)
Browse files Browse the repository at this point in the history
the library to generate third party notice files are unable to detect all relevant dependencies for a package due to the monorepo structure and how some part of the node_modules are shared and hoisted to the top level node_modules top level folder.
As a workaround, this PR add a script to copy the target package into a temp folder to generate the full node_modules folder to generate the third party notice file and copy that back into the target package.

**NOTE**: will update chat-headless-react's third party notice file and headless version in package in a new PR


J=CLIP-117
TEST=manual

see that the third party notice files are generated as expected.
  • Loading branch information
yen-tt authored May 15, 2023
1 parent 8d1d851 commit b77494d
Show file tree
Hide file tree
Showing 11 changed files with 3,461 additions and 3,558 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
coverage/
temp/
dist/
.DS_Store
.env
Expand Down
33 changes: 33 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
The files listed in this repository are licensed under the below license. All other features and products are subject to separate agreements and certain functionality requires paid subscriptions to Yext products.

Contains information from the language-subtag-registry JSON Database (https://github.com/mattcg/language-subtag-registry/tree/master/data/json) which is made available under the ODC Attribution License (https://github.com/mattcg/language-subtag-registry/blob/master/LICENSE.md).

BSD 3-Clause License

Copyright (c) 2023, Yext
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 changes: 15 additions & 0 deletions generate-notices.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Because of the monorepo structure, license-check from generate-license-file lib is an unable
# to properly parse all the relevant depedencies in the node_modules of a package. This script
# will temporarily copy the target package outside of the packages/ to generate the
# third-party-notice file and add it to the package.


PACKAGE_DIR=$(pwd)
REPO_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo "copying package $PACKAGE_DIR to $REPO_DIR/temp"
rm -rf "$REPO_DIR/temp"
cp -r $PACKAGE_DIR "$REPO_DIR/temp"
cd "$REPO_DIR/temp" && npm i
generate-license-file --input package.json --output THIRD-PARTY-NOTICES --overwrite
cp "$REPO_DIR/temp/THIRD-PARTY-NOTICES" $PACKAGE_DIR
rm -rf "$REPO_DIR/temp"
Loading

0 comments on commit b77494d

Please sign in to comment.