@plasmicapp/cli 0.1.299 → 0.1.301
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/actions/info.d.ts +2 -0
- package/dist/index.js +33 -11
- package/dist/lib.js +12 -4
- package/dist/utils/get-context.d.ts +2 -1
- package/package.json +2 -2
- package/src/actions/info.ts +14 -6
- package/src/index.ts +17 -6
- package/src/utils/auth-utils.ts +6 -1
- package/src/utils/get-context.ts +9 -5
package/dist/actions/info.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -736636,7 +736636,10 @@ async function startAuth(opts) {
|
|
|
736636
736636
|
let prompt;
|
|
736637
736637
|
const initToken = v4_default();
|
|
736638
736638
|
const url = `${opts.host}/auth/plasmic-init/${initToken}`;
|
|
736639
|
-
(0, import_open.default)(url)
|
|
736639
|
+
(0, import_open.default)(url).then((subprocess) => {
|
|
736640
|
+
subprocess.on("error", () => {
|
|
736641
|
+
});
|
|
736642
|
+
});
|
|
736640
736643
|
logger.info(
|
|
736641
736644
|
`
|
|
736642
736645
|
If your browser doesn't automatically open, enter the following URL:
|
|
@@ -737716,7 +737719,10 @@ async function resolveMissingFilesInConfig(context, config) {
|
|
|
737716
737719
|
project.components = newComponents;
|
|
737717
737720
|
}
|
|
737718
737721
|
}
|
|
737719
|
-
async function getContext(args, {
|
|
737722
|
+
async function getContext(args, {
|
|
737723
|
+
enableSkipAuth = false,
|
|
737724
|
+
skipMissingFiles = false
|
|
737725
|
+
} = {}) {
|
|
737720
737726
|
if (!args.baseDir)
|
|
737721
737727
|
args.baseDir = process.cwd();
|
|
737722
737728
|
const auth2 = enableSkipAuth ? await getCurrentOrDefaultAuth(args) : await getOrInitAuth(args);
|
|
@@ -737760,8 +737766,10 @@ async function getContext(args, { enableSkipAuth = false } = {}) {
|
|
|
737760
737766
|
api: new PlasmicApi(auth2),
|
|
737761
737767
|
cliArgs: args
|
|
737762
737768
|
};
|
|
737763
|
-
|
|
737764
|
-
|
|
737769
|
+
if (!skipMissingFiles) {
|
|
737770
|
+
await resolveMissingFilesInConfig(context, config);
|
|
737771
|
+
removeMissingFilesFromLock(context, config, lock);
|
|
737772
|
+
}
|
|
737765
737773
|
return context;
|
|
737766
737774
|
}
|
|
737767
737775
|
async function getCurrentOrDefaultAuth(args) {
|
|
@@ -737828,15 +737836,21 @@ async function fixImports(opts) {
|
|
|
737828
737836
|
// src/actions/info.ts
|
|
737829
737837
|
async function printProjectInfo(opts) {
|
|
737830
737838
|
var _a, _b;
|
|
737831
|
-
let context = await getContext(opts);
|
|
737839
|
+
let context = await getContext(opts, { skipMissingFiles: true });
|
|
737832
737840
|
const results = await Promise.all(
|
|
737833
737841
|
opts.projects.map(async (p) => await context.api.projectMeta(p))
|
|
737834
737842
|
);
|
|
737835
|
-
|
|
737836
|
-
logger.info(
|
|
737837
|
-
|
|
737838
|
-
|
|
737839
|
-
|
|
737843
|
+
if (opts.json) {
|
|
737844
|
+
logger.info(JSON.stringify(results, null, 2));
|
|
737845
|
+
} else {
|
|
737846
|
+
for (const meta of results) {
|
|
737847
|
+
logger.info(`Id: ${meta.id}`);
|
|
737848
|
+
logger.info(`Name: ${meta.name}`);
|
|
737849
|
+
logger.info(`Host URL: ${(_a = meta.hostUrl) != null ? _a : null}`);
|
|
737850
|
+
logger.info(
|
|
737851
|
+
`Last published version: ${(_b = meta.lastPublishedVersion) != null ? _b : null}`
|
|
737852
|
+
);
|
|
737853
|
+
}
|
|
737840
737854
|
}
|
|
737841
737855
|
}
|
|
737842
737856
|
|
|
@@ -739611,11 +739625,19 @@ import_yargs.default.usage("Usage: $0 <command> [options]").option("auth", {
|
|
|
739611
739625
|
).command(
|
|
739612
739626
|
"info",
|
|
739613
739627
|
"Fetches metadata for projects",
|
|
739614
|
-
(yags) => yags.option("
|
|
739628
|
+
(yags) => yags.option("host", {
|
|
739629
|
+
describe: "Plasmic host to use",
|
|
739630
|
+
type: "string",
|
|
739631
|
+
default: "https://studio.plasmic.app"
|
|
739632
|
+
}).option("projects", {
|
|
739615
739633
|
alias: "p",
|
|
739616
739634
|
describe: "ID of plasmic project to check",
|
|
739617
739635
|
type: "array",
|
|
739618
739636
|
default: []
|
|
739637
|
+
}).option("json", {
|
|
739638
|
+
describe: "Output full info, not just summary, in JSON format",
|
|
739639
|
+
type: "boolean",
|
|
739640
|
+
default: false
|
|
739619
739641
|
}),
|
|
739620
739642
|
(argv) => {
|
|
739621
739643
|
handleError(printProjectInfo(argv));
|
package/dist/lib.js
CHANGED
|
@@ -731976,7 +731976,10 @@ async function startAuth(opts) {
|
|
|
731976
731976
|
let prompt;
|
|
731977
731977
|
const initToken = v4_default();
|
|
731978
731978
|
const url = `${opts.host}/auth/plasmic-init/${initToken}`;
|
|
731979
|
-
(0, import_open.default)(url)
|
|
731979
|
+
(0, import_open.default)(url).then((subprocess) => {
|
|
731980
|
+
subprocess.on("error", () => {
|
|
731981
|
+
});
|
|
731982
|
+
});
|
|
731980
731983
|
logger.info(
|
|
731981
731984
|
`
|
|
731982
731985
|
If your browser doesn't automatically open, enter the following URL:
|
|
@@ -733036,7 +733039,10 @@ async function resolveMissingFilesInConfig(context, config) {
|
|
|
733036
733039
|
project.components = newComponents;
|
|
733037
733040
|
}
|
|
733038
733041
|
}
|
|
733039
|
-
async function getContext(args, {
|
|
733042
|
+
async function getContext(args, {
|
|
733043
|
+
enableSkipAuth = false,
|
|
733044
|
+
skipMissingFiles = false
|
|
733045
|
+
} = {}) {
|
|
733040
733046
|
if (!args.baseDir)
|
|
733041
733047
|
args.baseDir = process.cwd();
|
|
733042
733048
|
const auth2 = enableSkipAuth ? await getCurrentOrDefaultAuth(args) : await getOrInitAuth(args);
|
|
@@ -733080,8 +733086,10 @@ async function getContext(args, { enableSkipAuth = false } = {}) {
|
|
|
733080
733086
|
api: new PlasmicApi(auth2),
|
|
733081
733087
|
cliArgs: args
|
|
733082
733088
|
};
|
|
733083
|
-
|
|
733084
|
-
|
|
733089
|
+
if (!skipMissingFiles) {
|
|
733090
|
+
await resolveMissingFilesInConfig(context, config);
|
|
733091
|
+
removeMissingFilesFromLock(context, config, lock);
|
|
733092
|
+
}
|
|
733085
733093
|
return context;
|
|
733086
733094
|
}
|
|
733087
733095
|
async function getCurrentOrDefaultAuth(args) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CommonArgs } from "../index";
|
|
2
2
|
import { PlasmicContext, PlasmicLock } from "./config-utils";
|
|
3
3
|
export declare function readLock(lockFile: string): PlasmicLock;
|
|
4
|
-
export declare function getContext(args: CommonArgs, { enableSkipAuth }?: {
|
|
4
|
+
export declare function getContext(args: CommonArgs, { enableSkipAuth, skipMissingFiles, }?: {
|
|
5
5
|
enableSkipAuth?: boolean;
|
|
6
|
+
skipMissingFiles?: boolean;
|
|
6
7
|
}): Promise<PlasmicContext>;
|
|
7
8
|
/**
|
|
8
9
|
* Table of where this metadata will be set
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.301",
|
|
4
4
|
"description": "plasmic cli for syncing local code with Plasmic designs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"wrap-ansi": "^7.0.0",
|
|
79
79
|
"yargs": "^15.4.1"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "eb28b8015d98fcffb97ed126463f35476a2ecf13"
|
|
82
82
|
}
|
package/src/actions/info.ts
CHANGED
|
@@ -4,17 +4,25 @@ import { getContext } from "../utils/get-context";
|
|
|
4
4
|
|
|
5
5
|
export interface InfoArgs extends CommonArgs {
|
|
6
6
|
projects: readonly string[];
|
|
7
|
+
json?: boolean;
|
|
8
|
+
host?: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export async function printProjectInfo(opts: InfoArgs): Promise<void> {
|
|
10
|
-
let context = await getContext(opts);
|
|
12
|
+
let context = await getContext(opts, { skipMissingFiles: true });
|
|
11
13
|
const results = await Promise.all(
|
|
12
14
|
opts.projects.map(async (p) => await context.api.projectMeta(p))
|
|
13
15
|
);
|
|
14
|
-
|
|
15
|
-
logger.info(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
if (opts.json) {
|
|
17
|
+
logger.info(JSON.stringify(results, null, 2));
|
|
18
|
+
} else {
|
|
19
|
+
for (const meta of results) {
|
|
20
|
+
logger.info(`Id: ${meta.id}`);
|
|
21
|
+
logger.info(`Name: ${meta.name}`);
|
|
22
|
+
logger.info(`Host URL: ${meta.hostUrl ?? null}`);
|
|
23
|
+
logger.info(
|
|
24
|
+
`Last published version: ${meta.lastPublishedVersion ?? null}`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -148,12 +148,23 @@ yargs
|
|
|
148
148
|
"info",
|
|
149
149
|
"Fetches metadata for projects",
|
|
150
150
|
(yags) =>
|
|
151
|
-
yags
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
yags
|
|
152
|
+
.option("host", {
|
|
153
|
+
describe: "Plasmic host to use",
|
|
154
|
+
type: "string",
|
|
155
|
+
default: "https://studio.plasmic.app",
|
|
156
|
+
})
|
|
157
|
+
.option("projects", {
|
|
158
|
+
alias: "p",
|
|
159
|
+
describe: "ID of plasmic project to check",
|
|
160
|
+
type: "array",
|
|
161
|
+
default: [],
|
|
162
|
+
})
|
|
163
|
+
.option("json", {
|
|
164
|
+
describe: "Output full info, not just summary, in JSON format",
|
|
165
|
+
type: "boolean",
|
|
166
|
+
default: false,
|
|
167
|
+
}),
|
|
157
168
|
(argv) => {
|
|
158
169
|
handleError(printProjectInfo(argv));
|
|
159
170
|
}
|
package/src/utils/auth-utils.ts
CHANGED
|
@@ -102,7 +102,12 @@ export async function startAuth(opts: Partial<CommonArgs> & { host: string }) {
|
|
|
102
102
|
|
|
103
103
|
const initToken = uuidv4();
|
|
104
104
|
const url = `${opts.host}/auth/plasmic-init/${initToken}`;
|
|
105
|
-
open(url)
|
|
105
|
+
open(url).then((subprocess) => {
|
|
106
|
+
subprocess.on("error", () => {
|
|
107
|
+
// Browser failed to start. This needs to be handled to avoid
|
|
108
|
+
// crashing the CLI.
|
|
109
|
+
});
|
|
110
|
+
});
|
|
106
111
|
logger.info(
|
|
107
112
|
`\nIf your browser doesn't automatically open, enter the following URL:\n${url}\n`
|
|
108
113
|
);
|
package/src/utils/get-context.ts
CHANGED
|
@@ -286,7 +286,10 @@ async function resolveMissingFilesInConfig(
|
|
|
286
286
|
|
|
287
287
|
export async function getContext(
|
|
288
288
|
args: CommonArgs,
|
|
289
|
-
{
|
|
289
|
+
{
|
|
290
|
+
enableSkipAuth = false,
|
|
291
|
+
skipMissingFiles = false,
|
|
292
|
+
}: { enableSkipAuth?: boolean; skipMissingFiles?: boolean } = {}
|
|
290
293
|
): Promise<PlasmicContext> {
|
|
291
294
|
if (!args.baseDir) args.baseDir = process.cwd();
|
|
292
295
|
const auth = enableSkipAuth
|
|
@@ -297,8 +300,7 @@ export async function getContext(
|
|
|
297
300
|
if (auth.host.startsWith(DEFAULT_HOST)) {
|
|
298
301
|
// Production usage of cli
|
|
299
302
|
Sentry.init({
|
|
300
|
-
dsn:
|
|
301
|
-
"https://3ed4eb43d28646e381bf3c50cff24bd6@o328029.ingest.sentry.io/5285892",
|
|
303
|
+
dsn: "https://3ed4eb43d28646e381bf3c50cff24bd6@o328029.ingest.sentry.io/5285892",
|
|
302
304
|
});
|
|
303
305
|
Sentry.configureScope((scope) => {
|
|
304
306
|
if (auth.user) {
|
|
@@ -348,8 +350,10 @@ export async function getContext(
|
|
|
348
350
|
cliArgs: args,
|
|
349
351
|
};
|
|
350
352
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
+
if (!skipMissingFiles) {
|
|
354
|
+
await resolveMissingFilesInConfig(context, config);
|
|
355
|
+
removeMissingFilesFromLock(context, config, lock);
|
|
356
|
+
}
|
|
353
357
|
|
|
354
358
|
return context;
|
|
355
359
|
}
|