@solidactions/cli 1.22.0 → 1.23.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/README.md +1 -1
- package/dist/commands/env-map.js +1 -1
- package/dist/commands/env-set.js +20 -2
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ Use `solidactions <command> --help` for full flag details on any command.
|
|
|
115
115
|
|
|
116
116
|
| Command | Key Flags | Description |
|
|
117
117
|
|---------|-----------|-------------|
|
|
118
|
-
| `env set <key> <value
|
|
118
|
+
| `env set <key> <value> --global` | `-s`, `-y`, `--staging-value`, `--dev-value`, `--global` | Set global variable (warns before overwriting) |
|
|
119
119
|
| `env set <project> <key> <value>` | `-e`, `-s`, `-y` | Set project variable (warns before overwriting) |
|
|
120
120
|
| `env list [project]` | `-e` | List variables |
|
|
121
121
|
| `env delete <key-or-project> [key]` | `-y` | Delete a variable |
|
package/dist/commands/env-map.js
CHANGED
|
@@ -25,7 +25,7 @@ async function envMap(projectName, projectKey, globalKey, options = {}) {
|
|
|
25
25
|
const globalVar = variables.find((v) => v.key === globalKey);
|
|
26
26
|
if (!globalVar) {
|
|
27
27
|
console.error(chalk_1.default.red(`Global variable "${globalKey}" not found.`));
|
|
28
|
-
console.log(chalk_1.default.gray('Create it with: solidactions env set ' + globalKey + ' <value>'));
|
|
28
|
+
console.log(chalk_1.default.gray('Create it with: solidactions env set ' + globalKey + ' <value> --global'));
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
// Check if project key already has a mapping
|
package/dist/commands/env-set.js
CHANGED
|
@@ -17,15 +17,33 @@ function isNonTty() {
|
|
|
17
17
|
}
|
|
18
18
|
/** Printed before a 2-arg (global-scope) write — Jordan's runs 3-7 footgun. */
|
|
19
19
|
exports.GLOBAL_ENV_SCOPE_NOTE = [
|
|
20
|
-
'Note:
|
|
20
|
+
'Note: --global specified — creating a GLOBAL variable.',
|
|
21
21
|
" Global variables are NOT visible to a project's plain `env:` YAML declarations",
|
|
22
22
|
' unless you map them (`solidactions env map …`).',
|
|
23
23
|
' For a project variable, use: solidactions env set <project> KEY value',
|
|
24
24
|
].join('\n');
|
|
25
25
|
async function envSet(keyOrProject, valueOrKey, valueIfProject, options = {}) {
|
|
26
|
-
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
27
26
|
// Detect mode based on arguments
|
|
28
27
|
const isProjectMode = valueIfProject !== undefined;
|
|
28
|
+
// Jordan Wall #4 (Sweep C, → 1.23.0): a 2-positional-arg call used to fall
|
|
29
|
+
// through to GLOBAL scope silently, so a typo'd `env set KEY VALUE` (meant
|
|
30
|
+
// for a project) wrote a global var the workflow never reads. Global
|
|
31
|
+
// writes now require an explicit --global. Runs before any
|
|
32
|
+
// config/network work so a plain argument mistake never needs a login.
|
|
33
|
+
if (!isProjectMode && !options.global) {
|
|
34
|
+
process.stderr.write(chalk_1.default.red('env set needs either a project or --global — pick one:\n' +
|
|
35
|
+
' solidactions env set KEY VALUE --global (global variable)\n' +
|
|
36
|
+
' solidactions env set <project> KEY VALUE (project variable)\n'));
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
// --global never takes a project positional — reject the ambiguous combo too.
|
|
40
|
+
if (isProjectMode && options.global) {
|
|
41
|
+
process.stderr.write(chalk_1.default.red('env set: --global does not take a project argument — pick one:\n' +
|
|
42
|
+
' solidactions env set KEY VALUE --global (global variable)\n' +
|
|
43
|
+
' solidactions env set <project> KEY VALUE (project variable)\n'));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
29
47
|
if (isProjectMode) {
|
|
30
48
|
// Project mode: solidactions env set <project> <key> <value>
|
|
31
49
|
const projectName = keyOrProject;
|
package/dist/index.js
CHANGED
|
@@ -244,6 +244,7 @@ env
|
|
|
244
244
|
.argument('[value]', 'Variable value (when first arg is project)')
|
|
245
245
|
.option('-s, --secret', 'Mark as encrypted secret')
|
|
246
246
|
.option('-e, --env <environment>', 'Target environment (production/staging/dev)', 'dev')
|
|
247
|
+
.option('--global', 'Set a global variable (no project) — required for the 2-arg form')
|
|
247
248
|
.option('--staging-value <value>', 'Staging environment value (global only)')
|
|
248
249
|
.option('--dev-value <value>', 'Dev environment value (global only)')
|
|
249
250
|
.option('--staging-inherit', 'Staging inherits from production (global only)')
|