create-harper 0.0.3 → 0.0.4
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/lib/steps/getEnvVars.js +20 -12
- package/package.json +1 -1
- package/template-react/_github/workflow/deploy.yaml +2 -9
- package/template-react/_gitignore +2 -0
- package/template-react/package.json +1 -1
- package/template-react-ts/_github/workflow/deploy.yaml +2 -9
- package/template-react-ts/_gitignore +2 -0
- package/template-react-ts/package.json +1 -1
package/lib/steps/getEnvVars.js
CHANGED
|
@@ -2,6 +2,12 @@ import * as prompts from '@clack/prompts';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import colors from 'picocolors';
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
gray,
|
|
9
|
+
magenta,
|
|
10
|
+
} = colors;
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* Step 5: Get environment variables for .env file
|
|
@@ -31,10 +37,12 @@ export async function getEnvVars(argv, interactive, template) {
|
|
|
31
37
|
let target = argv['cli-target'];
|
|
32
38
|
let password = '';
|
|
33
39
|
|
|
40
|
+
const prefix = gray('https://') + magenta('fabric.harper.fast') + gray('/') + ' Cluster ';
|
|
41
|
+
|
|
34
42
|
if (interactive) {
|
|
35
43
|
if (!username) {
|
|
36
44
|
const usernameResult = await prompts.text({
|
|
37
|
-
message:
|
|
45
|
+
message: prefix + 'Username:',
|
|
38
46
|
placeholder: 'YOUR_CLUSTER_USERNAME',
|
|
39
47
|
});
|
|
40
48
|
|
|
@@ -44,10 +52,19 @@ export async function getEnvVars(argv, interactive, template) {
|
|
|
44
52
|
username = usernameResult;
|
|
45
53
|
}
|
|
46
54
|
|
|
55
|
+
const passwordResult = await prompts.password({
|
|
56
|
+
message: prefix + 'Password:',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (prompts.isCancel(passwordResult)) {
|
|
60
|
+
return { envVars: {}, cancelled: true };
|
|
61
|
+
}
|
|
62
|
+
password = passwordResult;
|
|
63
|
+
|
|
47
64
|
if (!target) {
|
|
48
65
|
const targetResult = await prompts.text({
|
|
49
|
-
message:
|
|
50
|
-
placeholder: '
|
|
66
|
+
message: prefix + 'URL:',
|
|
67
|
+
placeholder: 'YOUR_CLUSTER_URL_HERE',
|
|
51
68
|
});
|
|
52
69
|
|
|
53
70
|
if (prompts.isCancel(targetResult)) {
|
|
@@ -55,15 +72,6 @@ export async function getEnvVars(argv, interactive, template) {
|
|
|
55
72
|
}
|
|
56
73
|
target = targetResult;
|
|
57
74
|
}
|
|
58
|
-
|
|
59
|
-
const passwordResult = await prompts.password({
|
|
60
|
-
message: 'CLI Target Password:',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
if (prompts.isCancel(passwordResult)) {
|
|
64
|
-
return { envVars: {}, cancelled: true };
|
|
65
|
-
}
|
|
66
|
-
password = passwordResult;
|
|
67
75
|
} else {
|
|
68
76
|
prompts.log.warn('Non-interactive mode: Please update your .env to add your CLI_TARGET_PASSWORD on your own.');
|
|
69
77
|
}
|
package/package.json
CHANGED
|
@@ -29,12 +29,5 @@ jobs:
|
|
|
29
29
|
run: npm test
|
|
30
30
|
- name: Run lint
|
|
31
31
|
run: npm run lint
|
|
32
|
-
- name: Build
|
|
33
|
-
run: npm run build
|
|
34
|
-
- name: Deploy
|
|
35
|
-
run: |
|
|
36
|
-
mkdir deploy
|
|
37
|
-
mv web deploy/
|
|
38
|
-
cp -R deploy-template/* deploy/
|
|
39
|
-
cd deploy
|
|
40
|
-
CLI_TARGET_USERNAME=${{ secrets.CLI_TARGET_USERNAME }} CLI_TARGET_PASSWORD='${{ secrets.CLI_TARGET_PASSWORD }}' harperdb deploy_component project='${{ secrets.CLI_DEPLOY_TARGET_NAME }}' target='${{ secrets.CLI_DEPLOY_TARGET_URL }}' restart=false replicated=true
|
|
32
|
+
- name: Build & deploy
|
|
33
|
+
run: npm run build-and-deploy
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"lint": "echo 'No lint implemented yet'",
|
|
10
10
|
"build": "vite build",
|
|
11
11
|
"preview": "vite preview",
|
|
12
|
-
"deploy": "npx -y dotenv-cli -- harperdb deploy . restart=rolling replicated=true"
|
|
12
|
+
"build-and-deploy": "npm run build && mkdir deploy && mv web deploy/ && cp -R deploy-template/* deploy/ && (cd deploy && npx -y dotenv-cli -- harperdb deploy . restart=rolling replicated=true)"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@harperfast/vite-plugin": "^0.0.1",
|
|
@@ -29,12 +29,5 @@ jobs:
|
|
|
29
29
|
run: npm test
|
|
30
30
|
- name: Run lint
|
|
31
31
|
run: npm run lint
|
|
32
|
-
- name: Build
|
|
33
|
-
run: npm run build
|
|
34
|
-
- name: Deploy
|
|
35
|
-
run: |
|
|
36
|
-
mkdir deploy
|
|
37
|
-
mv web deploy/
|
|
38
|
-
cp -R deploy-template/* deploy/
|
|
39
|
-
cd deploy
|
|
40
|
-
CLI_TARGET_USERNAME=${{ secrets.CLI_TARGET_USERNAME }} CLI_TARGET_PASSWORD='${{ secrets.CLI_TARGET_PASSWORD }}' harperdb deploy_component project='${{ secrets.CLI_DEPLOY_TARGET_NAME }}' target='${{ secrets.CLI_DEPLOY_TARGET_URL }}' restart=false replicated=true
|
|
32
|
+
- name: Build & deploy
|
|
33
|
+
run: npm run build-and-deploy
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"lint": "echo 'No lint implemented yet'",
|
|
10
10
|
"build": "tsc -b && vite build",
|
|
11
11
|
"preview": "vite preview",
|
|
12
|
-
"deploy": "npx -y dotenv-cli -- harperdb deploy . restart=rolling replicated=true"
|
|
12
|
+
"build-and-deploy": "npm run build && mkdir deploy && mv web deploy/ && cp -R deploy-template/* deploy/ && (cd deploy && npx -y dotenv-cli -- harperdb deploy . restart=rolling replicated=true)"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@harperfast/vite-plugin": "^0.0.1",
|