deploy.sh 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc +4 -15
- package/.github/workflows/ci.yml +48 -0
- package/.husky/pre-commit +5 -0
- package/{test/fixtures/static/out.gifcd → .prettierrc} +0 -0
- package/.release-it.json +5 -0
- package/README.md +3 -4
- package/{test → __tests__}/fixtures/unknown/.gitkeep +0 -0
- package/__tests__/lib/classifier.test.js +49 -0
- package/__tests__/lib/helpers/util.test.js +57 -0
- package/bin/deploy-delete.js +5 -2
- package/bin/deploy-deploy.js +16 -11
- package/bin/deploy-list.js +17 -9
- package/bin/deploy-login.js +25 -21
- package/bin/deploy-logout.js +8 -4
- package/bin/deploy-logs.js +19 -12
- package/bin/deploy-open.js +13 -6
- package/bin/deploy-register.js +25 -20
- package/bin/deploy-server.js +9 -3
- package/bin/deploy-whoami.js +8 -6
- package/bin/deploy.js +97 -71
- package/{test/fixtures → examples}/docker/Dockerfile +0 -0
- package/examples/docker/index.js +12 -0
- package/examples/node/index.js +8 -0
- package/{test/fixtures → examples}/node/package.json +0 -0
- package/examples/static/index.html +22 -0
- package/{test/fixtures → examples}/static/main.css +4 -2
- package/examples/static/out.gifcd +0 -0
- package/generate-docs.js +55 -0
- package/index.js +37 -23
- package/lib/classifier.js +18 -16
- package/lib/deploy.js +30 -22
- package/lib/helpers/cli.js +66 -59
- package/lib/helpers/util.js +36 -30
- package/lib/models/deployment.js +157 -138
- package/lib/models/request.js +29 -26
- package/lib/models/user.js +41 -32
- package/lib/server.js +177 -131
- package/lib/static/static-server.js +52 -51
- package/package.json +43 -33
- package/website/README.md +41 -0
- package/website/babel.config.js +3 -0
- package/website/docs/api/_category_.yml +1 -0
- package/website/docs/api/lib/classifier.js.md +11 -0
- package/website/docs/api/lib/deploy.js.md +13 -0
- package/website/docs/api/lib/helpers/cli.js.md +193 -0
- package/website/docs/api/lib/helpers/util.js.md +65 -0
- package/website/docs/api/lib/models/deployment.js.md +171 -0
- package/website/docs/api/lib/models/request.js.md +67 -0
- package/website/docs/api/lib/models/user.js.md +92 -0
- package/website/docs/api/lib/server.js.md +0 -0
- package/website/docs/api/lib/static/static-server.js.md +0 -0
- package/website/docs/intro.md +57 -0
- package/website/docusaurus.config.js +82 -0
- package/website/package-lock.json +25218 -0
- package/website/package.json +39 -0
- package/website/sidebars.js +31 -0
- package/website/src/components/HomepageFeatures/index.js +79 -0
- package/website/src/components/HomepageFeatures/styles.module.css +11 -0
- package/website/src/css/custom.css +39 -0
- package/website/src/pages/index.js +57 -0
- package/website/src/pages/index.module.css +23 -0
- package/website/static/.nojekyll +0 -0
- package/{docs → website/static}/example.gif +0 -0
- package/{docs → website/static}/example.mov +0 -0
- package/website/static/img/favicon.ico +0 -0
- package/website/static/img/intro/deploy.png +0 -0
- package/website/static/img/intro/logs.png +0 -0
- package/{docs → website/static/img}/logo.png +0 -0
- package/{docs → website/static/img}/logo.pxm +0 -0
- package/{docs → website/static/img}/logo@2x.png +0 -0
- package/.travis.yml +0 -9
- package/.tryitout +0 -48
- package/docs/code/CLI.html +0 -2901
- package/docs/code/Deployment.html +0 -2469
- package/docs/code/Request.html +0 -906
- package/docs/code/User.html +0 -1219
- package/docs/code/classifier.js.html +0 -121
- package/docs/code/deploy.js.html +0 -122
- package/docs/code/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/code/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/code/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/code/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Semibold-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/docs/code/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/docs/code/helpers_cli.js.html +0 -315
- package/docs/code/helpers_util.js.html +0 -194
- package/docs/code/index.html +0 -66
- package/docs/code/models_deployment.js.html +0 -515
- package/docs/code/models_request.js.html +0 -158
- package/docs/code/models_user.js.html +0 -198
- package/docs/code/module-lib_classifier.html +0 -246
- package/docs/code/module-lib_deploy.html +0 -350
- package/docs/code/module-lib_helpers_util.html +0 -707
- package/docs/code/scripts/linenumber.js +0 -25
- package/docs/code/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/code/scripts/prettify/lang-css.js +0 -2
- package/docs/code/scripts/prettify/prettify.js +0 -28
- package/docs/code/styles/jsdoc-default.css +0 -692
- package/docs/code/styles/prettify-jsdoc.css +0 -111
- package/docs/code/styles/prettify-tomorrow.css +0 -132
- package/docs/index.html +0 -4463
- package/docs/main.css +0 -162
- package/docs/main.js +0 -53
- package/test/fixtures/docker/index.js +0 -12
- package/test/fixtures/node/index.js +0 -8
- package/test/fixtures/static/index.html +0 -14
- package/test/lib/classifier.js +0 -51
- package/test/lib/helpers/util.js +0 -47
package/.eslintignore
CHANGED
package/.eslintrc
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "eslint:recommended",
|
|
2
|
+
"extends": ["eslint:recommended", "plugin:jest/recommended"],
|
|
3
|
+
"plugins": ["jest"],
|
|
3
4
|
"env": {
|
|
4
5
|
"es6": true,
|
|
5
6
|
"node": true
|
|
6
7
|
},
|
|
7
8
|
"parserOptions": {
|
|
8
|
-
"ecmaVersion": "
|
|
9
|
-
|
|
10
|
-
"rules": {
|
|
11
|
-
"no-inner-declarations": 0,
|
|
12
|
-
"strict": 0,
|
|
13
|
-
"semi": [
|
|
14
|
-
"error",
|
|
15
|
-
"always"
|
|
16
|
-
],
|
|
17
|
-
"no-octal": 0,
|
|
18
|
-
"indent": [
|
|
19
|
-
"error",
|
|
20
|
-
2
|
|
21
|
-
]
|
|
9
|
+
"ecmaVersion": "latest",
|
|
10
|
+
"sourceType": "module"
|
|
22
11
|
}
|
|
23
12
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [16.x]
|
|
15
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v2
|
|
18
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
19
|
+
uses: actions/setup-node@v2
|
|
20
|
+
with:
|
|
21
|
+
node-version: ${{ matrix.node-version }}
|
|
22
|
+
cache: "npm"
|
|
23
|
+
- run: npm i -g npm@7
|
|
24
|
+
- run: npm ci
|
|
25
|
+
- run: npm run build --if-present
|
|
26
|
+
- run: npm test
|
|
27
|
+
|
|
28
|
+
gh-release:
|
|
29
|
+
if: github.event_name != 'pull_request'
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v2
|
|
33
|
+
- uses: actions/setup-node@v2
|
|
34
|
+
with:
|
|
35
|
+
node-version: "16.x"
|
|
36
|
+
- uses: webfactory/ssh-agent@v0.5.3
|
|
37
|
+
with:
|
|
38
|
+
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
|
|
39
|
+
- name: Release to GitHub Pages
|
|
40
|
+
env:
|
|
41
|
+
USE_SSH: true
|
|
42
|
+
GIT_USER: git
|
|
43
|
+
run: |
|
|
44
|
+
git config --global user.email "gabecsapo@gmail.com"
|
|
45
|
+
git config --global user.name "Gabriel J. Csapo"
|
|
46
|
+
cd website
|
|
47
|
+
npm install
|
|
48
|
+
npm run deploy
|
|
File without changes
|
package/.release-it.json
ADDED
package/README.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
# deploy.sh <img align="right" src="
|
|
1
|
+
# deploy.sh <img align="right" src="website/static/img/logo.png" width="120">
|
|
2
2
|
|
|
3
3
|
> ☁️ open source continuous deployment service
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/deploy.sh)
|
|
6
|
-
[](https://lcov-server.gabrielcsapo.com/coverage/github%2Ecom/gabrielcsapo/deploy.sh)
|
|
7
6
|
[](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/deploy.sh)
|
|
8
7
|
[](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/deploy.sh#info=devDependencies)
|
|
9
8
|
[](https://travis-ci.org/gabrielcsapo/deploy.sh)
|
|
10
9
|

|
|
11
10
|

|
|
12
11
|
|
|
13
|
-

|
|
14
13
|
|
|
15
|
-
To learn more visit [
|
|
14
|
+
To learn more visit [https://gabrielcsapo.github.io/deploy.sh](https://gabrielcsapo.github.io/deploy.sh)
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const classifier = require("../../lib/classifier");
|
|
4
|
+
|
|
5
|
+
describe("@lib/classifier", () => {
|
|
6
|
+
const baseDirectory = path.resolve(__dirname, "..", "..", "examples");
|
|
7
|
+
|
|
8
|
+
test("should be able to classify static site", async () => {
|
|
9
|
+
const directory = path.resolve(baseDirectory, "static");
|
|
10
|
+
const output = await classifier(directory);
|
|
11
|
+
|
|
12
|
+
expect(output).toEqual({
|
|
13
|
+
type: "static",
|
|
14
|
+
build: `\n FROM mhart/alpine-node:base-8\n WORKDIR ${directory}\n ADD . .\n\n CMD ["node", "index.js"]\n `,
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("should be able to classify node site", async () => {
|
|
19
|
+
const directory = path.resolve(baseDirectory, "node");
|
|
20
|
+
const output = await classifier(directory);
|
|
21
|
+
|
|
22
|
+
expect(output).toEqual({
|
|
23
|
+
type: "node",
|
|
24
|
+
build: `\n FROM mhart/alpine-node:8\n WORKDIR ${directory}\n ADD . .\n\n RUN npm install\n\n CMD ["npm", "start"]\n `,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("should be able to classify docker site", async () => {
|
|
29
|
+
const directory = path.resolve(baseDirectory, "docker");
|
|
30
|
+
const output = await classifier(directory);
|
|
31
|
+
|
|
32
|
+
expect(output).toEqual({
|
|
33
|
+
type: "docker",
|
|
34
|
+
build: `FROM mhart/alpine-node:8\nWORKDIR ${directory}\nADD . .\n\nCMD ["node", "index.js"]\n`,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("should be able to classify unknown deploy target", async () => {
|
|
39
|
+
const directory = path.resolve(
|
|
40
|
+
path.resolve(__dirname, "..", "fixtures"),
|
|
41
|
+
"unknown"
|
|
42
|
+
);
|
|
43
|
+
const output = await classifier(directory);
|
|
44
|
+
|
|
45
|
+
expect(output).toEqual({
|
|
46
|
+
type: "unknown",
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const os = require("os");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
getPort,
|
|
6
|
+
hash,
|
|
7
|
+
contains,
|
|
8
|
+
mk,
|
|
9
|
+
rm,
|
|
10
|
+
} = require("../../../lib/helpers/util");
|
|
11
|
+
|
|
12
|
+
describe("@lib/util", () => {
|
|
13
|
+
test("@getPort: should be able return a valid port", async () => {
|
|
14
|
+
let port = await getPort();
|
|
15
|
+
let port1 = await getPort();
|
|
16
|
+
|
|
17
|
+
expect(Number.isInteger(port)).toBeTruthy();
|
|
18
|
+
expect(Number.isInteger(port1)).toBeTruthy();
|
|
19
|
+
expect(port !== port1).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("@hash: should return a proper lowercase hash", () => {
|
|
23
|
+
const ret = hash(6);
|
|
24
|
+
expect(ret.length).toBeTruthy();
|
|
25
|
+
expect(ret.toLowerCase()).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("@contains: should be able to return a proper conditional for truthy and false cases", () => {
|
|
29
|
+
expect(
|
|
30
|
+
contains(
|
|
31
|
+
["index.html", "main.css"],
|
|
32
|
+
["index.html", "!Dockerfile", "!package.json"]
|
|
33
|
+
)
|
|
34
|
+
).toBeTruthy();
|
|
35
|
+
expect(
|
|
36
|
+
contains(
|
|
37
|
+
["index.html", "main.css", "Dockerfile"],
|
|
38
|
+
["index.html", "!Dockerfile", "!package.json"]
|
|
39
|
+
)
|
|
40
|
+
).toBeFalsy();
|
|
41
|
+
expect(
|
|
42
|
+
contains([], ["index.html", "!Dockerfile", "!package.json"])
|
|
43
|
+
).toBeFalsy();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("@mk / @rm: should be able to make recursive directory", async () => {
|
|
47
|
+
let directory = `${os.tmpdir()}/hello/world/this/is/a/nested/directory`;
|
|
48
|
+
|
|
49
|
+
await mk(directory);
|
|
50
|
+
|
|
51
|
+
expect(fs.existsSync(directory)).toBeTruthy();
|
|
52
|
+
|
|
53
|
+
await rm(directory);
|
|
54
|
+
|
|
55
|
+
expect(!fs.existsSync(directory)).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
});
|
package/bin/deploy-delete.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import ora from "ora";
|
|
3
|
+
|
|
4
|
+
export default async function (cli) {
|
|
5
|
+
const spinner = ora().start();
|
|
2
6
|
|
|
3
|
-
module.exports = async function(cli, spinner) {
|
|
4
7
|
spinner.text = `Deleting deployment ${cli.application}`;
|
|
5
8
|
|
|
6
9
|
const { token, username } = await cli.getCredentials();
|
|
@@ -8,4 +11,4 @@ module.exports = async function(cli, spinner) {
|
|
|
8
11
|
await cli.deleteDeployment({ token, username, name: cli.application });
|
|
9
12
|
|
|
10
13
|
spinner.succeed(`Deployment deleted, ${cli.application} successfully`);
|
|
11
|
-
}
|
|
14
|
+
}
|
package/bin/deploy-deploy.js
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import ora from "ora";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
spinner
|
|
7
|
+
export default async function (cli) {
|
|
8
|
+
const spinner = ora().start();
|
|
9
|
+
|
|
10
|
+
spinner.text = "Creating application bundle";
|
|
8
11
|
|
|
9
12
|
await cli.createBundle(process.cwd());
|
|
10
13
|
|
|
11
|
-
spinner.text =
|
|
14
|
+
spinner.text = "Getting deploy keys";
|
|
12
15
|
|
|
13
16
|
const { token, username } = await cli.getCredentials();
|
|
14
17
|
|
|
15
|
-
spinner.text =
|
|
18
|
+
spinner.text = "Uploading application bundle";
|
|
16
19
|
|
|
17
|
-
const bundle = fs.
|
|
20
|
+
const bundle = fs.readFileSync(path.resolve(process.cwd(), "bundle.tgz"));
|
|
18
21
|
|
|
19
22
|
const { deployment } = await cli.uploadBundle({
|
|
20
23
|
name: path.basename(process.cwd()),
|
|
21
24
|
bundle,
|
|
22
25
|
token,
|
|
23
|
-
username
|
|
26
|
+
username,
|
|
24
27
|
});
|
|
25
28
|
|
|
26
|
-
spinner.text =
|
|
29
|
+
spinner.text = "Cleaning up local files";
|
|
27
30
|
|
|
28
31
|
await cli.removeBundle(process.cwd());
|
|
29
32
|
|
|
30
|
-
spinner.succeed(
|
|
31
|
-
}
|
|
33
|
+
spinner.succeed(
|
|
34
|
+
`Upload successfully, http://${deployment.subdomain}.localhost:5000`
|
|
35
|
+
);
|
|
36
|
+
}
|
package/bin/deploy-list.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import Url from "url";
|
|
4
|
+
import Table from "turtler";
|
|
5
|
+
import ora from "ora";
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const Table = require('turtler');
|
|
7
|
+
export default async function (cli) {
|
|
8
|
+
const spinner = ora().start();
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
spinner.text = 'Getting deployment list';
|
|
10
|
+
spinner.text = "Getting deployment list";
|
|
9
11
|
|
|
10
12
|
const { token, username } = await cli.getCredentials();
|
|
11
13
|
const { deployments } = await cli.getDeployments({ token, username });
|
|
12
14
|
|
|
13
15
|
spinner.stop();
|
|
14
16
|
|
|
15
|
-
if(deployments.length > 0) {
|
|
17
|
+
if (deployments.length > 0) {
|
|
16
18
|
let data = [["name", "url", "age", "requests", "status"]];
|
|
17
19
|
|
|
18
20
|
deployments.forEach((r, i) => {
|
|
@@ -20,13 +22,19 @@ module.exports = async function(cli, spinner) {
|
|
|
20
22
|
config.host = `${r.subdomain}.${config.host}`;
|
|
21
23
|
const url = Url.format(config);
|
|
22
24
|
|
|
23
|
-
data[i + 1] = [
|
|
25
|
+
data[i + 1] = [
|
|
26
|
+
r.name,
|
|
27
|
+
url,
|
|
28
|
+
moment(r.updated_at).fromNow(),
|
|
29
|
+
r.requests.toString(),
|
|
30
|
+
r.status,
|
|
31
|
+
];
|
|
24
32
|
});
|
|
25
33
|
|
|
26
34
|
let table = new Table(data);
|
|
27
35
|
|
|
28
36
|
console.log(table.markdown()); // eslint-disable-line
|
|
29
37
|
} else {
|
|
30
|
-
console.log(
|
|
38
|
+
console.log("0 deployments found"); // eslint-disable-line
|
|
31
39
|
}
|
|
32
|
-
}
|
|
40
|
+
}
|
package/bin/deploy-login.js
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
|
+
import ora from "ora";
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = async function(cli, spinner) {
|
|
6
|
-
spinner.stop();
|
|
5
|
+
export default async function (cli) {
|
|
6
|
+
const spinner = ora();
|
|
7
7
|
|
|
8
8
|
const { username, password } = await inquirer.prompt([
|
|
9
9
|
{
|
|
10
|
-
name:
|
|
11
|
-
type:
|
|
12
|
-
message:
|
|
13
|
-
validate: function(
|
|
14
|
-
if (
|
|
10
|
+
name: "username",
|
|
11
|
+
type: "input",
|
|
12
|
+
message: "Enter your e-mail address:",
|
|
13
|
+
validate: function (value) {
|
|
14
|
+
if (
|
|
15
|
+
value.length > 0 &&
|
|
16
|
+
value.indexOf("@") > -1 &&
|
|
17
|
+
value.indexOf(".") > -1
|
|
18
|
+
) {
|
|
15
19
|
return true;
|
|
16
20
|
} else {
|
|
17
|
-
return
|
|
21
|
+
return "Please enter your e-mail address";
|
|
18
22
|
}
|
|
19
|
-
}
|
|
23
|
+
},
|
|
20
24
|
},
|
|
21
25
|
{
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
24
|
-
message:
|
|
26
|
+
name: "password",
|
|
27
|
+
type: "password",
|
|
28
|
+
message: "Enter your password:",
|
|
25
29
|
mask: true,
|
|
26
|
-
validate: function(value) {
|
|
30
|
+
validate: function (value) {
|
|
27
31
|
if (value.length) {
|
|
28
32
|
return true;
|
|
29
33
|
} else {
|
|
30
|
-
return
|
|
34
|
+
return "Please enter your password";
|
|
31
35
|
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
34
38
|
]);
|
|
35
|
-
const credentials = await cli.login({ username, password});
|
|
39
|
+
const credentials = await cli.login({ username, password });
|
|
36
40
|
await cli.cacheCredentials(credentials);
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
}
|
|
42
|
+
spinner.succeed(`Logged in as ${credentials.username}`); // eslint-disable-line
|
|
43
|
+
}
|
package/bin/deploy-logout.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
|
|
5
|
+
export default async function (cli) {
|
|
6
|
+
const spinner = ora().start();
|
|
7
|
+
|
|
4
8
|
const { token, username } = await cli.getCredentials();
|
|
5
9
|
|
|
6
10
|
spinner.text = `Logging out of current session for ${username}`;
|
|
7
11
|
|
|
8
12
|
await cli.logout({ token, username });
|
|
9
|
-
await cli.cacheCredentials({ username:
|
|
13
|
+
await cli.cacheCredentials({ username: "", token: "" });
|
|
10
14
|
|
|
11
|
-
spinner.succeed(`Logged out
|
|
12
|
-
}
|
|
15
|
+
spinner.succeed(`Logged out as ${username}`);
|
|
16
|
+
}
|
package/bin/deploy-logs.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
spinner.text = `Getting logs for ${cli.application}`;
|
|
3
|
+
import ora from "ora";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
const
|
|
5
|
+
export default async function (cli) {
|
|
6
|
+
const spinner = ora().start();
|
|
7
|
+
|
|
8
|
+
spinner.text = `Getting logs for application: "${cli.application}"`;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const { token, username } = await cli.getCredentials();
|
|
11
|
+
const { logs } = await cli.getLogs({
|
|
12
|
+
token,
|
|
13
|
+
username,
|
|
14
|
+
name: cli.application,
|
|
15
|
+
});
|
|
10
16
|
|
|
11
|
-
if(logs) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
if (logs) {
|
|
18
|
+
spinner.info(`
|
|
19
|
+
==========
|
|
20
|
+
${logs.join("").trim()}
|
|
21
|
+
==========
|
|
22
|
+
`);
|
|
16
23
|
} else {
|
|
17
|
-
|
|
24
|
+
spinner.info("No logs available 🙈"); // eslint-disable-line
|
|
18
25
|
}
|
|
19
|
-
}
|
|
26
|
+
}
|
package/bin/deploy-open.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import Url from "url";
|
|
4
|
+
import opn from "opn";
|
|
5
|
+
import ora from "ora";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
spinner
|
|
7
|
+
export default async function (cli) {
|
|
8
|
+
const spinner = ora().start();
|
|
9
|
+
|
|
10
|
+
spinner.text = "Opening up url to deployment instance";
|
|
8
11
|
|
|
9
12
|
const { token, username } = await cli.getCredentials();
|
|
10
|
-
const { deployment } = await cli.getDeployments({
|
|
13
|
+
const { deployment } = await cli.getDeployments({
|
|
14
|
+
token,
|
|
15
|
+
username,
|
|
16
|
+
name: cli.application,
|
|
17
|
+
});
|
|
11
18
|
|
|
12
19
|
const config = Url.parse(cli.url);
|
|
13
20
|
config.host = `${deployment.subdomain}.${config.host}`;
|
|
@@ -16,4 +23,4 @@ module.exports = async function(cli, spinner) {
|
|
|
16
23
|
spinner.text = `Opening deployment at ${url}`;
|
|
17
24
|
spinner.stopAndPersist();
|
|
18
25
|
opn(url, { wait: false });
|
|
19
|
-
}
|
|
26
|
+
}
|
package/bin/deploy-register.js
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import ora from "ora";
|
|
5
|
+
|
|
6
|
+
export default async function (cli) {
|
|
7
|
+
const spinner = ora();
|
|
4
8
|
|
|
5
|
-
module.exports = async function(cli, spinner) {
|
|
6
|
-
spinner.stop();
|
|
7
|
-
|
|
8
9
|
const { username, password } = await inquirer.prompt([
|
|
9
10
|
{
|
|
10
|
-
name:
|
|
11
|
-
type:
|
|
12
|
-
message:
|
|
13
|
-
validate: function(
|
|
14
|
-
if (
|
|
11
|
+
name: "username",
|
|
12
|
+
type: "input",
|
|
13
|
+
message: "Enter a valid e-mail address:",
|
|
14
|
+
validate: function (value) {
|
|
15
|
+
if (
|
|
16
|
+
value.length > 0 &&
|
|
17
|
+
value.indexOf("@") > -1 &&
|
|
18
|
+
value.indexOf(".") > -1
|
|
19
|
+
) {
|
|
15
20
|
return true;
|
|
16
21
|
} else {
|
|
17
|
-
return
|
|
22
|
+
return "Please enter a valid e-mail address";
|
|
18
23
|
}
|
|
19
|
-
}
|
|
24
|
+
},
|
|
20
25
|
},
|
|
21
26
|
{
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
24
|
-
message:
|
|
27
|
+
name: "password",
|
|
28
|
+
type: "password",
|
|
29
|
+
message: "Enter a password:",
|
|
25
30
|
mask: true,
|
|
26
|
-
validate: function(value) {
|
|
31
|
+
validate: function (value) {
|
|
27
32
|
if (value.length) {
|
|
28
33
|
return true;
|
|
29
34
|
} else {
|
|
30
|
-
return
|
|
35
|
+
return "Please enter a password";
|
|
31
36
|
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
37
|
+
},
|
|
38
|
+
},
|
|
34
39
|
]);
|
|
35
40
|
|
|
36
41
|
const credentials = await cli.register({ username, password });
|
|
37
42
|
await cli.cacheCredentials(credentials);
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
}
|
|
44
|
+
spinner.succeed(`registered as ${credentials.username}`); // eslint-disable-line
|
|
45
|
+
}
|
package/bin/deploy-server.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
|
|
5
|
+
export default async function (cli) {
|
|
6
|
+
const spinner = ora().start();
|
|
7
|
+
|
|
8
|
+
const { default: importCommand } = await import("../index.js");
|
|
9
|
+
|
|
10
|
+
importCommand(cli, spinner);
|
|
11
|
+
}
|
package/bin/deploy-whoami.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
|
|
5
|
+
export default async function (cli) {
|
|
6
|
+
const spinner = ora().start();
|
|
7
|
+
|
|
8
|
+
spinner.text = "Figuring out who you are";
|
|
5
9
|
|
|
6
10
|
const { token, username } = await cli.getCredentials();
|
|
7
11
|
const { user } = await cli.getUserDetails({ token, username });
|
|
8
12
|
|
|
9
|
-
spinner.
|
|
10
|
-
|
|
11
|
-
console.log(`currently logged in as ${user.username}`); // eslint-disable-line
|
|
12
|
-
};
|
|
13
|
+
spinner.info(`currently logged in as ${user.username}`); // eslint-disable-line
|
|
14
|
+
}
|