@onexapis/cli 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -213,10 +213,25 @@ onex clone simple -v 1.0.0 -o ./my-clone --no-install
213
213
 
214
214
  ## S3 Configuration
215
215
 
216
- The `upload`, `download`, and `clone` commands use S3 for storage. The CLI **automatically loads `.env.local` and `.env`** from the project root, so you only need to configure once:
216
+ The `upload`, `download`, and `clone` commands use S3 for storage. The CLI automatically loads env files in this order (first found wins):
217
+
218
+ 1. **Project-level**: `.env.local` and `.env` at the project root
219
+ 2. **Global**: `~/.onex/.env` (works from any directory)
220
+
221
+ ### Project config (recommended for teams)
222
+
223
+ ```bash
224
+ # .env.local (at project root — shared with the team via .env.example)
225
+ BUCKET_NAME=my-bucket
226
+ AWS_REGION=ap-southeast-1
227
+ AWS_ACCESS_KEY_ID=your-access-key
228
+ AWS_SECRET_ACCESS_KEY=your-secret-key
229
+ ```
230
+
231
+ ### Global config (for personal use / running outside a project)
217
232
 
218
233
  ```bash
219
- # .env.local (at project root)
234
+ # ~/.onex/.env
220
235
  BUCKET_NAME=my-bucket
221
236
  AWS_REGION=ap-southeast-1
222
237
  AWS_ACCESS_KEY_ID=your-access-key
@@ -226,8 +241,8 @@ AWS_SECRET_ACCESS_KEY=your-secret-key
226
241
  Then all S3 commands just work without extra flags:
227
242
 
228
243
  ```bash
229
- onex upload --theme simple # picks up bucket + credentials from .env.local
230
- onex clone simple # same
244
+ onex upload --theme simple # picks up config automatically
245
+ onex clone simple # works from any directory
231
246
  onex download -t simple # same
232
247
  ```
233
248
 
package/dist/cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var path = require('path');
5
+ var os = require('os');
5
6
  var dotenv = require('dotenv');
6
7
  var fs = require('fs-extra');
7
8
  var ejs = require('ejs');
@@ -15,12 +16,12 @@ var archiver = require('archiver');
15
16
  var FormData = require('form-data');
16
17
  var fetch = require('node-fetch');
17
18
  var clientS3 = require('@aws-sdk/client-s3');
18
- var os = require('os');
19
19
  var AdmZip = require('adm-zip');
20
20
 
21
21
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
22
22
 
23
23
  var path__default = /*#__PURE__*/_interopDefault(path);
24
+ var os__default = /*#__PURE__*/_interopDefault(os);
24
25
  var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
25
26
  var fs__default = /*#__PURE__*/_interopDefault(fs);
26
27
  var ejs__default = /*#__PURE__*/_interopDefault(ejs);
@@ -31,7 +32,6 @@ var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
31
32
  var archiver__default = /*#__PURE__*/_interopDefault(archiver);
32
33
  var FormData__default = /*#__PURE__*/_interopDefault(FormData);
33
34
  var fetch__default = /*#__PURE__*/_interopDefault(fetch);
34
- var os__default = /*#__PURE__*/_interopDefault(os);
35
35
  var AdmZip__default = /*#__PURE__*/_interopDefault(AdmZip);
36
36
 
37
37
  var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
@@ -2696,6 +2696,7 @@ async function cloneCommand(themeName, options) {
2696
2696
  var projectRoot = getProjectRoot();
2697
2697
  dotenv__default.default.config({ path: path__default.default.join(projectRoot, ".env.local"), quiet: true });
2698
2698
  dotenv__default.default.config({ path: path__default.default.join(projectRoot, ".env"), quiet: true });
2699
+ dotenv__default.default.config({ path: path__default.default.join(os__default.default.homedir(), ".onex", ".env"), quiet: true });
2699
2700
  var program = new commander.Command();
2700
2701
  program.name("onex").description("CLI tool for OneX theme development").version("0.1.0");
2701
2702
  program.command("init").description("Create a new OneX theme project").argument("[project-name]", "Name of the project").option(