@picked/cli 0.0.107-next.3 → 0.0.107-next.4
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/dist/.tsbuildinfo +1 -1
- package/dist/cjs/cli.js +3 -2
- package/dist/cjs/index.js +1 -1
- package/dist/esm/cli.js +50 -42
- package/dist/esm/index.js +1 -1
- package/dist/types/commands/pull.d.ts +19 -0
- package/dist/types/commands/pull.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/{workspace-use-Bmm7xoJ3.js → workspace-use-BlhQXU7t.js} +291 -252
- package/dist/workspace-use-CBVbT-DN.cjs +53 -0
- package/package.json +5 -5
- package/dist/workspace-use-CylqHKq0.cjs +0 -53
package/dist/cjs/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require("../workspace-use-
|
|
2
|
+
const e=require("../workspace-use-CBVbT-DN.cjs");let t=require("@picked/config"),n=require("node:util"),r=require("@picked/telemetry");var i=2e3,a=null,o=0;function s(e){if((0,t.isTelemetryForcedOffByEnvironment)())return;o=Date.now();let n=(0,t.detectHostEnvironment)();a={name:`picked.cli.${e}`,traceId:(0,r.createTraceId)(),spanId:(0,r.createSpanId)(),startTimeUnixNano:(0,r.toUnixNano)(o),endTimeUnixNano:(0,r.toUnixNano)(o),attributes:{"picked.cli.command":e,"picked.env.provider":n.provider,"picked.env.ci":n.ci},status:`unset`}}function c(e){a&&(a.endTimeUnixNano=(0,r.toUnixNano)(Date.now()),a.status=e===0?`ok`:`error`)}async function l(){let e=a;if(a=null,e)try{let n=await(0,t.loadResolvedPickedConfig)();if(!n||!(0,t.isTelemetryEnabled)(n))return;let a=(0,r.createTelemetryEmitter)({resource:{"service.name":`picked-cli`},headers:{"Picked-Telemetry":`cli`}});a.record(e),await Promise.race([a.flush(),new Promise(e=>{setTimeout(e,i).unref()})])}catch{}}var u=`Usage:
|
|
3
3
|
picked login
|
|
4
4
|
picked logout
|
|
5
5
|
picked whoami
|
|
@@ -10,5 +10,6 @@ const e=require("../workspace-use-CylqHKq0.cjs");let t=require("@picked/config")
|
|
|
10
10
|
picked workspace export --project <id> (--workspace <id> | --live) --out <dir>
|
|
11
11
|
picked workspace import --project <id> --in <dir> [--name <name>] [--publish]
|
|
12
12
|
picked generate types [--check]
|
|
13
|
+
picked pull [--check] [--allow-preview]
|
|
13
14
|
picked docs list [words] [--type <type>] [--json]
|
|
14
|
-
picked docs read <path>`,d=new Map([[`login`,()=>e.
|
|
15
|
+
picked docs read <path>`,d=new Map([[`login`,()=>e.l({})],[`logout`,()=>e.c()],[`whoami`,()=>e.a()],[`status`,()=>e.o({})],[`pull`,t=>e.s({check:t.check,allowPreview:t[`allow-preview`]})]]);async function f(){let{positionals:t,values:r}=(0,n.parseArgs)({allowPositionals:!0,options:{check:{type:`boolean`,default:!1},project:{type:`string`},workspace:{type:`string`},json:{type:`boolean`,default:!1},generate:{type:`boolean`,default:!0},"no-generate":{type:`boolean`,default:!1},live:{type:`boolean`,default:!1},out:{type:`string`},in:{type:`string`},name:{type:`string`},publish:{type:`boolean`,default:!1},type:{type:`string`},"allow-preview":{type:`boolean`,default:!1}}}),[i,a]=t,o=r.generate&&!r[`no-generate`],c=i===void 0?void 0:d.get(i);i!==void 0&&c?(s(i),process.exitCode=await c(r)):i===`workspace`&&(a===`list`||a===`ls`)?(s(`workspace list`),process.exitCode=await e.n({json:r.json})):i===`workspace`&&a===`use`||i===`use`?(s(`workspace use`),process.exitCode=await e.t({project:r.project,workspace:r.workspace,generate:o})):i===`workspace`&&a===`export`?(s(`workspace export`),process.exitCode=await e.i({project:r.project,workspace:r.workspace,live:r.live,out:r.out})):i===`workspace`&&a===`import`?(s(`workspace import`),process.exitCode=await e.r({project:r.project,in:r.in,name:r.name,publish:r.publish})):i===`docs`?(s(e.d(a)),process.exitCode=await e.f({args:t.slice(1),type:r.type,json:r.json})):i===`generate`&&a===`types`?(s(`generate types`),process.exitCode=await e.u({check:r.check})):(s(`unknown`),console.error(u),process.exitCode=1)}function p(e){let t=2,n=()=>{--t,t<=0&&process.exit(e)};setTimeout(()=>{process.exit(e)},2e3).unref(),process.stdout.write(``,n),process.stderr.write(``,n)}f().then(async()=>{let e=typeof process.exitCode==`number`?process.exitCode:0;c(e),await l(),p(e)}).catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(t),c(1),l().finally(()=>{p(1)})});
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../workspace-use-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../workspace-use-CBVbT-DN.cjs");exports.runDocs=e.f,exports.runDocsList=e.p,exports.runDocsRead=e.m,exports.runGenerateTypes=e.u,exports.runLogin=e.l,exports.runLogout=e.c,exports.runPull=e.s,exports.runStatus=e.o,exports.runWhoami=e.a,exports.runWorkspaceExport=e.i,exports.runWorkspaceImport=e.r,exports.runWorkspaceList=e.n,exports.runWorkspaceUse=e.t;
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as e, c as t, d as n,
|
|
3
|
-
import { detectHostEnvironment as
|
|
4
|
-
import { parseArgs as
|
|
5
|
-
import { createSpanId as
|
|
2
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../workspace-use-BlhQXU7t.js";
|
|
3
|
+
import { detectHostEnvironment as f, isTelemetryEnabled as p, isTelemetryForcedOffByEnvironment as m, loadResolvedPickedConfig as h } from "@picked/config";
|
|
4
|
+
import { parseArgs as g } from "node:util";
|
|
5
|
+
import { createSpanId as _, createTelemetryEmitter as v, createTraceId as y, toUnixNano as b } from "@picked/telemetry";
|
|
6
6
|
//#region src/telemetry.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
let t =
|
|
12
|
-
|
|
7
|
+
var x = 2e3, S = null, C = 0;
|
|
8
|
+
function w(e) {
|
|
9
|
+
if (m()) return;
|
|
10
|
+
C = Date.now();
|
|
11
|
+
let t = f();
|
|
12
|
+
S = {
|
|
13
13
|
name: `picked.cli.${e}`,
|
|
14
|
-
traceId:
|
|
15
|
-
spanId:
|
|
16
|
-
startTimeUnixNano:
|
|
17
|
-
endTimeUnixNano:
|
|
14
|
+
traceId: y(),
|
|
15
|
+
spanId: _(),
|
|
16
|
+
startTimeUnixNano: b(C),
|
|
17
|
+
endTimeUnixNano: b(C),
|
|
18
18
|
attributes: {
|
|
19
19
|
"picked.cli.command": e,
|
|
20
20
|
"picked.env.provider": t.provider,
|
|
@@ -23,33 +23,37 @@ function C(e) {
|
|
|
23
23
|
status: "unset"
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
function T(e) {
|
|
27
|
+
S && (S.endTimeUnixNano = b(Date.now()), S.status = e === 0 ? "ok" : "error");
|
|
28
28
|
}
|
|
29
|
-
async function
|
|
30
|
-
let e =
|
|
31
|
-
if (
|
|
32
|
-
let t = await
|
|
33
|
-
if (!t || !
|
|
34
|
-
let n =
|
|
29
|
+
async function E() {
|
|
30
|
+
let e = S;
|
|
31
|
+
if (S = null, e) try {
|
|
32
|
+
let t = await h();
|
|
33
|
+
if (!t || !p(t)) return;
|
|
34
|
+
let n = v({
|
|
35
35
|
resource: { "service.name": "picked-cli" },
|
|
36
36
|
headers: { "Picked-Telemetry": "cli" }
|
|
37
37
|
});
|
|
38
38
|
n.record(e), await Promise.race([n.flush(), new Promise((e) => {
|
|
39
|
-
setTimeout(e,
|
|
39
|
+
setTimeout(e, x).unref();
|
|
40
40
|
})]);
|
|
41
41
|
} catch {}
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/cli.ts
|
|
45
|
-
var
|
|
46
|
-
["login", () =>
|
|
47
|
-
["logout", () =>
|
|
45
|
+
var D = "Usage:\n picked login\n picked logout\n picked whoami\n picked status\n picked workspace list [--json]\n picked workspace use [--project <id>] [--workspace <id>] [--no-generate]\n picked use [--project <id>] [--workspace <id>] [--no-generate]\n picked workspace export --project <id> (--workspace <id> | --live) --out <dir>\n picked workspace import --project <id> --in <dir> [--name <name>] [--publish]\n picked generate types [--check]\n picked pull [--check] [--allow-preview]\n picked docs list [words] [--type <type>] [--json]\n picked docs read <path>", O = /* @__PURE__ */ new Map([
|
|
46
|
+
["login", () => a({})],
|
|
47
|
+
["logout", () => t()],
|
|
48
48
|
["whoami", () => e()],
|
|
49
|
-
["status", () =>
|
|
49
|
+
["status", () => s({})],
|
|
50
|
+
["pull", (e) => l({
|
|
51
|
+
check: e.check,
|
|
52
|
+
allowPreview: e["allow-preview"]
|
|
53
|
+
})]
|
|
50
54
|
]);
|
|
51
|
-
async function
|
|
52
|
-
let { positionals: e, values: t } =
|
|
55
|
+
async function k() {
|
|
56
|
+
let { positionals: e, values: t } = g({
|
|
53
57
|
allowPositionals: !0,
|
|
54
58
|
options: {
|
|
55
59
|
check: {
|
|
@@ -81,30 +85,34 @@ async function O() {
|
|
|
81
85
|
type: "boolean",
|
|
82
86
|
default: !1
|
|
83
87
|
},
|
|
84
|
-
type: { type: "string" }
|
|
88
|
+
type: { type: "string" },
|
|
89
|
+
"allow-preview": {
|
|
90
|
+
type: "boolean",
|
|
91
|
+
default: !1
|
|
92
|
+
}
|
|
85
93
|
}
|
|
86
|
-
}), [
|
|
87
|
-
|
|
94
|
+
}), [a, s] = e, l = t.generate && !t["no-generate"], f = a === void 0 ? void 0 : O.get(a);
|
|
95
|
+
a !== void 0 && f ? (w(a), process.exitCode = await f(t)) : a === "workspace" && (s === "list" || s === "ls") ? (w("workspace list"), process.exitCode = await o({ json: t.json })) : a === "workspace" && s === "use" || a === "use" ? (w("workspace use"), process.exitCode = await u({
|
|
88
96
|
project: t.project,
|
|
89
97
|
workspace: t.workspace,
|
|
90
|
-
generate:
|
|
91
|
-
})) :
|
|
98
|
+
generate: l
|
|
99
|
+
})) : a === "workspace" && s === "export" ? (w("workspace export"), process.exitCode = await i({
|
|
92
100
|
project: t.project,
|
|
93
101
|
workspace: t.workspace,
|
|
94
102
|
live: t.live,
|
|
95
103
|
out: t.out
|
|
96
|
-
})) :
|
|
104
|
+
})) : a === "workspace" && s === "import" ? (w("workspace import"), process.exitCode = await c({
|
|
97
105
|
project: t.project,
|
|
98
106
|
in: t.in,
|
|
99
107
|
name: t.name,
|
|
100
108
|
publish: t.publish
|
|
101
|
-
})) :
|
|
109
|
+
})) : a === "docs" ? (w(n(s)), process.exitCode = await r({
|
|
102
110
|
args: e.slice(1),
|
|
103
111
|
type: t.type,
|
|
104
112
|
json: t.json
|
|
105
|
-
})) :
|
|
113
|
+
})) : a === "generate" && s === "types" ? (w("generate types"), process.exitCode = await d({ check: t.check })) : (w("unknown"), console.error(D), process.exitCode = 1);
|
|
106
114
|
}
|
|
107
|
-
function
|
|
115
|
+
function A(e) {
|
|
108
116
|
let t = 2, n = () => {
|
|
109
117
|
--t, t <= 0 && process.exit(e);
|
|
110
118
|
};
|
|
@@ -112,13 +120,13 @@ function k(e) {
|
|
|
112
120
|
process.exit(e);
|
|
113
121
|
}, 2e3).unref(), process.stdout.write("", n), process.stderr.write("", n);
|
|
114
122
|
}
|
|
115
|
-
|
|
123
|
+
k().then(async () => {
|
|
116
124
|
let e = typeof process.exitCode == "number" ? process.exitCode : 0;
|
|
117
|
-
|
|
125
|
+
T(e), await E(), A(e);
|
|
118
126
|
}).catch((e) => {
|
|
119
127
|
let t = e instanceof Error ? e.message : String(e);
|
|
120
|
-
console.error(t),
|
|
121
|
-
|
|
128
|
+
console.error(t), T(1), E().finally(() => {
|
|
129
|
+
A(1);
|
|
122
130
|
});
|
|
123
131
|
});
|
|
124
132
|
//#endregion
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { f as runDocs, p as runDocsList, m as runDocsRead, u as runGenerateTypes, l as runLogin, c as runLogout, s as runPull, o as runStatus, a as runWhoami, i as runWorkspaceExport, r as runWorkspaceImport, n as runWorkspaceList, t as runWorkspaceUse } from "../workspace-use-BlhQXU7t.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked pull`: fetches the workspace schema, project config and CMS content of the
|
|
3
|
+
* project in force and writes them to `picked.snapshot.json`, which `data: 'snapshot'` builds
|
|
4
|
+
* from. With `check`, compares instead and writes nothing.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} [options] - Command options.
|
|
7
|
+
* @param {boolean} [options.check] - Compare with the committed snapshot instead of writing.
|
|
8
|
+
* @param {boolean} [options.allowPreview] - Pull a preview source, which holds unpublished content.
|
|
9
|
+
* @param {string} [options.cwd] - Working directory containing `picked.config`.
|
|
10
|
+
* @returns {Promise<number>} Process exit code.
|
|
11
|
+
* @example
|
|
12
|
+
* await runPull({ check: true })
|
|
13
|
+
*/
|
|
14
|
+
export declare function runPull(options?: {
|
|
15
|
+
check?: boolean;
|
|
16
|
+
allowPreview?: boolean;
|
|
17
|
+
cwd?: string;
|
|
18
|
+
}): Promise<number>;
|
|
19
|
+
//# sourceMappingURL=pull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/pull.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAAC,OAAO,CAAC,EAAE;IACtC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDlB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { runDocs, runDocsList, runDocsRead } from './commands/docs';
|
|
|
3
3
|
export { runGenerateTypes } from './commands/generate-types';
|
|
4
4
|
export { runLogin } from './commands/login';
|
|
5
5
|
export { runLogout } from './commands/logout';
|
|
6
|
+
export { runPull } from './commands/pull';
|
|
6
7
|
export { runStatus } from './commands/status';
|
|
7
8
|
export { runWhoami } from './commands/whoami';
|
|
8
9
|
export { runWorkspaceExport } from './commands/workspace-export';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
|