Add script to do npm audit
MODIFY
.circleci/config.yml
.circleci/config.yml
@@ -83,6 +83,9 @@ jobs:
- image: circleci/golang:1.12.0-node
steps:
- checkout
+ - run:
+ name: Update npm
+ command: 'sudo npm install -g npm@latest'
- run:
name: install hub
command: |
@@ -94,10 +97,6 @@ jobs:
name: Submit PR if npm audit fix makes changes
command: ./scripts/npm-audit-fix.sh
-
-
-
-
workflows:
version: 2
test_all:
@@ -107,7 +106,7 @@ workflows:
nightly:
triggers:
- schedule:
- cron: "35 0 * * *"
+ cron: "0 0 * * *"
filters:
branches:
only:

MODIFY
scripts/npm-audit-fix.sh
scripts/npm-audit-fix.sh
git clone https://github.com/AgoricBot/nat.git
cd nat
+git remote add upstream https://github.com/Agoric/nat.git
+git fetch upstream
+git checkout master
+git rebase upstream/master
+git config user.email "kate+agoricbot@agoric.com"
+git config user.name "AgoricBot"
+hub push origin master
+git checkout -b npm-audit-fix
if npm audit ; then
echo "Nothing to fix"
else
- git config user.email "kate+agoricbot@agoric.com"
- git config user.name "AgoricBot"
- git checkout -b npm-audit-fix
npm audit fix
- git add .
- git commit -m "results of running npm audit fix"
- git remote set-url origin https://AgoricBot:$GITHUB_TOKEN@github.com/AgoricBot/nat.git
- git push origin npm-audit-fix
- hub pull-request --no-edit --base Agoric/nat:master
+ files_changed=true
fi
# Do the same thing with the package.json in the integration-test folder
@@ -20,10 +21,12 @@ cd integration-test
if npm audit ; then
echo "Nothing to fix"
else
- git config user.email "kate+agoricbot@agoric.com"
- git config user.name "AgoricBot"
- git checkout -b npm-audit-fix
npm audit fix
+ files_changed=true
+fi
+cd ..
+
+if [ "$files_changed" = true ] ; then
git add .
git commit -m "results of running npm audit fix"
git remote set-url origin https://AgoricBot:$GITHUB_TOKEN@github.com/AgoricBot/nat.git

Add script to do npm audit (#40)