@meltemi/diagrams-cli 0.0.0-stage → 1.9.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/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/assets-command.d.ts +16 -0
- package/dist/assets-command.d.ts.map +1 -0
- package/dist/assets-command.js +145 -0
- package/dist/assets-command.js.map +1 -0
- package/dist/assist-command.d.ts +19 -0
- package/dist/assist-command.d.ts.map +1 -0
- package/dist/assist-command.js +268 -0
- package/dist/assist-command.js.map +1 -0
- package/dist/auth-command.d.ts +14 -0
- package/dist/auth-command.d.ts.map +1 -0
- package/dist/auth-command.js +233 -0
- package/dist/auth-command.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +60 -0
- package/dist/bin.js.map +1 -0
- package/dist/build-command.d.ts +23 -0
- package/dist/build-command.d.ts.map +1 -0
- package/dist/build-command.js +123 -0
- package/dist/build-command.js.map +1 -0
- package/dist/cli.d.ts +46 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +823 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud-client.d.ts +246 -0
- package/dist/cloud-client.d.ts.map +1 -0
- package/dist/cloud-client.js +591 -0
- package/dist/cloud-client.js.map +1 -0
- package/dist/cloud-command.d.ts +56 -0
- package/dist/cloud-command.d.ts.map +1 -0
- package/dist/cloud-command.js +81 -0
- package/dist/cloud-command.js.map +1 -0
- package/dist/cloud-context.d.ts +106 -0
- package/dist/cloud-context.d.ts.map +1 -0
- package/dist/cloud-context.js +185 -0
- package/dist/cloud-context.js.map +1 -0
- package/dist/cloud-errors.d.ts +37 -0
- package/dist/cloud-errors.d.ts.map +1 -0
- package/dist/cloud-errors.js +46 -0
- package/dist/cloud-errors.js.map +1 -0
- package/dist/cloud-host.d.ts +72 -0
- package/dist/cloud-host.d.ts.map +1 -0
- package/dist/cloud-host.js +129 -0
- package/dist/cloud-host.js.map +1 -0
- package/dist/cloud-manifest.d.ts +12 -0
- package/dist/cloud-manifest.d.ts.map +1 -0
- package/dist/cloud-manifest.js +21 -0
- package/dist/cloud-manifest.js.map +1 -0
- package/dist/cloud-paths.d.ts +48 -0
- package/dist/cloud-paths.d.ts.map +1 -0
- package/dist/cloud-paths.js +104 -0
- package/dist/cloud-paths.js.map +1 -0
- package/dist/credentials.d.ts +107 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +243 -0
- package/dist/credentials.js.map +1 -0
- package/dist/export-command.d.ts +35 -0
- package/dist/export-command.d.ts.map +1 -0
- package/dist/export-command.js +524 -0
- package/dist/export-command.js.map +1 -0
- package/dist/import-command.d.ts +20 -0
- package/dist/import-command.d.ts.map +1 -0
- package/dist/import-command.js +254 -0
- package/dist/import-command.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/init-command.d.ts +28 -0
- package/dist/init-command.d.ts.map +1 -0
- package/dist/init-command.js +199 -0
- package/dist/init-command.js.map +1 -0
- package/dist/login-listener.d.ts +58 -0
- package/dist/login-listener.d.ts.map +1 -0
- package/dist/login-listener.js +173 -0
- package/dist/login-listener.js.map +1 -0
- package/dist/messages/en.d.ts +533 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +803 -0
- package/dist/messages/en.js.map +1 -0
- package/dist/messages/es.d.ts +3 -0
- package/dist/messages/es.d.ts.map +1 -0
- package/dist/messages/es.js +764 -0
- package/dist/messages/es.js.map +1 -0
- package/dist/messages/index.d.ts +442 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +42 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/push-pull-en.d.ts +84 -0
- package/dist/messages/push-pull-en.d.ts.map +1 -0
- package/dist/messages/push-pull-en.js +146 -0
- package/dist/messages/push-pull-en.js.map +1 -0
- package/dist/messages/push-pull-es.d.ts +7 -0
- package/dist/messages/push-pull-es.d.ts.map +1 -0
- package/dist/messages/push-pull-es.js +144 -0
- package/dist/messages/push-pull-es.js.map +1 -0
- package/dist/open-url.d.ts +11 -0
- package/dist/open-url.d.ts.map +1 -0
- package/dist/open-url.js +36 -0
- package/dist/open-url.js.map +1 -0
- package/dist/plugins-command.d.ts +15 -0
- package/dist/plugins-command.d.ts.map +1 -0
- package/dist/plugins-command.js +106 -0
- package/dist/plugins-command.js.map +1 -0
- package/dist/preview.d.ts +54 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +249 -0
- package/dist/preview.js.map +1 -0
- package/dist/project-errors.d.ts +17 -0
- package/dist/project-errors.d.ts.map +1 -0
- package/dist/project-errors.js +85 -0
- package/dist/project-errors.js.map +1 -0
- package/dist/projects-command.d.ts +13 -0
- package/dist/projects-command.d.ts.map +1 -0
- package/dist/projects-command.js +85 -0
- package/dist/projects-command.js.map +1 -0
- package/dist/publish-command.d.ts +41 -0
- package/dist/publish-command.d.ts.map +1 -0
- package/dist/publish-command.js +311 -0
- package/dist/publish-command.js.map +1 -0
- package/dist/pull-command.d.ts +21 -0
- package/dist/pull-command.d.ts.map +1 -0
- package/dist/pull-command.js +300 -0
- package/dist/pull-command.js.map +1 -0
- package/dist/push-command.d.ts +31 -0
- package/dist/push-command.d.ts.map +1 -0
- package/dist/push-command.js +391 -0
- package/dist/push-command.js.map +1 -0
- package/dist/push-review.d.ts +16 -0
- package/dist/push-review.d.ts.map +1 -0
- package/dist/push-review.js +72 -0
- package/dist/push-review.js.map +1 -0
- package/dist/push-set.d.ts +126 -0
- package/dist/push-set.d.ts.map +1 -0
- package/dist/push-set.js +289 -0
- package/dist/push-set.js.map +1 -0
- package/dist/push-validation.d.ts +20 -0
- package/dist/push-validation.d.ts.map +1 -0
- package/dist/push-validation.js +70 -0
- package/dist/push-validation.js.map +1 -0
- package/dist/redact.d.ts +9 -0
- package/dist/redact.d.ts.map +1 -0
- package/dist/redact.js +22 -0
- package/dist/redact.js.map +1 -0
- package/dist/review-command.d.ts +44 -0
- package/dist/review-command.d.ts.map +1 -0
- package/dist/review-command.js +348 -0
- package/dist/review-command.js.map +1 -0
- package/package.json +56 -3
- package/templates/c4/diagrams/views.meltemi +16 -0
- package/templates/c4/models/system.meltemi +23 -0
- package/templates/ci/github.yml +96 -0
- package/templates/ci/gitlab.yml +53 -0
- package/templates/flow/diagrams/overview.meltemi +15 -0
- package/templates/free/diagrams/slide.meltemi +39 -0
- package/templates/purchase/diagrams/architecture.meltemi +36 -0
- package/templates/purchase/diagrams/executive.meltemi +52 -0
- package/templates/purchase/diagrams/payment.meltemi +42 -0
- package/templates/purchase/models/commerce.meltemi +30 -0
- package/templates/purchase/stories/purchase.meltemi +38 -0
- package/templates/sequence/diagrams/sign-in.meltemi +36 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of `push` and `pull` in English (`cli-cloud`), kept beside `en.ts` so that the two
|
|
3
|
+
* commands own their sentences: their help, their output, and the failures they name by stable code
|
|
4
|
+
* (`push.*`, `pull.*`, and the service's own codes as these commands meet them). `en.ts` hangs them
|
|
5
|
+
* under `help` and `cloud`; `push-pull-es.ts` has the Spanish with the same shape.
|
|
6
|
+
*/
|
|
7
|
+
const count = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
8
|
+
export const pushPullEn = {
|
|
9
|
+
help: {
|
|
10
|
+
push: `Usage: push [folder] [options]
|
|
11
|
+
|
|
12
|
+
Makes the cloud project match the folder (the working folder by default): project.json, the
|
|
13
|
+
sheets, themes and other text files travel by content, images and fonts by hash, and what the
|
|
14
|
+
folder lacks is deleted in the cloud, all in one transaction. Dotfiles, node_modules, what
|
|
15
|
+
project.json excludes and the catalog's output folder are never sent. The cloud project is the
|
|
16
|
+
one --project names, else project.json's "cloud".
|
|
17
|
+
|
|
18
|
+
Before changing anything it compares every path with the cloud's and lists those that differ,
|
|
19
|
+
beside the review by id of the diagrams. Only a cloud that already matches the folder is pushed
|
|
20
|
+
without asking; otherwise a terminal is asked "Overwrite these changes in the cloud?", and without
|
|
21
|
+
one the push is refused unless --force. A change made in the cloud while pushing is never
|
|
22
|
+
overwritten without that question (or --force).
|
|
23
|
+
|
|
24
|
+
Options:
|
|
25
|
+
--create Make a new cloud project from the folder and record it in project.json
|
|
26
|
+
--name <name> With --create, the project's name; project.json's name by default
|
|
27
|
+
--project <id> The cloud project, instead of project.json's "cloud"
|
|
28
|
+
--force Overwrite what differs in the cloud without asking
|
|
29
|
+
--check Write nothing; list what differs (exit 1 if anything does)
|
|
30
|
+
--strict Do not push when validation finds errors
|
|
31
|
+
--host <url> The service: MELTEMI_HOST, else https://diagrams.meltemi.dev
|
|
32
|
+
|
|
33
|
+
Exit codes: 0 pushed, or nothing to push, 1 refused or failed (or --check found differences),
|
|
34
|
+
2 usage error, 3 not signed in or the service refused the token.
|
|
35
|
+
`,
|
|
36
|
+
pull: `Usage: pull [<id>] [folder] [options]
|
|
37
|
+
|
|
38
|
+
Writes the files of a cloud project into the folder (the working folder by default). The project
|
|
39
|
+
is <id> (20 letters and digits), else the one project.json's "cloud" names. Files that already
|
|
40
|
+
match are left alone; a file that exists and differs is listed and kept unless --force; files
|
|
41
|
+
that are only in the folder stay. Images and fonts are fetched by hash and checked. project.json
|
|
42
|
+
gains "cloud" when it has none, and nothing else of it changes.
|
|
43
|
+
|
|
44
|
+
Every cloud path is checked before anything is written: one that is not a plain relative path
|
|
45
|
+
inside the folder (or that Windows could not keep) refuses the whole pull with pull.unsafe-path.
|
|
46
|
+
|
|
47
|
+
Options:
|
|
48
|
+
--version <n> Pull this version of the project instead of its latest files
|
|
49
|
+
--force Overwrite files that differ
|
|
50
|
+
--host <url> The service: MELTEMI_HOST, else https://diagrams.meltemi.dev
|
|
51
|
+
|
|
52
|
+
Exit codes: 0 pulled, 1 refused, failed or some files kept, 2 usage error, 3 not signed in or the
|
|
53
|
+
service refused the token.
|
|
54
|
+
`,
|
|
55
|
+
},
|
|
56
|
+
push: {
|
|
57
|
+
nameNeedsCreate: "--name goes with --create.",
|
|
58
|
+
nameEmpty: "--name needs a name.",
|
|
59
|
+
createWithProject: "--create makes a new project, so it cannot be combined with --project.",
|
|
60
|
+
checkWithCreate: "--check only reports, so it cannot be combined with --create.",
|
|
61
|
+
oneFolder: "push takes one folder.",
|
|
62
|
+
notAFolder: (path) => `${path} is not a folder.`,
|
|
63
|
+
/** The heading of the paths that differ. */
|
|
64
|
+
differs: (n) => `The cloud project differs from the folder in ${count(n, "path")}:`,
|
|
65
|
+
pathAdded: (path) => ` ${path} is not in the cloud yet`,
|
|
66
|
+
pathChanged: (path) => ` ${path} differs`,
|
|
67
|
+
pathDeleted: (path) => ` ${path} is only in the cloud (pushing deletes it)`,
|
|
68
|
+
/** The heading of the review by id. */
|
|
69
|
+
review: "By id, what pushing changes in the diagrams:",
|
|
70
|
+
identical: (id) => `The cloud project ${id} already matches the folder; nothing to push.`,
|
|
71
|
+
/** The question on a terminal; the answers it accepts are yes and no. */
|
|
72
|
+
overwrite: "Overwrite these changes in the cloud? [y/N] ",
|
|
73
|
+
retrying: "The cloud project changed while pushing; comparing again.",
|
|
74
|
+
checkDiffers: (n) => `${count(n, "path")} differ${n === 1 ? "s" : ""}; pushing would change the cloud project.`,
|
|
75
|
+
created: (id, name) => `Created the cloud project ${id} (${name}).`,
|
|
76
|
+
recorded: (path) => `Recorded the cloud project in ${path}.`,
|
|
77
|
+
pushed: (id, written, deleted, uploaded) => {
|
|
78
|
+
const parts = [`${count(written, "file")} written`];
|
|
79
|
+
if (deleted > 0)
|
|
80
|
+
parts.push(`${count(deleted, "file")} deleted`);
|
|
81
|
+
if (uploaded > 0)
|
|
82
|
+
parts.push(`${count(uploaded, "image or font", "images or fonts")} uploaded`);
|
|
83
|
+
return `Pushed to the cloud project ${id}: ${parts.join(", ")}.`;
|
|
84
|
+
},
|
|
85
|
+
/** Where to see the project. */
|
|
86
|
+
open: (url) => `Open it at ${url}`,
|
|
87
|
+
/** A file or folder that is not sent. */
|
|
88
|
+
notSent: (path, reason) => `warning: ${path} is not sent: ${reason}`,
|
|
89
|
+
reasons: {
|
|
90
|
+
path: "its name is not one the cloud keeps (ASCII letters, digits, spaces and . _ ( ) + @ -, no name starting with a dot, at most 12 names of 100 characters).",
|
|
91
|
+
encoding: "it is not UTF-8 text.",
|
|
92
|
+
unreadable: (why) => `it cannot be read (${why}).`,
|
|
93
|
+
},
|
|
94
|
+
/** Files the cloud does not keep, such as a PDF. */
|
|
95
|
+
ignored: (n, examples) => `${count(n, "file")} not kept in the cloud (it keeps diagrams, text, images and fonts): ${examples}`,
|
|
96
|
+
/** A copy two people made at once in the cloud, which a push never touches. */
|
|
97
|
+
collision: (path) => `${path} is a copy that two people made at once in the cloud; the push leaves it alone. Settle it in the page.`,
|
|
98
|
+
},
|
|
99
|
+
pull: {
|
|
100
|
+
tooMany: "pull takes an id and a folder at most.",
|
|
101
|
+
version: (text) => `--version takes a version number, such as 3, not "${text}".`,
|
|
102
|
+
wrote: (path) => ` wrote ${path}`,
|
|
103
|
+
kept: (path) => ` kept ${path} (it differs from the cloud)`,
|
|
104
|
+
inTheWay: (path) => ` kept ${path} (a folder is in its place)`,
|
|
105
|
+
keptHint: "Pass --force to overwrite the files that differ.",
|
|
106
|
+
loser: (path) => ` skipped ${path}: a copy two people made at once in the cloud; settle it in the page`,
|
|
107
|
+
recorded: (path) => `Recorded the cloud project in ${path}.`,
|
|
108
|
+
noManifest: "The project has no project.json, so nothing in the folder records which cloud project it mirrors; give the id next time.",
|
|
109
|
+
pulled: (id, version, folder, written, identical, kept) => `Pulled ${version === null ? "the latest files" : `version ${version}`} of the cloud project ${id} into ${folder}: ${written} written, ${identical} already identical, ${kept} kept.`,
|
|
110
|
+
},
|
|
111
|
+
/** Why a failure of these commands (or of the service, as they meet it) happened, by stable code. */
|
|
112
|
+
errors: {
|
|
113
|
+
revisionMismatch: "the cloud project changed again while pushing, so nothing was overwritten. Run push again.",
|
|
114
|
+
quotaFiles: "a project holds at most 2000 files.",
|
|
115
|
+
quotaBinary: (path) => path === ""
|
|
116
|
+
? "an image or font may be at most 10 MiB."
|
|
117
|
+
: `${path} is larger than the 10 MiB an image or font may be.`,
|
|
118
|
+
quotaStorage: "this account would go over its 200 MiB of storage.",
|
|
119
|
+
quotaProjects: "this account already holds 100 projects.",
|
|
120
|
+
docTooLarge: (path) => path === ""
|
|
121
|
+
? "the texts of the folder are larger than the 16 MiB a project's document holds."
|
|
122
|
+
: `${path} is larger than the 2 Mi characters a text file may have.`,
|
|
123
|
+
pathInvalid: (path) => path === "" ? "a path is not one the cloud keeps." : `${path} is not a path the cloud keeps.`,
|
|
124
|
+
binaryInvalid: (path) => `${path === "" ? "an upload" : path} is not a PNG, JPEG, GIF, WebP, woff2, ttf or otf by its bytes.`,
|
|
125
|
+
pushDiffers: (n) => `the cloud project differs from the folder in ${count(n, "path")}, so nothing was pushed. Run push on a terminal to be asked, or pass --force.`,
|
|
126
|
+
pushDeclined: "nothing was pushed.",
|
|
127
|
+
pushLinked: (project) => `project.json already names the cloud project ${project}: push without --create, or remove its "cloud" setting to make another.`,
|
|
128
|
+
pushStrict: (errors, unsent) => {
|
|
129
|
+
const parts = [];
|
|
130
|
+
if (errors > 0)
|
|
131
|
+
parts.push(count(errors, "validation error"));
|
|
132
|
+
if (unsent > 0)
|
|
133
|
+
parts.push(`${count(unsent, "file")} that cannot be sent`);
|
|
134
|
+
return `${parts.join(" and ")}, and --strict is given, so nothing was pushed.`;
|
|
135
|
+
},
|
|
136
|
+
pushManifestInvalid: (reason) => `project.json is not a JSON object that can be edited (${reason}); fix it before --create. Nothing was created.`,
|
|
137
|
+
pushManifestNotWritten: (project, host, reason) => `the cloud project ${project} was created with the folder's text files, but project.json could not be updated (${reason}). Add "cloud": { "host": "${host}", "project": "${project}" } to it yourself, then run push.`,
|
|
138
|
+
pushFileChanged: (path) => `${path} changed while it was being pushed; nothing of it was kept. Run push again.`,
|
|
139
|
+
pullNoProject: "no cloud project is named: give its id, or run pull in a folder whose project.json has a cloud setting.",
|
|
140
|
+
pullOtherProject: (project, linked) => `project.json already names the cloud project ${linked}; pulling ${project} here would mix the two. Pull into another folder.`,
|
|
141
|
+
pullNotAFolder: (path) => `${path} exists and is not a folder.`,
|
|
142
|
+
pullManifestNotUpdated: (reason) => `project.json could not be updated with the cloud project (${reason}); the other files were written.`,
|
|
143
|
+
pullWrite: (path, reason) => `cannot write ${path}: ${reason}`,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=push-pull-en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-pull-en.js","sourceRoot":"","sources":["../../src/messages/push-pull-en.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,GAAW,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAE3F,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE;QACJ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBT;QACG,IAAI,EAAE;;;;;;;;;;;;;;;;;;CAkBT;KACE;IACD,IAAI,EAAE;QACJ,eAAe,EAAE,4BAA4B;QAC7C,SAAS,EAAE,sBAAsB;QACjC,iBAAiB,EAAE,wEAAwE;QAC3F,eAAe,EAAE,+DAA+D;QAChF,SAAS,EAAE,wBAAwB;QACnC,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,IAAI,mBAAmB;QACxD,4CAA4C;QAC5C,OAAO,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,gDAAgD,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;QAC3F,SAAS,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,IAAI,0BAA0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,sBAAsB,CAAC,CAAC;YAC3E,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,iDAAiD,CAAC;QACjF,CAAC;QACD,mBAAmB,EAAE,CAAC,MAAc,EAAE,EAAE,CACtC,yDAAyD,MAAM,iDAAiD;QAClH,sBAAsB,EAAE,CAAC,OAAe,EAAE,IAAY,EAAE,MAAc,EAAE,EAAE,CACxE,qBAAqB,OAAO,qFAAqF,MAAM,8BAA8B,IAAI,kBAAkB,OAAO,oCAAoC;QACxN,eAAe,EAAE,CAAC,IAAY,EAAE,EAAE,CAChC,GAAG,IAAI,6EAA6E;QACtF,aAAa,EACX,yGAAyG;QAC3G,gBAAgB,EAAE,CAAC,OAAe,EAAE,MAAc,EAAE,EAAE,CACpD,gDAAgD,MAAM,aAAa,OAAO,oDAAoD;QAChI,cAAc,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,IAAI,8BAA8B;QACvE,sBAAsB,EAAE,CAAC,MAAc,EAAE,EAAE,CACzC,6DAA6D,MAAM,kCAAkC;QACvG,SAAS,EAAE,CAAC,IAAY,EAAE,MAAc,EAAE,EAAE,CAAC,gBAAgB,IAAI,KAAK,MAAM,EAAE;KAC/E;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Las palabras de `push` y `pull` en español (`cli-cloud`), con la misma forma que
|
|
3
|
+
* `push-pull-en.ts`; `es.ts` las cuelga de `help` y `cloud`.
|
|
4
|
+
*/
|
|
5
|
+
import type { pushPullEn } from "./push-pull-en.js";
|
|
6
|
+
export declare const pushPullEs: typeof pushPullEn;
|
|
7
|
+
//# sourceMappingURL=push-pull-es.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-pull-es.d.ts","sourceRoot":"","sources":["../../src/messages/push-pull-es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD,eAAO,MAAM,UAAU,EAAE,OAAO,UA2J/B,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Las palabras de `push` y `pull` en español (`cli-cloud`), con la misma forma que
|
|
3
|
+
* `push-pull-en.ts`; `es.ts` las cuelga de `help` y `cloud`.
|
|
4
|
+
*/
|
|
5
|
+
import { plural } from "@meltemi/diagrams-i18n";
|
|
6
|
+
/** A count with its word: "1 archivo", "3 archivos". */
|
|
7
|
+
const count = (n, one, other) => `${n} ${plural("es", n, { one, other })}`;
|
|
8
|
+
export const pushPullEs = {
|
|
9
|
+
help: {
|
|
10
|
+
push: `Uso: push [carpeta] [opciones]
|
|
11
|
+
|
|
12
|
+
Hace que el proyecto de la nube coincida con la carpeta (por defecto, la carpeta de trabajo):
|
|
13
|
+
project.json, las hojas, los temas y los demás archivos de texto viajan por su contenido, las
|
|
14
|
+
imágenes y las fuentes por su hash, y lo que le falta a la carpeta se borra en la nube, todo en
|
|
15
|
+
una sola transacción. Los archivos con punto, node_modules, lo que project.json excluye y la
|
|
16
|
+
carpeta de salida del catálogo nunca se envían. El proyecto de la nube es el que nombra
|
|
17
|
+
--project, si no el "cloud" de project.json.
|
|
18
|
+
|
|
19
|
+
Antes de cambiar nada compara cada ruta con la de la nube y lista las que difieren, junto a la
|
|
20
|
+
revisión por id de los diagramas. Solo una nube que ya coincide con la carpeta se actualiza sin
|
|
21
|
+
preguntar; si no, a una terminal se le pregunta "¿Sobrescribir estos cambios en la nube?", y sin
|
|
22
|
+
terminal el push se rechaza salvo con --force. Un cambio hecho en la nube mientras se envía nunca
|
|
23
|
+
se sobrescribe sin esa pregunta (o --force).
|
|
24
|
+
|
|
25
|
+
Opciones:
|
|
26
|
+
--create Crear un proyecto nuevo en la nube con la carpeta y anotarlo en project.json
|
|
27
|
+
--name <nombre> Con --create, el nombre del proyecto; el de project.json por defecto
|
|
28
|
+
--project <id> El proyecto de la nube, en vez del "cloud" de project.json
|
|
29
|
+
--force Sobrescribir sin preguntar lo que difiere en la nube
|
|
30
|
+
--check No escribir nada; listar lo que difiere (sale con 1 si algo difiere)
|
|
31
|
+
--strict No enviar si la validación encuentra errores
|
|
32
|
+
--host <url> El servicio: MELTEMI_HOST, si no https://diagrams.meltemi.dev
|
|
33
|
+
|
|
34
|
+
Códigos de salida: 0 enviado, o nada que enviar, 1 rechazado o fallido (o --check encontró
|
|
35
|
+
diferencias), 2 error de uso, 3 sin sesión iniciada o el servicio rechazó el token.
|
|
36
|
+
`,
|
|
37
|
+
pull: `Uso: pull [<id>] [carpeta] [opciones]
|
|
38
|
+
|
|
39
|
+
Escribe los archivos de un proyecto de la nube en la carpeta (por defecto, la carpeta de trabajo).
|
|
40
|
+
El proyecto es <id> (20 letras y dígitos), si no el que nombra el "cloud" de project.json. Los
|
|
41
|
+
archivos que ya coinciden se dejan; un archivo que existe y difiere se lista y se conserva salvo
|
|
42
|
+
con --force; los archivos que solo están en la carpeta se quedan. Las imágenes y las fuentes se
|
|
43
|
+
traen por su hash y se comprueban. project.json recibe "cloud" si no lo tiene, y nada más de él
|
|
44
|
+
cambia.
|
|
45
|
+
|
|
46
|
+
Cada ruta de la nube se comprueba antes de escribir nada: una que no sea una ruta relativa simple
|
|
47
|
+
dentro de la carpeta (o que Windows no pudiera guardar) rechaza todo el pull con
|
|
48
|
+
pull.unsafe-path.
|
|
49
|
+
|
|
50
|
+
Opciones:
|
|
51
|
+
--version <n> Traer esta versión del proyecto en vez de sus últimos archivos
|
|
52
|
+
--force Sobrescribir los archivos que difieren
|
|
53
|
+
--host <url> El servicio: MELTEMI_HOST, si no https://diagrams.meltemi.dev
|
|
54
|
+
|
|
55
|
+
Códigos de salida: 0 hecho, 1 rechazado, fallido o con archivos conservados, 2 error de uso,
|
|
56
|
+
3 sin sesión iniciada o el servicio rechazó el token.
|
|
57
|
+
`,
|
|
58
|
+
},
|
|
59
|
+
push: {
|
|
60
|
+
nameNeedsCreate: "--name va con --create.",
|
|
61
|
+
nameEmpty: "--name necesita un nombre.",
|
|
62
|
+
createWithProject: "--create crea un proyecto nuevo, así que no se combina con --project.",
|
|
63
|
+
checkWithCreate: "--check solo informa, así que no se combina con --create.",
|
|
64
|
+
oneFolder: "push lleva una sola carpeta.",
|
|
65
|
+
notAFolder: (path) => `${path} no es una carpeta.`,
|
|
66
|
+
differs: (n) => `El proyecto de la nube difiere de la carpeta en ${count(n, "ruta", "rutas")}:`,
|
|
67
|
+
pathAdded: (path) => ` ${path} todavía no está en la nube`,
|
|
68
|
+
pathChanged: (path) => ` ${path} difiere`,
|
|
69
|
+
pathDeleted: (path) => ` ${path} solo está en la nube (el push la borra)`,
|
|
70
|
+
review: "Por id, lo que el push cambia en los diagramas:",
|
|
71
|
+
identical: (id) => `El proyecto ${id} de la nube ya coincide con la carpeta; no hay nada que enviar.`,
|
|
72
|
+
overwrite: "¿Sobrescribir estos cambios en la nube? [s/N] ",
|
|
73
|
+
retrying: "El proyecto de la nube cambió mientras se enviaba; se compara de nuevo.",
|
|
74
|
+
checkDiffers: (n) => `${n === 1 ? "difiere 1 ruta" : `difieren ${n} rutas`}; el push cambiaría el proyecto de la nube.`,
|
|
75
|
+
created: (id, name) => `Se creó el proyecto ${id} en la nube (${name}).`,
|
|
76
|
+
recorded: (path) => `Se anotó el proyecto de la nube en ${path}.`,
|
|
77
|
+
pushed: (id, written, deleted, uploaded) => {
|
|
78
|
+
const parts = [`${count(written, "archivo escrito", "archivos escritos")}`];
|
|
79
|
+
if (deleted > 0)
|
|
80
|
+
parts.push(count(deleted, "archivo borrado", "archivos borrados"));
|
|
81
|
+
if (uploaded > 0)
|
|
82
|
+
parts.push(count(uploaded, "imagen o fuente subida", "imágenes o fuentes subidas"));
|
|
83
|
+
return `Enviado al proyecto ${id} de la nube: ${parts.join(", ")}.`;
|
|
84
|
+
},
|
|
85
|
+
open: (url) => `Ábrelo en ${url}`,
|
|
86
|
+
notSent: (path, reason) => `advertencia: ${path} no se envía: ${reason}`,
|
|
87
|
+
reasons: {
|
|
88
|
+
path: "su nombre no es de los que guarda la nube (letras ASCII, dígitos, espacios y . _ ( ) + @ -, ningún nombre que empiece por punto, a lo sumo 12 nombres de 100 caracteres).",
|
|
89
|
+
encoding: "no es texto UTF-8.",
|
|
90
|
+
unreadable: (why) => `no se puede leer (${why}).`,
|
|
91
|
+
},
|
|
92
|
+
ignored: (n, examples) => `${count(n, "archivo no se guarda", "archivos no se guardan")} en la nube (guarda diagramas, texto, imágenes y fuentes): ${examples}`,
|
|
93
|
+
collision: (path) => `${path} es una copia que dos personas hicieron a la vez en la nube; el push la deja como está. Resuélvelo en la página.`,
|
|
94
|
+
},
|
|
95
|
+
pull: {
|
|
96
|
+
tooMany: "pull lleva como máximo un id y una carpeta.",
|
|
97
|
+
version: (text) => `--version lleva un número de versión, como 3, no "${text}".`,
|
|
98
|
+
wrote: (path) => ` se escribió ${path}`,
|
|
99
|
+
kept: (path) => ` se conservó ${path} (difiere de la nube)`,
|
|
100
|
+
inTheWay: (path) => ` se conservó ${path} (hay una carpeta en su lugar)`,
|
|
101
|
+
keptHint: "Pasa --force para sobrescribir los archivos que difieren.",
|
|
102
|
+
loser: (path) => ` se omitió ${path}: una copia que dos personas hicieron a la vez en la nube; resuélvelo en la página`,
|
|
103
|
+
recorded: (path) => `Se anotó el proyecto de la nube en ${path}.`,
|
|
104
|
+
noManifest: "El proyecto no tiene project.json, así que nada en la carpeta anota qué proyecto de la nube refleja; da el id la próxima vez.",
|
|
105
|
+
pulled: (id, version, folder, written, identical, kept) => `${version === null ? "Se trajeron los últimos archivos" : `Se trajo la versión ${version}`} del proyecto ${id} de la nube a ${folder}: ${written} escritos, ${identical} ya idénticos, ${kept} conservados.`,
|
|
106
|
+
},
|
|
107
|
+
errors: {
|
|
108
|
+
revisionMismatch: "el proyecto de la nube volvió a cambiar mientras se enviaba, así que no se sobrescribió nada. Ejecuta push otra vez.",
|
|
109
|
+
quotaFiles: "un proyecto guarda como máximo 2000 archivos.",
|
|
110
|
+
quotaBinary: (path) => path === ""
|
|
111
|
+
? "una imagen o fuente puede pesar como máximo 10 MiB."
|
|
112
|
+
: `${path} pesa más de los 10 MiB que puede tener una imagen o fuente.`,
|
|
113
|
+
quotaStorage: "esta cuenta superaría sus 200 MiB de almacenamiento.",
|
|
114
|
+
quotaProjects: "esta cuenta ya tiene 100 proyectos.",
|
|
115
|
+
docTooLarge: (path) => path === ""
|
|
116
|
+
? "los textos de la carpeta superan los 16 MiB que guarda el documento de un proyecto."
|
|
117
|
+
: `${path} supera los 2 Mi caracteres que puede tener un archivo de texto.`,
|
|
118
|
+
pathInvalid: (path) => path === ""
|
|
119
|
+
? "una ruta no es de las que guarda la nube."
|
|
120
|
+
: `${path} no es una ruta de las que guarda la nube.`,
|
|
121
|
+
binaryInvalid: (path) => `${path === "" ? "una subida" : path} no es un PNG, JPEG, GIF, WebP, woff2, ttf u otf según sus bytes.`,
|
|
122
|
+
pushDiffers: (n) => `el proyecto de la nube difiere de la carpeta en ${count(n, "ruta", "rutas")}, así que no se envió nada. Ejecuta push en una terminal para que te pregunte, o pasa --force.`,
|
|
123
|
+
pushDeclined: "no se envió nada.",
|
|
124
|
+
pushLinked: (project) => `project.json ya nombra el proyecto ${project} de la nube: haz push sin --create, o quita su ajuste "cloud" para crear otro.`,
|
|
125
|
+
pushStrict: (errors, unsent) => {
|
|
126
|
+
const parts = [];
|
|
127
|
+
if (errors > 0)
|
|
128
|
+
parts.push(count(errors, "error de validación", "errores de validación"));
|
|
129
|
+
if (unsent > 0) {
|
|
130
|
+
parts.push(count(unsent, "archivo que no se puede enviar", "archivos que no se pueden enviar"));
|
|
131
|
+
}
|
|
132
|
+
return `${parts.join(" y ")}, y se pasó --strict, así que no se envió nada.`;
|
|
133
|
+
},
|
|
134
|
+
pushManifestInvalid: (reason) => `project.json no es un objeto JSON que se pueda editar (${reason}); corrígelo antes de --create. No se creó nada.`,
|
|
135
|
+
pushManifestNotWritten: (project, host, reason) => `el proyecto ${project} de la nube se creó con los archivos de texto de la carpeta, pero no se pudo actualizar project.json (${reason}). Añádele tú "cloud": { "host": "${host}", "project": "${project}" } y ejecuta push.`,
|
|
136
|
+
pushFileChanged: (path) => `${path} cambió mientras se enviaba; no se guardó nada de él. Ejecuta push otra vez.`,
|
|
137
|
+
pullNoProject: "no se nombra ningún proyecto de la nube: da su id, o ejecuta pull en una carpeta cuyo project.json tenga un ajuste cloud.",
|
|
138
|
+
pullOtherProject: (project, linked) => `project.json ya nombra el proyecto ${linked} de la nube; traer ${project} aquí mezclaría los dos. Trae el proyecto a otra carpeta.`,
|
|
139
|
+
pullNotAFolder: (path) => `${path} existe y no es una carpeta.`,
|
|
140
|
+
pullManifestNotUpdated: (reason) => `no se pudo actualizar project.json con el proyecto de la nube (${reason}); los demás archivos se escribieron.`,
|
|
141
|
+
pullWrite: (path, reason) => `no se puede escribir ${path}: ${reason}`,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=push-pull-es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-pull-es.js","sourceRoot":"","sources":["../../src/messages/push-pull-es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,wDAAwD;AACxD,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,GAAW,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEnG,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,IAAI,EAAE;QACJ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BT;QACG,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;CAoBT;KACE;IACD,IAAI,EAAE;QACJ,eAAe,EAAE,yBAAyB;QAC1C,SAAS,EAAE,4BAA4B;QACvC,iBAAiB,EAAE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GAAa,EAAE,CAAC;YAC3B,IAAI,MAAM,GAAG,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,CAAC,CAAC,CAAC;YAC1F,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBACf,KAAK,CAAC,IAAI,CACR,KAAK,CAAC,MAAM,EAAE,gCAAgC,EAAE,kCAAkC,CAAC,CACpF,CAAC;YACJ,CAAC;YACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,iDAAiD,CAAC;QAC/E,CAAC;QACD,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE,CAC9B,0DAA0D,MAAM,kDAAkD;QACpH,sBAAsB,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAChD,eAAe,OAAO,yGAAyG,MAAM,qCAAqC,IAAI,kBAAkB,OAAO,qBAAqB;QAC9N,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CACxB,GAAG,IAAI,8EAA8E;QACvF,aAAa,EACX,2HAA2H;QAC7H,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CACpC,sCAAsC,MAAM,sBAAsB,OAAO,2DAA2D;QACtI,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,8BAA8B;QAC/D,sBAAsB,EAAE,CAAC,MAAM,EAAE,EAAE,CACjC,kEAAkE,MAAM,uCAAuC;QACjH,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,wBAAwB,IAAI,KAAK,MAAM,EAAE;KACvE;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The program that opens an address in the user's browser on a platform, with its arguments. */
|
|
2
|
+
export declare function browserCommand(url: string, platform?: NodeJS.Platform): {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly args: readonly string[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Opens a web address in the default browser, without a shell. Resolves once the opener started and
|
|
8
|
+
* rejects when it could not (no `xdg-open`, say), so that the caller can print the address.
|
|
9
|
+
*/
|
|
10
|
+
export declare function openUrl(url: string, platform?: NodeJS.Platform): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=open-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-url.d.ts","sourceRoot":"","sources":["../src/open-url.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAYhE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAehG"}
|
package/dist/open-url.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
/** The program that opens an address in the user's browser on a platform, with its arguments. */
|
|
3
|
+
export function browserCommand(url, platform = process.platform) {
|
|
4
|
+
// Only web addresses, which the command line builds itself: never what a server or a file says.
|
|
5
|
+
const protocol = new URL(url).protocol;
|
|
6
|
+
if (protocol !== "http:" && protocol !== "https:") {
|
|
7
|
+
throw new Error(`Refusing to open ${protocol} addresses.`);
|
|
8
|
+
}
|
|
9
|
+
// No shell on any platform, so that `&` and quotes in the address mean nothing: `cmd /c start`
|
|
10
|
+
// would read them as its own syntax.
|
|
11
|
+
if (platform === "win32") {
|
|
12
|
+
return { command: "rundll32.exe", args: ["url.dll,FileProtocolHandler", url] };
|
|
13
|
+
}
|
|
14
|
+
return { command: platform === "darwin" ? "open" : "xdg-open", args: [url] };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Opens a web address in the default browser, without a shell. Resolves once the opener started and
|
|
18
|
+
* rejects when it could not (no `xdg-open`, say), so that the caller can print the address.
|
|
19
|
+
*/
|
|
20
|
+
export function openUrl(url, platform = process.platform) {
|
|
21
|
+
const { command, args } = browserCommand(url, platform);
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
const child = spawn(command, [...args], {
|
|
24
|
+
detached: true,
|
|
25
|
+
stdio: "ignore",
|
|
26
|
+
windowsHide: true,
|
|
27
|
+
shell: false,
|
|
28
|
+
});
|
|
29
|
+
child.once("error", reject);
|
|
30
|
+
child.once("spawn", () => {
|
|
31
|
+
child.unref();
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=open-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-url.js","sourceRoot":"","sources":["../src/open-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,iGAAiG;AACjG,MAAM,UAAU,cAAc,CAC5B,GAAW,EACX,WAA4B,OAAO,CAAC,QAAQ;IAE5C,gGAAgG;IAChG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IACvC,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,aAAa,CAAC,CAAC;IAC7D,CAAC;IACD,+FAA+F;IAC/F,qCAAqC;IACrC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,6BAA6B,EAAE,GAAG,CAAC,EAAE,CAAC;IACjF,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW,EAAE,WAA4B,OAAO,CAAC,QAAQ;IAC/E,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;YACtC,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;YACvB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Diagnostic } from "@meltemi/diagrams-language";
|
|
2
|
+
import { type Workspace } from "@meltemi/diagrams-project";
|
|
3
|
+
/** What the plugins command needs from the CLI. */
|
|
4
|
+
export interface PluginsContext {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly stdout: (text: string) => void;
|
|
7
|
+
readonly stderr: (text: string) => void;
|
|
8
|
+
readonly cwd: string;
|
|
9
|
+
readonly display: (path: string) => string;
|
|
10
|
+
readonly workspaceFor: (path: string, isDirectory: boolean) => Workspace;
|
|
11
|
+
readonly printDiagnostics: (path: string, diagnostics: readonly Diagnostic[]) => void;
|
|
12
|
+
}
|
|
13
|
+
/** `meltemi-diagrams plugins`. */
|
|
14
|
+
export declare function pluginsCommand(args: readonly string[], context: PluginsContext): number;
|
|
15
|
+
//# sourceMappingURL=plugins-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins-command.d.ts","sourceRoot":"","sources":["../src/plugins-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGxF,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,SAAS,CAAC;IACzE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,KAAK,IAAI,CAAC;CACvF;AAED,kCAAkC;AAClC,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAuGvF"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { statSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
|
+
import { relativePath, toProjectPath } from "@meltemi/diagrams-project";
|
|
5
|
+
import { argumentsError, messages } from "./messages/index.js";
|
|
6
|
+
/** `meltemi-diagrams plugins`. */
|
|
7
|
+
export function pluginsCommand(args, context) {
|
|
8
|
+
let values;
|
|
9
|
+
let positionals;
|
|
10
|
+
try {
|
|
11
|
+
const parsed = parseArgs({
|
|
12
|
+
args: [...args],
|
|
13
|
+
options: {
|
|
14
|
+
json: { type: "boolean", default: false },
|
|
15
|
+
help: { type: "boolean", short: "h", default: false },
|
|
16
|
+
},
|
|
17
|
+
allowPositionals: true,
|
|
18
|
+
strict: true,
|
|
19
|
+
});
|
|
20
|
+
values = parsed.values;
|
|
21
|
+
positionals = parsed.positionals;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
context.stderr(`${context.name} plugins: ${argumentsError(error)}\n`);
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
if (values.help) {
|
|
28
|
+
context.stdout(messages().help.plugins);
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
const target = toProjectPath(resolve(context.cwd, positionals[0] ?? "."));
|
|
32
|
+
let isDirectory;
|
|
33
|
+
try {
|
|
34
|
+
isDirectory = statSync(target).isDirectory();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
context.stderr(`${context.name} plugins: ${messages().common.pathNotFound(positionals[0] ?? ".")}\n`);
|
|
38
|
+
return 2;
|
|
39
|
+
}
|
|
40
|
+
const workspace = context.workspaceFor(target, isDirectory);
|
|
41
|
+
const loaded = workspace.plugins();
|
|
42
|
+
const installed = workspace.manifest().manifest?.plugins ?? [];
|
|
43
|
+
const errors = [...loaded.diagnostics.values()].flat().some((d) => d.severity === "error");
|
|
44
|
+
if (values.json) {
|
|
45
|
+
context.stdout(`${JSON.stringify({
|
|
46
|
+
plugins: installed.map((setting) => {
|
|
47
|
+
const plugin = loaded.plugins.find((p) => p.name === setting.name);
|
|
48
|
+
return {
|
|
49
|
+
name: setting.name,
|
|
50
|
+
version: setting.version,
|
|
51
|
+
path: setting.path,
|
|
52
|
+
granted: setting.permissions,
|
|
53
|
+
loaded: plugin !== undefined,
|
|
54
|
+
...(plugin
|
|
55
|
+
? {
|
|
56
|
+
description: plugin.description,
|
|
57
|
+
license: plugin.license,
|
|
58
|
+
homepage: plugin.homepage,
|
|
59
|
+
permissions: plugin.permissions,
|
|
60
|
+
types: plugin.types.map((t) => ({
|
|
61
|
+
type: t.type,
|
|
62
|
+
title: t.title,
|
|
63
|
+
kinds: Object.keys(t.elements),
|
|
64
|
+
})),
|
|
65
|
+
icons: plugin.icons === null ? null : plugin.name,
|
|
66
|
+
integrity: plugin.integrity,
|
|
67
|
+
}
|
|
68
|
+
: {}),
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
problems: [...loaded.diagnostics].map(([path, list]) => ({
|
|
72
|
+
path: relativePath(workspace.root, path),
|
|
73
|
+
diagnostics: list.map((d) => ({
|
|
74
|
+
code: d.code,
|
|
75
|
+
severity: d.severity,
|
|
76
|
+
message: d.message,
|
|
77
|
+
})),
|
|
78
|
+
})),
|
|
79
|
+
}, null, 2)}\n`);
|
|
80
|
+
return errors ? 1 : 0;
|
|
81
|
+
}
|
|
82
|
+
const t = messages().plugins;
|
|
83
|
+
if (installed.length === 0)
|
|
84
|
+
context.stdout(`${t.none}\n`);
|
|
85
|
+
for (const setting of installed) {
|
|
86
|
+
const plugin = loaded.plugins.find((p) => p.name === setting.name);
|
|
87
|
+
if (!plugin) {
|
|
88
|
+
context.stdout(`${t.notLoaded(setting.name, setting.version)}\n`);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
context.stdout(`${plugin.name} ${plugin.version}${plugin.license ? ` (${plugin.license})` : ""}${plugin.description ? ` — ${plugin.description}` : ""}\n`);
|
|
92
|
+
if (plugin.homepage)
|
|
93
|
+
context.stdout(`${t.from(plugin.homepage)}\n`);
|
|
94
|
+
context.stdout(`${t.folder(setting.path, setting.permissions)}\n`);
|
|
95
|
+
for (const type of plugin.types) {
|
|
96
|
+
context.stdout(`${t.type(type.type, type.title, Object.keys(type.elements))}\n`);
|
|
97
|
+
}
|
|
98
|
+
if (plugin.icons)
|
|
99
|
+
context.stdout(`${t.icons(plugin.name)}\n`);
|
|
100
|
+
}
|
|
101
|
+
for (const [path, list] of loaded.diagnostics) {
|
|
102
|
+
context.printDiagnostics(context.display(path), list);
|
|
103
|
+
}
|
|
104
|
+
return errors ? 1 : 0;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=plugins-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins-command.js","sourceRoot":"","sources":["../src/plugins-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAkB,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAa/D,kCAAkC;AAClC,MAAM,UAAU,cAAc,CAAC,IAAuB,EAAE,OAAuB;IAC7E,IAAI,MAAwC,CAAC;IAC7C,IAAI,WAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC;YACvB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;YACf,OAAO,EAAE;gBACP,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;gBACzC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE;aACtD;YACD,gBAAgB,EAAE,IAAI;YACtB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QACH,MAAM,GAAG,MAAM,CAAC,MAAuB,CAAC;QACxC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAA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C,CAAC,CAAC,EAAE,IAAI,CAC3I,CAAC;QACF,IAAI,MAAM,CAAC,QAAQ;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACnE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAChC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QAC9C,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Diagnostic } from "@meltemi/diagrams-language";
|
|
2
|
+
import { type CatalogBuild, type ProjectSessions } from "@meltemi/diagrams-editor/node";
|
|
3
|
+
import { type Workspace } from "@meltemi/diagrams-project";
|
|
4
|
+
export interface PreviewOptions {
|
|
5
|
+
/** The project folder, or a file whose diagrams open first. */
|
|
6
|
+
readonly target: string;
|
|
7
|
+
readonly isFolder: boolean;
|
|
8
|
+
/** 0 picks a free port. */
|
|
9
|
+
readonly port: number;
|
|
10
|
+
readonly projects: () => ProjectSessions;
|
|
11
|
+
readonly generator: string;
|
|
12
|
+
readonly script: () => string;
|
|
13
|
+
/** Each build's diagnostics and what was skipped, for the terminal. */
|
|
14
|
+
readonly report: (build: CatalogBuild, workspace: Workspace) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface PreviewServer {
|
|
17
|
+
/** The address to open, with the route of the file's first diagram for a file. */
|
|
18
|
+
readonly url: string;
|
|
19
|
+
/** How many times the catalog was built. */
|
|
20
|
+
readonly builds: number;
|
|
21
|
+
/** Builds again and tells the open pages to reload. */
|
|
22
|
+
rebuild(changed?: readonly string[]): void;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Serves the catalog of a project on the loopback interface and builds it again when its files
|
|
27
|
+
* change; open pages reload where they were (decision 0028). Only requests addressed to this
|
|
28
|
+
* machine's names are answered.
|
|
29
|
+
*/
|
|
30
|
+
export declare function startPreview(options: PreviewOptions): Promise<PreviewServer>;
|
|
31
|
+
/**
|
|
32
|
+
* Opens a URL in the default browser, the way `login` does (`open-url.ts`): the address is one
|
|
33
|
+
* argument of the opener and no shell reads it, so a `&` or a quote in it means nothing (`cmd /c
|
|
34
|
+
* start` ended the command at the first `&`). The preview prints its address first, so an opener
|
|
35
|
+
* that cannot start is not an error here. `open` is replaceable for tests.
|
|
36
|
+
*/
|
|
37
|
+
export declare function openInBrowser(url: string, open?: (url: string) => Promise<void>): void;
|
|
38
|
+
/** Prints the diagnostics of a build as the other commands do. */
|
|
39
|
+
export declare function previewReport(print: (path: string, diagnostics: readonly Diagnostic[]) => void, stdout: (text: string) => void, display: (path: string) => string): (build: CatalogBuild) => void;
|
|
40
|
+
/** What the preview command needs from the CLI. */
|
|
41
|
+
export interface PreviewContext {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly stdout: (text: string) => void;
|
|
44
|
+
readonly stderr: (text: string) => void;
|
|
45
|
+
readonly cwd: string;
|
|
46
|
+
readonly display: (path: string) => string;
|
|
47
|
+
readonly projects: () => ProjectSessions;
|
|
48
|
+
readonly generator: string;
|
|
49
|
+
readonly script: () => string;
|
|
50
|
+
readonly printDiagnostics: (path: string, diagnostics: readonly Diagnostic[]) => void;
|
|
51
|
+
}
|
|
52
|
+
/** `meltemi-diagrams preview`: runs until stopped; usage errors return 2 at once. */
|
|
53
|
+
export declare function previewCommand(args: readonly string[], context: PreviewContext): number;
|
|
54
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAIpF,MAAM,WAAW,cAAc;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,eAAe,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CACtE;AAED,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,QAAQ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