Skip to content

Commit

Permalink
Merge pull request #43 from snyk/chore/add-semantic-release
Browse files Browse the repository at this point in the history
Chore/add semantic release
  • Loading branch information
Arvi3d committed Jan 28, 2021
2 parents 2ce905d + 050c224 commit 5db859c
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 6,348 deletions.
54 changes: 47 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
version: 2.1
orbs:
node: circleci/node@4.1.0
jobs:
build:
executor: node/default
test:
docker:
- image: circleci/node:12
steps:
- restore_cache:
keys:
- v1-{{ .Branch }}-{{ .Revision }}
- v1-{{ .Branch }}
- v1-
- checkout
- node/install-packages:
cache-path: ~/project/node_modules
override-ci-command: npm install
- run:
name: Install
command: npm install
- save_cache:
key: v1-{{ .Branch }}-{{ .Revision }}
paths:
- node_modules
- .git
- run: npm run test

release:
docker:
- image: circleci/node:12
steps:
- restore_cache:
keys:
- v1-{{ .Branch }}-{{ .Revision }}
- v1-{{ .Branch }}
- v1-
- checkout
- run:
name: Install
command: npm install
- run:
name: Publish to GitHub
command: npx semantic-release

workflows:
default_workflow:
jobs:
- test:
context: nodejs-install
- release:
context: nodejs-lib-release
requires:
- test
filters:
branches:
only:
- master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
.idea
coverage
tsc.iml
package-lock.json
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 DeepCodeAI
Copyright (c) 2020 Snyk Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,24 @@

Typescript consumer of public API

**This library is deprecated and is transferred to [@snyk/code-client](https://www.npmjs.com/package/@deepcode/tsc)**

No further development or maintance is expected here. Please move to the new library

[![deepcode](https://www.deepcode.ai/api/gh/badge?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF0Zm9ybTEiOiJnaCIsIm93bmVyMSI6IkRlZXBDb2RlQUkiLCJyZXBvMSI6InRzYyIsImluY2x1ZGVMaW50IjpmYWxzZSwiYXV0aG9ySWQiOjEyNDY5LCJpYXQiOjE1OTYwOTY3MTJ9.I7rfzfZLPc-SMEModrFPFTMbKpnCkQ5ztPzrPOdruhU)](https://www.deepcode.ai/app/gh/DeepCodeAI/tsc/_/dashboard?utm_content=gh%2FDeepCodeAI%2Ftsc)

[![npm version](https://img.shields.io/npm/v/@deepcode/tsc.svg?style=flat-square)](https://www.npmjs.org/package/@deepcode/tsc)
[![npm downloads](https://img.shields.io/npm/dm/@deepcode/tsc.svg?style=flat-square)](http://npm-stat.com/charts.html?package=@deepcode/tsc)
[![npm version](https://img.shields.io/npm/v/@snyk/code-client.svg?style=flat-square)](https://www.npmjs.org/package/@snyk/code-client)
[![npm downloads](https://img.shields.io/npm/dm/@snyk/code-client.svg?style=flat-square)](http://npm-stat.com/charts.html?package=@snyk/code-client)

# Installation

```shell script
$ npm install --save @deepcode/tsc
$ npm install --save @snyk/code-client
```

# Usage

### Creates and initializes an instance

```javascript
import tsc from '@deepcode/tsc';
import tsc from '@snyk/code-client';

// An address of server which will be used in order to send code and analyse it.
// Default: 'https://www.deepcode.ai'.
const baseURL = 'https://www.deepcode.ai';
const baseURL = 'https://www.snyk.io';

```

Expand All @@ -35,7 +28,7 @@ const baseURL = 'https://www.deepcode.ai';
```javascript
const loginResponse = await tsc.startSession({
baseURL,
// An identificator for the editor using the DeepCode APIs
// An identificator for the editor using the Snyk APIs
source: 'atom',
});

Expand Down
18 changes: 7 additions & 11 deletions development.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,24 @@ $ npm install && npm run compile && npx yalc publish
After that you have to create symlink to your package in your project folder:
```shell script
$ cd <project-location>
$ npx yalc add @deepcode/tsc
$ npx yalc add @snyk/code-client
```

## Publishing

### Before publishing make sure test pass

Test variables:
- `DEEPCODE_URL` is the DC server URL (staging deployment if not provided)
- `DEEPCODE_API_KEY` is a sessionToken of a user with access to the DeepCodeAI organization
- `DEEPCODE_API_KEY_NO_ACCESS` is a sessionToken of a user with no access to the DeepCodeAI organization (even better if on a different platform than GitHub)
- `DEEPCODE_OAUTH_KEY` is a GitHub personal access token of a user with access to the DeepCodeAI organization
- `SNYK_URL` is the DC server URL (staging deployment if not provided)
- `SNYK_API_KEY` is a sessionToken of a user with access to the Snyk
- `SNYK_API_KEY_NO_ACCESS` is a sessionToken of a user with no access to the snyk organization (even better if on a different platform than GitHub)
- `SNYK_OAUTH_KEY` is a GitHub personal access token of a user with access to the snyk organization

```shell script
$ cd <package-location>
$ DEEPCODE_URL=... DEEPCODE_API_KEY=... DEEPCODE_API_KEY_NO_ACCESS=... DEEPCODE_AUTH_KEY=... npm run test
$ SNYK_URL=... SNYK_API_KEY=... SNYK_API_KEY_NO_ACCESS=... SNYK_AUTH_KEY=... npm run test
```

#### Compile and publish

```shell script
$ cd <package-location>
$ npm run compile
$ npm publish --access public
```
No need to do anything. We have CircleCI CI/CD pipeline with automatic semantic versioning

0 comments on commit 5db859c

Please sign in to comment.