@ubox-tools/deploy-xperience 1.1.9 → 1.1.10

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.
Files changed (3) hide show
  1. package/README.md +18 -2
  2. package/deploy.js +26 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -35,13 +35,29 @@ npx @ubox-tools/deploy-xperience [app1 app2 ...] [options]
35
35
  | `--show` | Show the browser window (default: headless) |
36
36
  | `--help` | Print usage and exit |
37
37
 
38
- Credentials can also be supplied via environment variables:
38
+ Credentials are resolved in this order:
39
+
40
+ 1. CLI flags (`--email`, `--password`)
41
+ 2. Environment variables (`UBOX_EMAIL`, `UBOX_PASSWORD`)
42
+ 3. `ubox-credentials.json` in the project root
43
+ 4. Interactive prompt (if the terminal is interactive)
44
+
45
+ **`ubox-credentials.json`** (place in the experience project root):
46
+
47
+ ```json
48
+ {
49
+ "email": "me@example.com",
50
+ "password": "secret"
51
+ }
52
+ ```
53
+
54
+ **Environment variables:**
39
55
 
40
56
  ```
41
57
  UBOX_EMAIL=me@example.com UBOX_PASSWORD=secret npx @ubox-tools/deploy-xperience
42
58
  ```
43
59
 
44
- If either credential is missing and the terminal is interactive, the script prompts for them.
60
+ If a credential is provided by a higher-priority source, the file value for that field is ignored.
45
61
 
46
62
  ## Examples
47
63
 
package/deploy.js CHANGED
@@ -141,6 +141,23 @@ Examples:
141
141
 
142
142
  // ─── Credentials ──────────────────────────────────────────────────────────────
143
143
 
144
+ function loadCredentialsFile() {
145
+ const filePath = path.join(process.cwd(), 'ubox-credentials.json');
146
+ try {
147
+ const raw = fs.readFileSync(filePath, 'utf8');
148
+ const data = JSON.parse(raw);
149
+ const email = typeof data.email === 'string' && data.email.trim();
150
+ const password = typeof data.password === 'string' && data.password.trim();
151
+ if (email && password) {
152
+ console.log('Using credentials from ubox-credentials.json');
153
+ return { email, password };
154
+ }
155
+ } catch (_) {
156
+ // File missing or invalid — continue with normal credential flow
157
+ }
158
+ return null;
159
+ }
160
+
144
161
  async function promptCredentials(email, password) {
145
162
  if (email && password) return { email, password };
146
163
 
@@ -1090,7 +1107,15 @@ async function main() {
1090
1107
  if (noPlayer) console.log('Flags : --noplayer (skip Ubox creation)');
1091
1108
  console.log('');
1092
1109
 
1093
- const { email, password } = await promptCredentials(emailArg, passwordArg);
1110
+ let credEmail = emailArg, credPassword = passwordArg;
1111
+ if (!credEmail || !credPassword) {
1112
+ const fileCreds = loadCredentialsFile();
1113
+ if (fileCreds) {
1114
+ if (!credEmail) credEmail = fileCreds.email;
1115
+ if (!credPassword) credPassword = fileCreds.password;
1116
+ }
1117
+ }
1118
+ const { email, password } = await promptCredentials(credEmail, credPassword);
1094
1119
 
1095
1120
  const browser = await puppeteer.launch({
1096
1121
  headless: !show,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubox-tools/deploy-xperience",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "Deploy a Ubox experience to studio.ubox.world",
5
5
  "bin": { "deploy-xperience": "./deploy.js" },
6
6
  "dependencies": { "puppeteer": "*" },