NodeJS

Prerequisites

    Install CLI​
    Node.js version 12.12.0 or higher
    Following should be run by the build step
      npm install
        NOTE: Please make sure package-lock.jsonexists in project root folder. If not please run following comand to generate lock file.npm install --package-lock-only
      npm install -g license-checker

Command-line

Run the following command line by setting your parameters.
1
cdefense scan --lang=node --api-key=<YOUR_API_KEY> \
2
--path=/d/temp/nodejs-system --project-name="my-nodejs-project"
Copied!

Gitlab Integration

1
image: node:12.12.0
2
​
3
variables:
4
API_KEY: <YOUR_API_KEY>
5
​
6
stages:
7
- test
8
​
9
run_scan:
10
stage: test
11
script:
12
- npm install
13
- npm install -g license-checker
14
- curl https://raw.githubusercontent.com/CloudDefenseAI/cd/master/latest/cd-latest-linux-x64.tar.gz > /tmp/cd-latest-linux-x64.tar.gz && tar -C /usr/local/bin -xzf /tmp/cd-latest-linux-x64.tar.gz && chmod +x /usr/local/bin/cdefense
15
- cdefense scan --lang=node --project-name="Sppp Cicd Sample" --api-key=$API_KEY --path=$PWD
16
- echo $?
17
​
Copied!
Last modified 1mo ago