@sanity/runtime-cli 13.2.1 → 13.2.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 +18 -18
- package/dist/actions/blueprints/blueprint.d.ts +17 -1
- package/dist/actions/blueprints/blueprint.js +44 -12
- package/dist/actions/blueprints/logs-streaming.js +4 -4
- package/dist/actions/blueprints/resources.js +2 -2
- package/dist/cores/blueprints/config.js +2 -2
- package/dist/cores/blueprints/deploy.js +5 -5
- package/dist/cores/blueprints/destroy.js +6 -6
- package/dist/cores/blueprints/doctor.js +55 -57
- package/dist/cores/blueprints/init.js +11 -11
- package/dist/cores/blueprints/logs.js +4 -4
- package/dist/cores/blueprints/plan.js +4 -4
- package/dist/cores/blueprints/stacks.js +2 -2
- package/dist/cores/functions/add.js +8 -8
- package/dist/cores/functions/env/add.js +2 -2
- package/dist/cores/functions/env/remove.js +2 -2
- package/dist/cores/functions/logs.js +15 -15
- package/dist/server/static/api.js +22 -2
- package/dist/server/static/components/run-panel.js +3 -5
- package/dist/utils/display/blueprints-formatting.js +19 -17
- package/dist/utils/display/logs-formatting.js +3 -3
- package/dist/utils/display/presenters.js +8 -8
- package/dist/utils/display/prompt.js +5 -5
- package/dist/utils/display/resources-formatting.js +3 -3
- package/dist/utils/style-text.d.ts +2 -0
- package/dist/utils/style-text.js +44 -0
- package/dist/utils/traced-fetch.js +3 -3
- package/oclif.manifest.json +1 -1
- package/package.json +2 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import { isScheduleEvent, } from '../../utils/types.js';
|
|
2
|
+
import { styleText } from '../style-text.js';
|
|
3
3
|
function formatLabel(label) {
|
|
4
|
-
return
|
|
4
|
+
return styleText('dim', `${label}:`);
|
|
5
5
|
}
|
|
6
6
|
function formatLabeledValue(label, value) {
|
|
7
|
-
return `${
|
|
7
|
+
return `${styleText('dim', `${label}:`)} ${value}`;
|
|
8
8
|
}
|
|
9
9
|
function arrayifyEvent(event) {
|
|
10
10
|
if (!event)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { env, stdout } from 'node:process';
|
|
2
|
+
import { styleText as nodeStyleText } from 'node:util';
|
|
3
|
+
function supportsColor() {
|
|
4
|
+
/*
|
|
5
|
+
* https://force-color.org
|
|
6
|
+
* Command-line software which outputs colored text should check for a
|
|
7
|
+
* FORCE_COLOR environment variable. When this variable is present and
|
|
8
|
+
* not an empty string (regardless of its value), it should force the
|
|
9
|
+
* addition of ANSI color.
|
|
10
|
+
*
|
|
11
|
+
* But the sample implementation accounts for when FORCE_COLOR is 0:
|
|
12
|
+
* if (force_color != NULL && force_color[0] != '\0') color = true;
|
|
13
|
+
* So we check for '0' and 'false' as well.
|
|
14
|
+
*/
|
|
15
|
+
if (env.FORCE_COLOR !== undefined && env.FORCE_COLOR !== '0' && env.FORCE_COLOR !== 'false') {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
/*
|
|
19
|
+
* https://no-color.org
|
|
20
|
+
* Command-line software which adds ANSI color to its output by default
|
|
21
|
+
* should check for a NO_COLOR environment variable that, when present
|
|
22
|
+
* and not an empty string (regardless of its value), prevents the
|
|
23
|
+
* addition of ANSI color.
|
|
24
|
+
*/
|
|
25
|
+
if (env.NO_COLOR !== undefined && env.NO_COLOR !== '') {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
/*
|
|
29
|
+
* https://nodejs.org/docs/latest/api/cli.html#node_disable_colors1
|
|
30
|
+
* When set, colors will not be used in the REPL.
|
|
31
|
+
*/
|
|
32
|
+
if (env.NODE_DISABLE_COLORS !== undefined && env.NODE_DISABLE_COLORS !== '') {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
/*
|
|
36
|
+
* If the stdout is a TTY, use colors.
|
|
37
|
+
*/
|
|
38
|
+
return typeof stdout?.isTTY === 'boolean' && stdout.isTTY;
|
|
39
|
+
}
|
|
40
|
+
export const styleText = (format, text) => {
|
|
41
|
+
if (!supportsColor())
|
|
42
|
+
return String(text);
|
|
43
|
+
return nodeStyleText(format, text);
|
|
44
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { performance } from 'node:perf_hooks';
|
|
3
3
|
import { env } from 'node:process';
|
|
4
|
-
import
|
|
4
|
+
import { styleText } from './style-text.js';
|
|
5
5
|
let defaultMaxLength = env.SANITY_TRACE_MAX_LENGTH
|
|
6
6
|
? Number.parseInt(env.SANITY_TRACE_MAX_LENGTH, 10)
|
|
7
7
|
: 500;
|
|
@@ -178,8 +178,8 @@ export function createTracedFetch(logger, options) {
|
|
|
178
178
|
const method = init?.method || 'GET';
|
|
179
179
|
const startTime = performance.now();
|
|
180
180
|
function trace(type, msgTemplate, ...args) {
|
|
181
|
-
const arrow = type === 'req' ? '→' : type === 'res' ? '←' :
|
|
182
|
-
logger.trace(`${
|
|
181
|
+
const arrow = type === 'req' ? '→' : type === 'res' ? '←' : styleText('red', '✗');
|
|
182
|
+
logger.trace(`${styleText('dim', '[%s]')} HTTP ${arrow} ${msgTemplate}`, requestId, ...args);
|
|
183
183
|
}
|
|
184
184
|
// Log request URL
|
|
185
185
|
trace('req', '%s %s', method, url);
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/runtime-cli",
|
|
3
3
|
"description": "Sanity's Runtime CLI for Blueprints and Functions",
|
|
4
|
-
"version": "13.2.
|
|
4
|
+
"version": "13.2.3",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -102,12 +102,11 @@
|
|
|
102
102
|
"@oclif/core": "^4.8.0",
|
|
103
103
|
"@oclif/plugin-help": "^6.2.36",
|
|
104
104
|
"@sanity/blueprints": "^0.9.0",
|
|
105
|
-
"@sanity/blueprints-parser": "^0.
|
|
105
|
+
"@sanity/blueprints-parser": "^0.4.0",
|
|
106
106
|
"@sanity/client": "^7.14.0",
|
|
107
107
|
"adm-zip": "^0.5.16",
|
|
108
108
|
"array-treeify": "^0.1.5",
|
|
109
109
|
"cardinal": "^2.1.1",
|
|
110
|
-
"chalk": "^5.6.2",
|
|
111
110
|
"eventsource": "^4.1.0",
|
|
112
111
|
"find-up": "^8.0.0",
|
|
113
112
|
"get-folder-size": "^5.0.0",
|