UNPKG

1.46 kBapplication/x-shView Raw
1#!/bin/bash
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16# find . -maxdepth 2 -name package.json | xargs jq -s 'reduce .[] as $item ({} ; . + {($item.name): {dependencies:$item.dependencies,devDependencies:$item.devDependencies }} )' | prettyoutput --indent 3
17# Exit on first error, print all commands.
18set -e
19
20# Grab the parent (root) directory.
21DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
22
23BIN=${DIR}/node_modules/.bin
24
25echo "Scanning all the node modules starting at "${DIR}
26#echo "Needs to have had npm install -g npm -g install licensecheck"
27
28rm -f "${DIR}/license-raw.txt"
29touch "${DIR}/license-raw.txt"
30rm -f "${DIR}/license-full.txt"
31touch "${DIR}/license-full.txt"
32
33
34
35ls -d "${DIR}"/packages/* | while read dirname
36do
37 cd "${dirname}"
38 ${BIN}/licensecheck --tsv >> "${DIR}/license-raw.txt"
39 ${BIN}/licensecheck >> "${DIR}/license-full.txt"
40 echo "-------------------------------------------" >> "${DIR}/license-full.txt"
41
42done
43
44exit
\No newline at end of file