Skip to content

Commit

Permalink
Merge pull request #18 from ma-residence/add-platform-header
Browse files Browse the repository at this point in the history
Add platform header and more
  • Loading branch information
nicolas-grevin committed Jan 14, 2021
2 parents ab5d210 + db2fe18 commit 4fafd7e
Show file tree
Hide file tree
Showing 14 changed files with 4,795 additions and 1,849 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["transform-class-properties", "transform-flow-strip-types", "transform-object-assign"],
"presets": ["es2015"]
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-flow-strip-types", "@babel/plugin-transform-object-assign"],
"presets": ["@babel/preset-env"]
}
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"node": true,
"mocha": true
},
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"plugins": ["@babel"],
"rules": {
"semi": [2, "always"],
"no-multiple-empty-lines": [2, {"max": 1}],
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/continuous_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: JS-SDK CI

on: [push]

jobs:
continuous_intergration:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8, 10, 12]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: npm install

- name: Check lint
run: npm run lint

- name: Check static
run: npm run flow

- name: Check test
run: npm run test
41 changes: 41 additions & 0 deletions .github/workflows/create_npm_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create npm package

on:
release:
types: [created]

jobs:
create_package:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set env
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/}

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: '12'
registry-url: 'https://npm.pkg.github.com'
scope: '@ma-residence'

- name: Install dependencies
run: npm install

- name: Build package
run: npm run build

- name: Create index.d.ts
run: npx typescript ./dist/index.js --declaration --allowJs --emitDeclarationOnly --outDir ./dist

- name: Set package version
run: sed -i 's/RELEASE_VERSION/'"$RELEASE_VERSION"'/g' dist/package.json

- name: Publish package
run: |
cd dist
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/
.idea/
.DS_Store

*.log
dist/*
!dist/package.json
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# js-sdk

[![Build Status](https://travis-ci.com/ma-residence/js-sdk.svg?token=txabW3XnmBRNYuhMQNLm&branch=master)](https://travis-ci.com/ma-residence/js-sdk)

A SDK for ma-residence API in Javascript.

# Installation
## Installation

Update your bower.json:
- Edit or create the .npmrc file and add these lines
```
registry=https://registry.npmjs.org/
@ma-residence:registry=https://npm.pkg.github.com/
```

```json
{
"dependencies": {
"mr-js-sdk": "[email protected]:ma-residence/js-sdk.git"
}
}
- Login to github: *The username is your github username, the password this your personal access token and the email this your github account email*
```
npm login --registry=https://npm.pkg.github.com --scope=@ma-residence
```

- Install package
```
npm install @ma-residence/[email protected]
# or
npm add @ma-residence/[email protected]
```

# Usage
Expand Down Expand Up @@ -91,6 +97,7 @@ client.request("/foo", {
body: {
foo: "foo"
},
platform: "platform"
}).then(function(response) {
// Here you can check the response status, etc.
// And we return the deserialize content
Expand Down
20 changes: 20 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@ma-residence/mr-js-sdk",
"version": "1.0.5",
"description": "ma-residence.fr js SDK",
"main": "index.js",
"publishConfig": {
"registry": "https://npm.pkg.github.com/ma-residence"
},
"repository": {
"type": "git",
"url": "shh://github.com/ma-residence/js-sdk.git",
"directory": "@ma-residence/mr-js-sdk"
},
"author": "ma-residence",
"license": "UNLICENSED",
"bugs": {
"url": "https://github.com/ma-residence/js-sdk/issues"
},
"homepage": "https://github.com/ma-residence/js-sdk#readme"
}
1 change: 0 additions & 1 deletion mr-client.min.js

This file was deleted.

Loading

0 comments on commit 4fafd7e

Please sign in to comment.