Skip to content

Commit

Permalink
feat: initial import & poll script for 1 repo
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed May 19, 2020
0 parents commit 6b8dfda
Show file tree
Hide file tree
Showing 17 changed files with 480 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
version: 2.1
orbs:
snyk: snyk/snyk@0.0.8

jobs:
build-test-monitor:
docker:
# specify the version
- image: circleci/node:10.16.3

steps:
- checkout
- run:
name: "Install deps"
command: |
npm install
- run:
name: "Run Tests"
command: |
npm test
- snyk/scan:
fail-on-issues: true
monitor-on-build: true
token-variable: SNYK_TOKEN
- run: ./generate-binaries.sh
- persist_to_workspace:
root: .
paths:
- dist/*

build-test:
docker:
# specify the version
- image: circleci/node:10.16.3

steps:
- checkout
- run:
name: "Install deps"
command: |
npm install
- run:
name: "Run Tests"
command: |
npm test
- snyk/scan:
fail-on-issues: true
monitor-on-build: false
token-variable: SNYK_TOKEN

publish-github-release:
docker:
- image: gcr.io/snyk-technical-services/cicd-github
auth:
username: _json_key
password: $GCLOUD_GCR_SNYK_TS_READER
steps:
- checkout
- attach_workspace:
at: .
- run:
name: "Publish Release on GitHub"
command: |
VERSIONJUMP=$(git log --oneline -1 --pretty=%B | cat | grep -E 'minor|major|patch' | awk -F ':' '{print $1}')
VERSION=$(/workdir/nextver.sh "$VERSIONJUMP")
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} dist/
workflows:
version: 2.1
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- build-test-monitor
build-test-monitor-publish:
jobs:
- build-test-monitor:
filters:
branches:
only:
- master
- publish-github-release:
requires:
- build-test-monitor
filters:
branches:
only:
- master
build-test:
jobs:
- build-test:
filters:
branches:
ignore:
- master

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
30 changes: 30 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"node": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true,
"allowTypedFunctionExpressions": true
}
],
"no-var": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error"
}
}
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- [ ] Tests written and linted [ℹ︎](/~https://github.com/snyk/general/wiki/Tests)
- [ ] Documentation written [ℹ︎](/~https://github.com/snyk/general/wiki/Documentation)
- [ ] Commit history is tidy [ℹ︎](/~https://github.com/snyk/general/wiki/Git)

### What this does

_Explain why this PR exists_

### Notes for the reviewer

_Instructions on how to run this locally, background context, what to review, questions…_

### More information

- [Jira ticket SC-0000](https://snyksec.atlassian.net/browse/SC-0000)
- [Link to documentation](/~https://github.com/snyk/walmart-import/wiki/)

### Screenshots

_Visuals that may help the reviewer_
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
npm-debug.log
.npmrc
# output
dist
.DS_Store
*.log
package-lock.json
yarn.lock
.eslintcache
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arrowParens": "always",
"trailingComma": "all",
"singleQuote": true,
"htmlWhitespaceSensitivity": "ignore"
}
8 changes: 8 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.5
ignore: {}
# patches apply the minimum changes required to fix a vulnerability
patch:
SNYK-JS-LODASH-450202:
- lodash:
patched: '2019-07-05T10:44:37.780Z'
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2018 Snyk Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
![Snyk logo](https://snyk.io/style/asset/logo/snyk-print.svg)

***

[![Known Vulnerabilities](https://snyk.io/test/github/snyk/walmart-import/badge.svg)](https://snyk.io/test/github/snyk/walmart-import)

Snyk helps you find, fix and monitor for known vulnerabilities in your dependencies, both on an ad hoc basis and as part of your CI (Build) system.

## Snyk walmart-import
Walmart import for 20k+ repos
Empty file added fixtures/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverageFrom: ['lib/**/*.ts'],
coverageReporters: ['text-summary', 'html'],
};
73 changes: 73 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "walmart-import",
"description": "Walmart import for 20k+ repos",
"main": "dist/index.js",
"scripts": {
"format:check": "prettier --check '{''{lib,test}/!(fixtures)/**/*,*}.{js,ts,json,yml}'",
"format": "prettier --write '{''{lib,test}/!(fixtures)/**/*,*}.{js,ts,json,yml}'",
"lint": "npm run format:check && npm run lint:eslint",
"lint:eslint": "eslint --cache '{lib,test}/**/*.ts'",
"test": "npm run lint && npm run build && npm run test:unit",
"test:unit": "jest",
"test:coverage": "npm run test:unit -- --coverage",
"test:watch": "tsc-watch --onSuccess 'npm run test:unit'",
"build": "tsc",
"build-watch": "tsc -w",
"prepare": "npm run build",
"snyk-test": "snyk test",
"pkg-binaries": "npx pkg . -t node12-linux-x64,node12-macos-x64,node12-win-x64 --out-path ./dist/binaries"
},
"types": "./dist/index.d.ts",
"repository": {
"type": "git",
"url": "/~https://github.com/snyk-tech-services/walmart-import"
},
"author": "Snyk Tech Services",
"license": "Apache-2.0",
"engines": {
"node": ">=12"
},
"files": [
"bin",
"dist"
],
"homepage": "/~https://github.com/snyk-tech-services/walmart-import#readme",
"dependencies": {
"@snyk/configstore": "^3.2.0-rc1",
"axios": "^0.19.2",
"debug": "4.1.1",
"lodash": "^4.17.15",
"needle": "2.4.1",
"sleep-promise": "8.0.1",
"snyk-config": "^3.0.0",
"source-map-support": "^0.5.16",
"tslib": "^1.10.0"
},
"devDependencies": {
"@types/debug": "4.1.5",
"@types/jest": "^25.1.1",
"@types/lodash": "^4.14.149",
"@types/needle": "2.0.4",
"@types/node": "^12.12.26",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"ts-jest": "^25.1.0",
"ts-node": "8.6.2",
"tsc-watch": "^4.1.0",
"typescript": "^3.7.5"
},
"pkg": {
"scripts": [
"dist/**/*.js"
]
},
"release": {
"branches": [
"master"
]
}
}
Loading

0 comments on commit 6b8dfda

Please sign in to comment.