@trayai/tray-sync-cli 0.0.6 → 0.0.8
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 +20 -6
- package/dist/commands/env.js +15 -8
- package/dist/commands/promote.js +1 -1
- package/dist/views/env/env.v2.js +115 -0
- package/dist/views/icons.js +6 -0
- package/dist/views/promote/promote.v2.js +46 -0
- package/node_modules/@colors/colors/LICENSE +26 -0
- package/node_modules/@colors/colors/README.md +219 -0
- package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
- package/node_modules/@colors/colors/examples/safe-string.js +80 -0
- package/node_modules/@colors/colors/index.d.ts +136 -0
- package/node_modules/@colors/colors/lib/colors.js +211 -0
- package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
- package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
- package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
- package/node_modules/@colors/colors/lib/index.js +13 -0
- package/node_modules/@colors/colors/lib/maps/america.js +10 -0
- package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
- package/node_modules/@colors/colors/lib/maps/random.js +11 -0
- package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
- package/node_modules/@colors/colors/lib/styles.js +95 -0
- package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
- package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
- package/node_modules/@colors/colors/package.json +45 -0
- package/node_modules/@colors/colors/safe.d.ts +48 -0
- package/node_modules/@colors/colors/safe.js +10 -0
- package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
- package/node_modules/ansi-regex/index.d.ts +33 -0
- package/node_modules/ansi-regex/index.js +14 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +61 -0
- package/node_modules/ansi-regex/readme.md +66 -0
- package/node_modules/ansis/LICENSE +15 -0
- package/node_modules/ansis/README.md +5 -0
- package/node_modules/ansis/index.cjs +1 -0
- package/node_modules/ansis/index.d.ts +1 -0
- package/node_modules/ansis/index.mjs +1 -0
- package/node_modules/ansis/package.json +19 -0
- package/node_modules/cli-table3/LICENSE +21 -0
- package/node_modules/cli-table3/README.md +236 -0
- package/node_modules/cli-table3/index.d.ts +96 -0
- package/node_modules/cli-table3/index.js +1 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/license +9 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/cli-table3/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/cli-table3/node_modules/string-width/index.js +47 -0
- package/node_modules/cli-table3/node_modules/string-width/license +9 -0
- package/node_modules/cli-table3/node_modules/string-width/package.json +56 -0
- package/node_modules/cli-table3/node_modules/string-width/readme.md +50 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/license +9 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/cli-table3/package.json +100 -0
- package/node_modules/cli-table3/src/cell.js +409 -0
- package/node_modules/cli-table3/src/debug.js +28 -0
- package/node_modules/cli-table3/src/layout-manager.js +254 -0
- package/node_modules/cli-table3/src/table.js +106 -0
- package/node_modules/cli-table3/src/utils.js +344 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/get-east-asian-width/index.d.ts +60 -0
- package/node_modules/get-east-asian-width/index.js +30 -0
- package/node_modules/get-east-asian-width/license +9 -0
- package/node_modules/get-east-asian-width/lookup-data.js +21 -0
- package/node_modules/get-east-asian-width/lookup.js +138 -0
- package/node_modules/get-east-asian-width/package.json +71 -0
- package/node_modules/get-east-asian-width/readme.md +65 -0
- package/node_modules/get-east-asian-width/utilities.js +24 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/string-width/index.js +207 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +65 -0
- package/node_modules/string-width/readme.md +66 -0
- package/node_modules/strip-ansi/index.d.ts +15 -0
- package/node_modules/strip-ansi/index.js +19 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +59 -0
- package/node_modules/strip-ansi/readme.md +37 -0
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -11,12 +11,26 @@ CLI tool to clone tray projects and related assets on local machine which then c
|
|
|
11
11
|
npm install -g @trayai/tray-sync-cli
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
tray
|
|
19
|
-
|
|
14
|
+
## CLI Commands
|
|
15
|
+
|
|
16
|
+
| Command | Description |
|
|
17
|
+
|---------|-------------|
|
|
18
|
+
| `tray init -r <region> -w <workspace-id>` | Scaffold a new tray-sync-cli repository |
|
|
19
|
+
| `tray pull` | Export tracked projects from Tray and materialise them on disk |
|
|
20
|
+
| `tray promote <env>` | Reconstruct local projects and import them into a target Tray environment |
|
|
21
|
+
| `tray status` | Local checksum-based drift detection (zero API calls) |
|
|
22
|
+
| `tray project add <project-id>` | Track a project (project scope only) |
|
|
23
|
+
| `tray project remove <project-id>` | Untrack a project and delete its local directory (project scope only) |
|
|
24
|
+
| `tray project list` | List managed projects with directory names and last-pulled timestamps |
|
|
25
|
+
| `tray env add <name>` | Add a target environment |
|
|
26
|
+
| `tray env list` | List source and target environments with connectivity status |
|
|
27
|
+
| `tray env remove <name>` | Remove a target environment and its per-project mappings |
|
|
28
|
+
| `tray env resolve <env-name>` | Report unresolved auth requirements for a target env, with candidate matches |
|
|
29
|
+
| `tray auth set -w <workspace-id> -r <region> -t <token>` | Set (or overwrite) a workspace's token |
|
|
30
|
+
| `tray auth remove -w <workspace-id>` | Remove a workspace's stored token |
|
|
31
|
+
| `tray auth list` | List workspaces with stored credentials |
|
|
32
|
+
| `tray --version` | Print the installed CLI version |
|
|
33
|
+
| `tray --help` | Show help for the CLI or a specific command |
|
|
20
34
|
|
|
21
35
|
## Getting started: a first promotion, end to end
|
|
22
36
|
|
package/dist/commands/env.js
CHANGED
|
@@ -18,9 +18,10 @@ import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
|
|
|
18
18
|
import { listWorkspaceAuthentications, matchAuthCandidates, prioritizeAuths, } from "../lib/authDiscovery.js";
|
|
19
19
|
import { isFullyResolved, resolveProjectRequirements, } from "../lib/promoteTarget.js";
|
|
20
20
|
import { checkProjectDrift, DriftStatuses } from "./status.js";
|
|
21
|
-
import { printAddedEnvironment, printConnectivityCheck, printEnvAlreadyExists, printEnvNotConfigured, printEnvResolveProject, printEnvResolveProjectFullyResolved, printInvalidEnvName, printNoTargetEnvironments, printNoTokenSkippingConnectivity, printRemovedCredentials, printRemovedEnvironment, printEnvResolveProjectError, printRemovedMapping,
|
|
21
|
+
import { printAddedEnvironment, printConnectivityCheck, printEnvAlreadyExists, printEnvNotConfigured, printEnvResolveProject, printEnvResolveProjectFullyResolved, printInvalidEnvName, printNoTargetEnvironments, printNoTokenSkippingConnectivity, printRemovedCredentials, printRemovedEnvironment, printEnvResolveProjectError, printRemovedMapping, printSourceEnvTable, printTargetEnvHeader, printTargetEnvTable, printTokenNotSaved, printTrayYamlNotFound, } from "../views/env/env.v2.js";
|
|
22
22
|
import { printEnvListJson, printEnvResolveResultJson, } from "../views/env/shared.js";
|
|
23
|
-
import { printError, printInvalidAuthMappings, printLocalDrift, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printTargetEnvNotFound, } from "../views/promote/promote.js";
|
|
23
|
+
import { printError, printInvalidAuthMappings, printLocalDrift, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printTargetEnvNotFound, } from "../views/promote/promote.v2.js";
|
|
24
|
+
import { FAILURE_ICON, SUCCESS_ICON } from "../views/icons.js";
|
|
24
25
|
const ENV_NAME_RE = /^[a-zA-Z0-9_-]+$/;
|
|
25
26
|
function emptyMapping() {
|
|
26
27
|
return { authentications: {}, config: {}, connectors: [], services: [] };
|
|
@@ -46,11 +47,11 @@ async function checkConnectivity(deps, region, workspaceId, tokenFlag) {
|
|
|
46
47
|
function describeConnectivity(result) {
|
|
47
48
|
switch (result.status) {
|
|
48
49
|
case "ok":
|
|
49
|
-
return
|
|
50
|
+
return `${SUCCESS_ICON} connected`;
|
|
50
51
|
case "no-token":
|
|
51
|
-
return
|
|
52
|
+
return `${FAILURE_ICON} no token available`;
|
|
52
53
|
case "failed":
|
|
53
|
-
return
|
|
54
|
+
return `${FAILURE_ICON} ${result.message}`;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
export async function runEnvAdd(deps, options) {
|
|
@@ -128,19 +129,25 @@ export async function runEnvList(deps, options) {
|
|
|
128
129
|
});
|
|
129
130
|
return 0;
|
|
130
131
|
}
|
|
131
|
-
printSourceEnvHeader(stdout);
|
|
132
132
|
const sourceResult = await checkConnectivity(deps, trayYaml.region, trayYaml.workspace_id);
|
|
133
|
-
|
|
133
|
+
printSourceEnvTable(stdout, describeRegion(trayYaml.region), trayYaml.workspace_id, describeConnectivity(sourceResult));
|
|
134
134
|
printTargetEnvHeader(stdout);
|
|
135
135
|
if (names.length === 0) {
|
|
136
136
|
printNoTargetEnvironments(stdout);
|
|
137
137
|
return 0;
|
|
138
138
|
}
|
|
139
|
+
const targetRows = [];
|
|
139
140
|
for (const name of names) {
|
|
140
141
|
const entry = environments.environments[name];
|
|
141
142
|
const result = await checkConnectivity(deps, entry.region, entry.workspace_id);
|
|
142
|
-
|
|
143
|
+
targetRows.push({
|
|
144
|
+
name,
|
|
145
|
+
regionDescription: describeRegion(entry.region),
|
|
146
|
+
workspaceId: entry.workspace_id,
|
|
147
|
+
connectivityDescription: describeConnectivity(result),
|
|
148
|
+
});
|
|
143
149
|
}
|
|
150
|
+
printTargetEnvTable(stdout, targetRows);
|
|
144
151
|
return 0;
|
|
145
152
|
}
|
|
146
153
|
export async function runEnvRemove(deps, options) {
|
package/dist/commands/promote.js
CHANGED
|
@@ -18,7 +18,7 @@ import { resolveToken } from "../lib/tokenResolution.js";
|
|
|
18
18
|
import { isUuid } from "../lib/uuid.js";
|
|
19
19
|
import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
|
|
20
20
|
import { checkProjectDrift, DriftStatuses } from "./status.js";
|
|
21
|
-
import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, } from "../views/promote/promote.js";
|
|
21
|
+
import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, } from "../views/promote/promote.v2.js";
|
|
22
22
|
import { printPromoteResultJson } from "../views/promote/shared.js";
|
|
23
23
|
function findProjectDir(existingDirs, projectId) {
|
|
24
24
|
return existingDirs.find((name) => name.split("--")[0] === projectId);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import ansis from "ansis";
|
|
2
|
+
import Table from "cli-table3";
|
|
3
|
+
import { FAILURE_ICON, INFO_ICON, WARNING_ICON } from "../icons.js";
|
|
4
|
+
export function printInvalidEnvName(stderr, nameRe, name) {
|
|
5
|
+
stderr(`${FAILURE_ICON} Environment name must match ${nameRe}: "${name}"`);
|
|
6
|
+
}
|
|
7
|
+
export function printEnvAlreadyExists(stderr, name) {
|
|
8
|
+
stderr(`${FAILURE_ICON} Environment "${ansis.bold(name)}" already exists. Run \`${ansis.bold("tray env remove")}\` first to replace it.`);
|
|
9
|
+
}
|
|
10
|
+
export function printAddedEnvironment(stdout, name, regionDescription, workspaceId) {
|
|
11
|
+
const table = new Table({
|
|
12
|
+
head: ["Environment", "Region", "Workspace ID"].map((h) => ansis.bold(h)),
|
|
13
|
+
style: { head: [] },
|
|
14
|
+
});
|
|
15
|
+
table.push([ansis.bold(name), regionDescription, workspaceId]);
|
|
16
|
+
stdout(table.toString());
|
|
17
|
+
}
|
|
18
|
+
export function printTokenNotSaved(stderr, workspaceId) {
|
|
19
|
+
stderr(`${WARNING_ICON} ${ansis.bold("--token")} was NOT saved: credentials.json already has a token for workspace ${workspaceId}, and the existing one was kept.\n` +
|
|
20
|
+
` Re-run this same \`${ansis.bold("tray env add")}\` command with ${ansis.bold("--force-token")} to replace it with the ${ansis.bold("--token")} you just provided.`);
|
|
21
|
+
}
|
|
22
|
+
export function printNoTokenSkippingConnectivity(stdout) {
|
|
23
|
+
stdout(`${WARNING_ICON} No token available — skipping connectivity check.`);
|
|
24
|
+
}
|
|
25
|
+
const LEADING_STATUS_MARKER_RE = /^((?:\x1b\[[0-9;]*m)*[✓✗](?:\x1b\[[0-9;]*m)*)\s*/;
|
|
26
|
+
export function printConnectivityCheck(stdout, description) {
|
|
27
|
+
const match = description.match(LEADING_STATUS_MARKER_RE);
|
|
28
|
+
if (match) {
|
|
29
|
+
stdout(`${match[1]} Connectivity check: ${description.slice(match[0].length)}`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
stdout(`Connectivity check: ${description}`);
|
|
33
|
+
}
|
|
34
|
+
export function printTrayYamlNotFound(stderr) {
|
|
35
|
+
stderr(`${FAILURE_ICON} tray.yaml not found. Run \`${ansis.bold("tray init")}\` first.`);
|
|
36
|
+
}
|
|
37
|
+
function envTable() {
|
|
38
|
+
return new Table({
|
|
39
|
+
head: ["Environment", "Region", "Workspace ID", "Status"].map((h) => ansis.bold(h)),
|
|
40
|
+
style: { head: [] },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export function printSourceEnvTable(stdout, regionDescription, workspaceId, connectivityDescription) {
|
|
44
|
+
stdout(ansis.bold("SOURCE ENV"));
|
|
45
|
+
const table = envTable();
|
|
46
|
+
table.push([ansis.bold("source"), regionDescription, workspaceId, connectivityDescription]);
|
|
47
|
+
stdout(table.toString());
|
|
48
|
+
}
|
|
49
|
+
export function printTargetEnvHeader(stdout) {
|
|
50
|
+
stdout("");
|
|
51
|
+
stdout(ansis.bold("TARGET ENV"));
|
|
52
|
+
}
|
|
53
|
+
export function printNoTargetEnvironments(stdout) {
|
|
54
|
+
stdout(`${INFO_ICON} No target environments configured.`);
|
|
55
|
+
}
|
|
56
|
+
export function printTargetEnvTable(stdout, rows) {
|
|
57
|
+
const table = envTable();
|
|
58
|
+
for (const row of rows) {
|
|
59
|
+
table.push([ansis.bold(row.name), row.regionDescription, row.workspaceId, row.connectivityDescription]);
|
|
60
|
+
}
|
|
61
|
+
stdout(table.toString());
|
|
62
|
+
}
|
|
63
|
+
export function printEnvNotConfigured(stdout, name) {
|
|
64
|
+
stdout(`${INFO_ICON} Environment "${ansis.bold(name)}" is not configured. Nothing to remove.`);
|
|
65
|
+
}
|
|
66
|
+
export function printRemovedEnvironment(stdout, name) {
|
|
67
|
+
stdout(`${ansis.bold("Removed")} environment "${ansis.bold(name)}" from environments.json.`);
|
|
68
|
+
}
|
|
69
|
+
export function printRemovedMapping(stdout, name, dirName) {
|
|
70
|
+
stdout(`${ansis.bold("Removed")} "${ansis.bold(name)}" mapping from ${dirName}/mappings.json.`);
|
|
71
|
+
}
|
|
72
|
+
export function printRemovedCredentials(stdout, workspaceId) {
|
|
73
|
+
stdout(`${ansis.bold("Removed")} credentials for workspace ${workspaceId}.`);
|
|
74
|
+
}
|
|
75
|
+
export function printEnvResolveProjectFullyResolved(stdout, projectId, sourceProjectName) {
|
|
76
|
+
stdout(`${ansis.bold(`${sourceProjectName} (${projectId})`)}: fully resolved, nothing to do`);
|
|
77
|
+
}
|
|
78
|
+
export function printEnvResolveProjectError(stdout, projectId, sourceProjectName, error) {
|
|
79
|
+
stdout(`${ansis.bold(`${sourceProjectName} (${projectId})`)}:`);
|
|
80
|
+
if (error.reason === "no_target_project_mapped") {
|
|
81
|
+
stdout(` no target project mapped yet — see ${error.mappingsPath}`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (error.reason === "project_error") {
|
|
85
|
+
const target = error.targetProjectId ? ` (target project ${error.targetProjectId})` : "";
|
|
86
|
+
stdout(` ${error.message}${target}`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
stdout(` invalid authentication mappings:`);
|
|
90
|
+
for (const invalid of error.invalidAuthMappings) {
|
|
91
|
+
stdout(` ${invalid.authExportId}: "${invalid.value}" is not a valid target authentication id`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function printEnvResolveProject(stdout, project) {
|
|
95
|
+
stdout(`${ansis.bold(`${project.sourceProjectName} (${project.projectId})`)}:`);
|
|
96
|
+
for (const auth of project.autoResolvedAuthentications) {
|
|
97
|
+
stdout(` auto-resolved: ${auth.title} -> "${auth.chosen.name}" (id: ${auth.chosen.id}, ${auth.chosen.matchKind} match), written to mappings.json`);
|
|
98
|
+
}
|
|
99
|
+
for (const auth of project.unresolvedAuthentications) {
|
|
100
|
+
stdout(` unresolved: ${auth.title} (${auth.service.name} v${auth.service.version})`);
|
|
101
|
+
if (auth.candidates.length === 0) {
|
|
102
|
+
stdout(` no candidates found in the target workspace`);
|
|
103
|
+
}
|
|
104
|
+
for (const candidate of auth.candidates) {
|
|
105
|
+
stdout(` candidate (${candidate.matchKind}): "${candidate.name}" (id: ${candidate.id}, created ${candidate.created})`);
|
|
106
|
+
}
|
|
107
|
+
stdout(` to resolve: set mappings.json's environments.<env>.authentications["${auth.authExportId}"] to a target auth id${auth.candidates.length > 0
|
|
108
|
+
? `, or re-run with ${ansis.bold("--auto-resolve")} to pick the top candidate automatically`
|
|
109
|
+
: ""}`);
|
|
110
|
+
}
|
|
111
|
+
if (project.hasNewConfigKeys) {
|
|
112
|
+
stdout(` new config keys require mapping — see mappings.json's config entry`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=env.v2.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import ansis from "ansis";
|
|
2
|
+
export const SUCCESS_ICON = ansis.bold.green("✓");
|
|
3
|
+
export const FAILURE_ICON = ansis.bold.red("✗");
|
|
4
|
+
export const WARNING_ICON = ansis.bold.hex("#D98C2B")("(!)");
|
|
5
|
+
export const INFO_ICON = ansis.bold.hex("#5C7A99")("(i)");
|
|
6
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import ansis from "ansis";
|
|
2
|
+
import { FAILURE_ICON } from "../icons.js";
|
|
3
|
+
import { printIssueBlock } from "../shared.js";
|
|
4
|
+
export function printMutuallyExclusiveResumeAndProject(stderr) {
|
|
5
|
+
stderr("--resume and --project are mutually exclusive.");
|
|
6
|
+
}
|
|
7
|
+
export function printTrayYamlNotFound(stderr) {
|
|
8
|
+
stderr("tray.yaml not found. Run `tray init` first.");
|
|
9
|
+
}
|
|
10
|
+
export function printTargetEnvNotFound(stderr, envName) {
|
|
11
|
+
stderr(`${FAILURE_ICON} Target environment "${ansis.bold(envName)}" not found. Run \`${ansis.bold(`tray env add ${envName} ...`)}\` first.`);
|
|
12
|
+
}
|
|
13
|
+
export function printError(stderr, message) {
|
|
14
|
+
stderr(message);
|
|
15
|
+
}
|
|
16
|
+
export function printProjectNotPulledLocally(stderr, projectId) {
|
|
17
|
+
stderr(`Project ${projectId} has not been pulled locally. Run \`tray pull\` first.`);
|
|
18
|
+
}
|
|
19
|
+
export function printProjectNoStateFile(stderr, projectId) {
|
|
20
|
+
stderr(`Project ${projectId} has no state.json. Run \`tray pull\` first.`);
|
|
21
|
+
}
|
|
22
|
+
export function printLocalDrift(stderr, projectId, dirName, dirty) {
|
|
23
|
+
printIssueBlock(stderr, `Project ${projectId} (${dirName}) has local drift; refusing to promote:`, dirty.map((d) => `${d.status}\t${d.path}`), "Run `tray pull` to refresh, or resolve the drift, then retry.");
|
|
24
|
+
}
|
|
25
|
+
export function printNoTargetProjectMapped(stderr, sourceProjectName, projectId, envName, mappingsPath) {
|
|
26
|
+
stderr(`"${sourceProjectName}" (${projectId}) has no target project mapped for "${envName}".`);
|
|
27
|
+
stderr(`Fill in target_project_id in ${mappingsPath}, or re-run with --auto-create-projects.`);
|
|
28
|
+
}
|
|
29
|
+
export function printInvalidAuthMappings(stderr, projectId, sourceProjectName, invalidAuthMappings) {
|
|
30
|
+
printIssueBlock(stderr, `Project ${projectId} (${sourceProjectName}) has unresolved authentication mappings:`, invalidAuthMappings.map((invalid) => `${invalid.authExportId}: "${invalid.value}" is not a valid target authentication id`), "Fill in a real target authentication id for each entry above, then retry.");
|
|
31
|
+
}
|
|
32
|
+
export function printUnresolvedRequirements(stderr, projectId, sourceProjectName, envName, unresolved) {
|
|
33
|
+
const bulletLines = unresolved.unresolvedAuthentications.map((auth) => `unresolved authentication: ${auth.title} (${auth.authExportId})`);
|
|
34
|
+
if (unresolved.hasNewConfigKeys) {
|
|
35
|
+
bulletLines.push("new config keys require mapping");
|
|
36
|
+
}
|
|
37
|
+
printIssueBlock(stderr, `Project ${projectId} (${sourceProjectName}) has unresolved import requirements:`, bulletLines, `Run \`tray env resolve ${envName}\` to resolve, then retry.`);
|
|
38
|
+
}
|
|
39
|
+
export function printPromoted(stdout, projectId, sourceProjectName, envName) {
|
|
40
|
+
stdout(`Promoted project ${projectId} (${sourceProjectName}) to "${envName}"`);
|
|
41
|
+
}
|
|
42
|
+
export function printProjectError(stderr, projectId, sourceProjectName, message, targetProjectId) {
|
|
43
|
+
const target = targetProjectId ? ` -> target project ${targetProjectId}` : "";
|
|
44
|
+
stderr(`Project ${projectId} (${sourceProjectName})${target}: ${message}`);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=promote.v2.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Original Library
|
|
4
|
+
- Copyright (c) Marak Squires
|
|
5
|
+
|
|
6
|
+
Additional Functionality
|
|
7
|
+
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
8
|
+
- Copyright (c) DABH (https://github.com/DABH)
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# @colors/colors ("colors.js")
|
|
2
|
+
[](https://github.com/DABH/colors.js/actions/workflows/ci.yml)
|
|
3
|
+
[](https://www.npmjs.org/package/@colors/colors)
|
|
4
|
+
|
|
5
|
+
Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback.
|
|
6
|
+
|
|
7
|
+
## get color and style in your node.js console
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
npm install @colors/colors
|
|
14
|
+
|
|
15
|
+
## colors and styles!
|
|
16
|
+
|
|
17
|
+
### text colors
|
|
18
|
+
|
|
19
|
+
- black
|
|
20
|
+
- red
|
|
21
|
+
- green
|
|
22
|
+
- yellow
|
|
23
|
+
- blue
|
|
24
|
+
- magenta
|
|
25
|
+
- cyan
|
|
26
|
+
- white
|
|
27
|
+
- gray
|
|
28
|
+
- grey
|
|
29
|
+
|
|
30
|
+
### bright text colors
|
|
31
|
+
|
|
32
|
+
- brightRed
|
|
33
|
+
- brightGreen
|
|
34
|
+
- brightYellow
|
|
35
|
+
- brightBlue
|
|
36
|
+
- brightMagenta
|
|
37
|
+
- brightCyan
|
|
38
|
+
- brightWhite
|
|
39
|
+
|
|
40
|
+
### background colors
|
|
41
|
+
|
|
42
|
+
- bgBlack
|
|
43
|
+
- bgRed
|
|
44
|
+
- bgGreen
|
|
45
|
+
- bgYellow
|
|
46
|
+
- bgBlue
|
|
47
|
+
- bgMagenta
|
|
48
|
+
- bgCyan
|
|
49
|
+
- bgWhite
|
|
50
|
+
- bgGray
|
|
51
|
+
- bgGrey
|
|
52
|
+
|
|
53
|
+
### bright background colors
|
|
54
|
+
|
|
55
|
+
- bgBrightRed
|
|
56
|
+
- bgBrightGreen
|
|
57
|
+
- bgBrightYellow
|
|
58
|
+
- bgBrightBlue
|
|
59
|
+
- bgBrightMagenta
|
|
60
|
+
- bgBrightCyan
|
|
61
|
+
- bgBrightWhite
|
|
62
|
+
|
|
63
|
+
### styles
|
|
64
|
+
|
|
65
|
+
- reset
|
|
66
|
+
- bold
|
|
67
|
+
- dim
|
|
68
|
+
- italic
|
|
69
|
+
- underline
|
|
70
|
+
- inverse
|
|
71
|
+
- hidden
|
|
72
|
+
- strikethrough
|
|
73
|
+
|
|
74
|
+
### extras
|
|
75
|
+
|
|
76
|
+
- rainbow
|
|
77
|
+
- zebra
|
|
78
|
+
- america
|
|
79
|
+
- trap
|
|
80
|
+
- random
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
By popular demand, `@colors/colors` now ships with two types of usages!
|
|
86
|
+
|
|
87
|
+
The super nifty way
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
var colors = require('@colors/colors');
|
|
91
|
+
|
|
92
|
+
console.log('hello'.green); // outputs green text
|
|
93
|
+
console.log('i like cake and pies'.underline.red); // outputs red underlined text
|
|
94
|
+
console.log('inverse the color'.inverse); // inverses the color
|
|
95
|
+
console.log('OMG Rainbows!'.rainbow); // rainbow
|
|
96
|
+
console.log('Run the trap'.trap); // Drops the bass
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
or a slightly less nifty way which doesn't extend `String.prototype`
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
var colors = require('@colors/colors/safe');
|
|
104
|
+
|
|
105
|
+
console.log(colors.green('hello')); // outputs green text
|
|
106
|
+
console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
|
|
107
|
+
console.log(colors.inverse('inverse the color')); // inverses the color
|
|
108
|
+
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
|
109
|
+
console.log(colors.trap('Run the trap')); // Drops the bass
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
|
114
|
+
|
|
115
|
+
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
|
116
|
+
|
|
117
|
+
## Enabling/Disabling Colors
|
|
118
|
+
|
|
119
|
+
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
node myapp.js --no-color
|
|
123
|
+
node myapp.js --color=false
|
|
124
|
+
|
|
125
|
+
node myapp.js --color
|
|
126
|
+
node myapp.js --color=true
|
|
127
|
+
node myapp.js --color=always
|
|
128
|
+
|
|
129
|
+
FORCE_COLOR=1 node myapp.js
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Or in code:
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
var colors = require('@colors/colors');
|
|
136
|
+
colors.enable();
|
|
137
|
+
colors.disable();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
var name = 'Beowulf';
|
|
144
|
+
console.log(colors.green('Hello %s'), name);
|
|
145
|
+
// outputs -> 'Hello Beowulf'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Custom themes
|
|
149
|
+
|
|
150
|
+
### Using standard API
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
|
|
154
|
+
var colors = require('@colors/colors');
|
|
155
|
+
|
|
156
|
+
colors.setTheme({
|
|
157
|
+
silly: 'rainbow',
|
|
158
|
+
input: 'grey',
|
|
159
|
+
verbose: 'cyan',
|
|
160
|
+
prompt: 'grey',
|
|
161
|
+
info: 'green',
|
|
162
|
+
data: 'grey',
|
|
163
|
+
help: 'cyan',
|
|
164
|
+
warn: 'yellow',
|
|
165
|
+
debug: 'blue',
|
|
166
|
+
error: 'red'
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// outputs red text
|
|
170
|
+
console.log("this is an error".error);
|
|
171
|
+
|
|
172
|
+
// outputs yellow text
|
|
173
|
+
console.log("this is a warning".warn);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Using string safe API
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
var colors = require('@colors/colors/safe');
|
|
180
|
+
|
|
181
|
+
// set single property
|
|
182
|
+
var error = colors.red;
|
|
183
|
+
error('this is red');
|
|
184
|
+
|
|
185
|
+
// set theme
|
|
186
|
+
colors.setTheme({
|
|
187
|
+
silly: 'rainbow',
|
|
188
|
+
input: 'grey',
|
|
189
|
+
verbose: 'cyan',
|
|
190
|
+
prompt: 'grey',
|
|
191
|
+
info: 'green',
|
|
192
|
+
data: 'grey',
|
|
193
|
+
help: 'cyan',
|
|
194
|
+
warn: 'yellow',
|
|
195
|
+
debug: 'blue',
|
|
196
|
+
error: 'red'
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// outputs red text
|
|
200
|
+
console.log(colors.error("this is an error"));
|
|
201
|
+
|
|
202
|
+
// outputs yellow text
|
|
203
|
+
console.log(colors.warn("this is a warning"));
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Combining Colors
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
var colors = require('@colors/colors');
|
|
211
|
+
|
|
212
|
+
colors.setTheme({
|
|
213
|
+
custom: ['red', 'underline']
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
console.log('test'.custom);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var colors = require('../lib/index');
|
|
2
|
+
|
|
3
|
+
console.log('First some yellow text'.yellow);
|
|
4
|
+
|
|
5
|
+
console.log('Underline that text'.yellow.underline);
|
|
6
|
+
|
|
7
|
+
console.log('Make it bold and red'.red.bold);
|
|
8
|
+
|
|
9
|
+
console.log(('Double Raindows All Day Long').rainbow);
|
|
10
|
+
|
|
11
|
+
console.log('Drop the bass'.trap);
|
|
12
|
+
|
|
13
|
+
console.log('DROP THE RAINBOW BASS'.trap.rainbow);
|
|
14
|
+
|
|
15
|
+
// styles not widely supported
|
|
16
|
+
console.log('Chains are also cool.'.bold.italic.underline.red);
|
|
17
|
+
|
|
18
|
+
// styles not widely supported
|
|
19
|
+
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse
|
|
20
|
+
+ ' styles! '.yellow.bold);
|
|
21
|
+
console.log('Zebras are so fun!'.zebra);
|
|
22
|
+
|
|
23
|
+
//
|
|
24
|
+
// Remark: .strikethrough may not work with Mac OS Terminal App
|
|
25
|
+
//
|
|
26
|
+
console.log('This is ' + 'not'.strikethrough + ' fun.');
|
|
27
|
+
|
|
28
|
+
console.log('Background color attack!'.black.bgWhite);
|
|
29
|
+
console.log('Use random styles on everything!'.random);
|
|
30
|
+
console.log('America, Heck Yeah!'.america);
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line max-len
|
|
33
|
+
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
|
|
34
|
+
|
|
35
|
+
console.log('Setting themes is useful');
|
|
36
|
+
|
|
37
|
+
//
|
|
38
|
+
// Custom themes
|
|
39
|
+
//
|
|
40
|
+
console.log('Generic logging theme as JSON'.green.bold.underline);
|
|
41
|
+
// Load theme with JSON literal
|
|
42
|
+
colors.setTheme({
|
|
43
|
+
silly: 'rainbow',
|
|
44
|
+
input: 'grey',
|
|
45
|
+
verbose: 'cyan',
|
|
46
|
+
prompt: 'grey',
|
|
47
|
+
info: 'green',
|
|
48
|
+
data: 'grey',
|
|
49
|
+
help: 'cyan',
|
|
50
|
+
warn: 'yellow',
|
|
51
|
+
debug: 'blue',
|
|
52
|
+
error: 'red',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// outputs red text
|
|
56
|
+
console.log('this is an error'.error);
|
|
57
|
+
|
|
58
|
+
// outputs yellow text
|
|
59
|
+
console.log('this is a warning'.warn);
|
|
60
|
+
|
|
61
|
+
// outputs grey text
|
|
62
|
+
console.log('this is an input'.input);
|
|
63
|
+
|
|
64
|
+
console.log('Generic logging theme as file'.green.bold.underline);
|
|
65
|
+
|
|
66
|
+
// Load a theme from file
|
|
67
|
+
try {
|
|
68
|
+
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.log(err);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// outputs red text
|
|
74
|
+
console.log('this is an error'.error);
|
|
75
|
+
|
|
76
|
+
// outputs yellow text
|
|
77
|
+
console.log('this is a warning'.warn);
|
|
78
|
+
|
|
79
|
+
// outputs grey text
|
|
80
|
+
console.log('this is an input'.input);
|
|
81
|
+
|
|
82
|
+
// console.log("Don't summon".zalgo)
|
|
83
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var colors = require('../safe');
|
|
2
|
+
|
|
3
|
+
console.log(colors.yellow('First some yellow text'));
|
|
4
|
+
|
|
5
|
+
console.log(colors.yellow.underline('Underline that text'));
|
|
6
|
+
|
|
7
|
+
console.log(colors.red.bold('Make it bold and red'));
|
|
8
|
+
|
|
9
|
+
console.log(colors.rainbow('Double Raindows All Day Long'));
|
|
10
|
+
|
|
11
|
+
console.log(colors.trap('Drop the bass'));
|
|
12
|
+
|
|
13
|
+
console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS')));
|
|
14
|
+
|
|
15
|
+
// styles not widely supported
|
|
16
|
+
console.log(colors.bold.italic.underline.red('Chains are also cool.'));
|
|
17
|
+
|
|
18
|
+
// styles not widely supported
|
|
19
|
+
console.log(colors.green('So ') + colors.underline('are') + ' '
|
|
20
|
+
+ colors.inverse('inverse') + colors.yellow.bold(' styles! '));
|
|
21
|
+
|
|
22
|
+
console.log(colors.zebra('Zebras are so fun!'));
|
|
23
|
+
|
|
24
|
+
console.log('This is ' + colors.strikethrough('not') + ' fun.');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
console.log(colors.black.bgWhite('Background color attack!'));
|
|
28
|
+
console.log(colors.random('Use random styles on everything!'));
|
|
29
|
+
console.log(colors.america('America, Heck Yeah!'));
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line max-len
|
|
32
|
+
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
|
|
33
|
+
|
|
34
|
+
console.log('Setting themes is useful');
|
|
35
|
+
|
|
36
|
+
//
|
|
37
|
+
// Custom themes
|
|
38
|
+
//
|
|
39
|
+
// console.log('Generic logging theme as JSON'.green.bold.underline);
|
|
40
|
+
// Load theme with JSON literal
|
|
41
|
+
colors.setTheme({
|
|
42
|
+
silly: 'rainbow',
|
|
43
|
+
input: 'blue',
|
|
44
|
+
verbose: 'cyan',
|
|
45
|
+
prompt: 'grey',
|
|
46
|
+
info: 'green',
|
|
47
|
+
data: 'grey',
|
|
48
|
+
help: 'cyan',
|
|
49
|
+
warn: 'yellow',
|
|
50
|
+
debug: 'blue',
|
|
51
|
+
error: 'red',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// outputs red text
|
|
55
|
+
console.log(colors.error('this is an error'));
|
|
56
|
+
|
|
57
|
+
// outputs yellow text
|
|
58
|
+
console.log(colors.warn('this is a warning'));
|
|
59
|
+
|
|
60
|
+
// outputs blue text
|
|
61
|
+
console.log(colors.input('this is an input'));
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// console.log('Generic logging theme as file'.green.bold.underline);
|
|
65
|
+
|
|
66
|
+
// Load a theme from file
|
|
67
|
+
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
|
68
|
+
|
|
69
|
+
// outputs red text
|
|
70
|
+
console.log(colors.error('this is an error'));
|
|
71
|
+
|
|
72
|
+
// outputs yellow text
|
|
73
|
+
console.log(colors.warn('this is a warning'));
|
|
74
|
+
|
|
75
|
+
// outputs grey text
|
|
76
|
+
console.log(colors.input('this is an input'));
|
|
77
|
+
|
|
78
|
+
// console.log(colors.zalgo("Don't summon him"))
|
|
79
|
+
|
|
80
|
+
|