@plasmicapp/cli 0.1.299 → 0.1.300

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.
@@ -1,5 +1,7 @@
1
1
  import { CommonArgs } from "..";
2
2
  export interface InfoArgs extends CommonArgs {
3
3
  projects: readonly string[];
4
+ json?: boolean;
5
+ host?: string;
4
6
  }
5
7
  export declare function printProjectInfo(opts: InfoArgs): Promise<void>;
package/dist/index.js CHANGED
@@ -737716,7 +737716,10 @@ async function resolveMissingFilesInConfig(context, config) {
737716
737716
  project.components = newComponents;
737717
737717
  }
737718
737718
  }
737719
- async function getContext(args, { enableSkipAuth = false } = {}) {
737719
+ async function getContext(args, {
737720
+ enableSkipAuth = false,
737721
+ skipMissingFiles = false
737722
+ } = {}) {
737720
737723
  if (!args.baseDir)
737721
737724
  args.baseDir = process.cwd();
737722
737725
  const auth2 = enableSkipAuth ? await getCurrentOrDefaultAuth(args) : await getOrInitAuth(args);
@@ -737760,8 +737763,10 @@ async function getContext(args, { enableSkipAuth = false } = {}) {
737760
737763
  api: new PlasmicApi(auth2),
737761
737764
  cliArgs: args
737762
737765
  };
737763
- await resolveMissingFilesInConfig(context, config);
737764
- removeMissingFilesFromLock(context, config, lock);
737766
+ if (!skipMissingFiles) {
737767
+ await resolveMissingFilesInConfig(context, config);
737768
+ removeMissingFilesFromLock(context, config, lock);
737769
+ }
737765
737770
  return context;
737766
737771
  }
737767
737772
  async function getCurrentOrDefaultAuth(args) {
@@ -737828,15 +737833,21 @@ async function fixImports(opts) {
737828
737833
  // src/actions/info.ts
737829
737834
  async function printProjectInfo(opts) {
737830
737835
  var _a, _b;
737831
- let context = await getContext(opts);
737836
+ let context = await getContext(opts, { skipMissingFiles: true });
737832
737837
  const results = await Promise.all(
737833
737838
  opts.projects.map(async (p) => await context.api.projectMeta(p))
737834
737839
  );
737835
- for (const meta of results) {
737836
- logger.info(`Id: ${meta.id}`);
737837
- logger.info(`Name: ${meta.name}`);
737838
- logger.info(`Host URL: ${(_a = meta.hostUrl) != null ? _a : null}`);
737839
- logger.info(`Last published version: ${(_b = meta.lastPublishedVersion) != null ? _b : null}`);
737840
+ if (opts.json) {
737841
+ logger.info(JSON.stringify(results, null, 2));
737842
+ } else {
737843
+ for (const meta of results) {
737844
+ logger.info(`Id: ${meta.id}`);
737845
+ logger.info(`Name: ${meta.name}`);
737846
+ logger.info(`Host URL: ${(_a = meta.hostUrl) != null ? _a : null}`);
737847
+ logger.info(
737848
+ `Last published version: ${(_b = meta.lastPublishedVersion) != null ? _b : null}`
737849
+ );
737850
+ }
737840
737851
  }
737841
737852
  }
737842
737853
 
@@ -739611,11 +739622,19 @@ import_yargs.default.usage("Usage: $0 <command> [options]").option("auth", {
739611
739622
  ).command(
739612
739623
  "info",
739613
739624
  "Fetches metadata for projects",
739614
- (yags) => yags.option("projects", {
739625
+ (yags) => yags.option("host", {
739626
+ describe: "Plasmic host to use",
739627
+ type: "string",
739628
+ default: "https://studio.plasmic.app"
739629
+ }).option("projects", {
739615
739630
  alias: "p",
739616
739631
  describe: "ID of plasmic project to check",
739617
739632
  type: "array",
739618
739633
  default: []
739634
+ }).option("json", {
739635
+ describe: "Output full info, not just summary, in JSON format",
739636
+ type: "boolean",
739637
+ default: false
739619
739638
  }),
739620
739639
  (argv) => {
739621
739640
  handleError(printProjectInfo(argv));
package/dist/lib.js CHANGED
@@ -733036,7 +733036,10 @@ async function resolveMissingFilesInConfig(context, config) {
733036
733036
  project.components = newComponents;
733037
733037
  }
733038
733038
  }
733039
- async function getContext(args, { enableSkipAuth = false } = {}) {
733039
+ async function getContext(args, {
733040
+ enableSkipAuth = false,
733041
+ skipMissingFiles = false
733042
+ } = {}) {
733040
733043
  if (!args.baseDir)
733041
733044
  args.baseDir = process.cwd();
733042
733045
  const auth2 = enableSkipAuth ? await getCurrentOrDefaultAuth(args) : await getOrInitAuth(args);
@@ -733080,8 +733083,10 @@ async function getContext(args, { enableSkipAuth = false } = {}) {
733080
733083
  api: new PlasmicApi(auth2),
733081
733084
  cliArgs: args
733082
733085
  };
733083
- await resolveMissingFilesInConfig(context, config);
733084
- removeMissingFilesFromLock(context, config, lock);
733086
+ if (!skipMissingFiles) {
733087
+ await resolveMissingFilesInConfig(context, config);
733088
+ removeMissingFilesFromLock(context, config, lock);
733089
+ }
733085
733090
  return context;
733086
733091
  }
733087
733092
  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.299",
3
+ "version": "0.1.300",
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": "0397c260539c989f56c919436e57c48f1ad7a398"
81
+ "gitHead": "d77514328c5ed3df3af84ff5c9f35f351fc1c276"
82
82
  }
@@ -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
- for (const meta of results) {
15
- logger.info(`Id: ${meta.id}`);
16
- logger.info(`Name: ${meta.name}`);
17
- logger.info(`Host URL: ${meta.hostUrl ?? null}`);
18
- logger.info(`Last published version: ${meta.lastPublishedVersion ?? null}`);
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.option("projects", {
152
- alias: "p",
153
- describe: "ID of plasmic project to check",
154
- type: "array",
155
- default: [],
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
  }
@@ -286,7 +286,10 @@ async function resolveMissingFilesInConfig(
286
286
 
287
287
  export async function getContext(
288
288
  args: CommonArgs,
289
- { enableSkipAuth = false }: { enableSkipAuth?: boolean } = {}
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
- await resolveMissingFilesInConfig(context, config);
352
- removeMissingFilesFromLock(context, config, lock);
353
+ if (!skipMissingFiles) {
354
+ await resolveMissingFilesInConfig(context, config);
355
+ removeMissingFilesFromLock(context, config, lock);
356
+ }
353
357
 
354
358
  return context;
355
359
  }