Skip to content

Commit

Permalink
Merge pull request #16 from snyk-tech-services/fix/tweak-build
Browse files Browse the repository at this point in the history
fix: add .releaserc change import variable
  • Loading branch information
lili2311 authored May 31, 2020
2 parents cbedc64 + a7ec6fd commit a93cbe0
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
63 changes: 63 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"prepare": [
"@semantic-release/npm",
{
"//": "adds a file to identify a build as a standalone binary",
"path": "@semantic-release/exec",
"cmd": "echo '' > dist/STANDALONE"
},
{
"//": "build the alpine, macos, linux and windows binaries",
"path": "@semantic-release/exec",
"cmd": "npx pkg . -t node12-linux-x64,node12-macos-x64,node12-win-x64",
},
{
"//": "shasum all binaries",
"path": "@semantic-release/exec",
"cmd": "shasum -a 256 snyk-import-linux > snyk-import-linux.sha256 && shasum -a 256 snyk-import-macos > snyk-import-macos.sha256 && shasum -a 256 snyk-import-win.exe > snyk-import-win.exe.sha256"
},
{
"//": "removes the file we use to identify a build as a standalone binary",
"path": "@semantic-release/exec",
"cmd": "rm dist/STANDALONE"
}
],
"publish": [
"@semantic-release/npm",
{
"path": "@semantic-release/github",
"assets": [
{
"path": "./snyk-linux",
"name": "snyk-import-linux",
"label": "snyk-import-linux"
},
{
"path": "./snyk-import-linux.sha256",
"name": "snyk-import-linux.sha256",
"label": "snyk-import-linux.sha256"
},
{
"path": "./snyk-import-macos",
"name": "snyk-import-macos",
"label": "snyk-import-macos"
},
{
"path": "./snyk-import-macos.sha256",
"name": "snyk-import-macos.sha256",
"label": "snyk-import-macos.sha256"
},
{
"path": "./snyk-import-win.exe",
"name": "snyk-import-win.exe",
"label": "snyk-import-win.exe"
},
{
"path": "./snyk-import-win.exe.sha256",
"name": "snyk-import-win.exe.sha256",
"label": "snyk-import-win.exe.sha256"
}
]
}
]
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This script is intended to help import projects into Snyk with a controlled pace
"target": {
"name": "shallow-goof-policy",
"owner": "snyk-fixtures",
"branch": "master" // optional!
"branch": "master"
}
},
{
Expand All @@ -53,9 +53,10 @@ This script is intended to help import projects into Snyk with a controlled pace
}
```
2. Set the env vars mentioned:
- `SNYK_IMPORT_PATH`- the path to the import file
- `SNYK_API_TOKEN` - your [Snyk api token](https://app.snyk.io/account)
- `SNYK_LOG_PATH` - the path to folder where all logs should be saved
- `CONCURRENT_IMPORTS` (optional) defaults to 5 repos at a time, which is the recommended amount to import at once as a max. Just 1 repo may have many projects inside. (10 may also be okay if all repos are small)
- `SNYK_HOST` (optional) defaults to `https://snyk.io`

3. `npm run build` and then `DEBUG=snyk* node dist/index.js`
1. `npm run build` and then `DEBUG=snyk* node dist/index.js`
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "snyk-api-import",
"description": "Walmart import for 20k+ repos",
"main": "dist/index.js",
"bin": "dist/index.js",
"bin": {
"snyk-import": "dist/index.js"
},
"scripts": {
"format:check": "prettier --check '{''{lib,test}/!(test/**/fixtures)/**/*,*}.{js,ts,json,yml}'",
"format": "prettier --write '{''{lib,test}/!(test/**/fixtures)/**/*,*}.{js,ts,json,yml}'",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/get-import-path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function getImportProjectsFile(): string {
const snykImportPath = process.env.SNYK_LOG_PATH;
const snykImportPath = process.env.SNYK_IMPORT_PATH;
if (!snykImportPath) {
throw new Error(
`Please set the SNYK_IMPORT_PATH e.g. export SNYK_IMPORT_PATH='~/my/path/to/file'`,
Expand Down

0 comments on commit a93cbe0

Please sign in to comment.