-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add npm deploy and move backend source to
/api
folder (#3422)
- Loading branch information
1 parent
734ca0f
commit fe7a2c5
Showing
33 changed files
with
246 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,16 @@ jobs: | |
- name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- name: Initialize NPM config | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Make the release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Z-Wave JS Bot" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.github | ||
.vscode | ||
.yarn | ||
/api/ | ||
/src/ | ||
/certs/ | ||
/docker/ | ||
/docs/ | ||
/kubernetes/ | ||
/test/ | ||
/pkg/ | ||
/store/ | ||
|
||
|
||
/.* | ||
/*.ts | ||
/*.js | ||
/kustomization.yaml | ||
/fakeNodes.json | ||
/nodemon.json | ||
/package.sh | ||
/index.html | ||
|
||
/tsconfig.* | ||
|
||
/*.md | ||
/*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'nprogress/nprogress.css' | ||
import NProgress from 'nprogress' | ||
import axios from 'axios' | ||
|
||
const calculatePercentage = (loaded, total) => Math.floor(loaded * 1.0) / total | ||
|
||
export default function loadProgressBar(config, instance = axios) { | ||
let requestsCounter = 0 | ||
|
||
const setupStartProgress = () => { | ||
instance.interceptors.request.use((c) => { | ||
requestsCounter++ | ||
NProgress.start() | ||
return c | ||
}) | ||
} | ||
|
||
const setupUpdateProgress = () => { | ||
const update = (e) => { | ||
const { loaded, total } = e | ||
|
||
// sometimes `total` is undefined, in that case simply call `inc` without params | ||
if (loaded !== undefined && total !== undefined) { | ||
NProgress.set(calculatePercentage(loaded, total)) | ||
} else { | ||
NProgress.inc() | ||
} | ||
} | ||
instance.defaults.onDownloadProgress = update | ||
instance.defaults.onUploadProgress = update | ||
} | ||
|
||
const setupStopProgress = () => { | ||
const responseFunc = (response) => { | ||
if (--requestsCounter === 0) { | ||
NProgress.done() | ||
} | ||
return response | ||
} | ||
|
||
const errorFunc = (error) => { | ||
if (--requestsCounter === 0) { | ||
NProgress.done() | ||
} | ||
return Promise.reject(error) | ||
} | ||
|
||
instance.interceptors.response.use(responseFunc, errorFunc) | ||
} | ||
|
||
NProgress.configure(config) | ||
setupStartProgress() | ||
setupUpdateProgress() | ||
setupStopProgress() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.