@uniformdev/cli 20.22.1-alpha.0 → 20.23.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.
Files changed (2) hide show
  1. package/dist/index.mjs +210 -201
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -2603,128 +2603,131 @@ var ComponentPatternPublishModule = {
2603
2603
  };
2604
2604
 
2605
2605
  // src/commands/canvas/commands/composition/pull.ts
2606
- var CompositionPullModule = {
2607
- command: "pull <directory>",
2608
- describe: "Pulls all compositions to local files in a directory",
2609
- builder: (yargs35) => withConfiguration(
2610
- withApiOptions(
2611
- withProjectOptions(
2612
- withStateOptions(
2613
- withDebugOptions(
2614
- withDiffOptions(
2615
- yargs35.positional("directory", {
2616
- describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2617
- type: "string"
2618
- }).option("format", {
2619
- alias: ["f"],
2620
- describe: "Output format",
2621
- default: "yaml",
2622
- choices: ["yaml", "json"],
2623
- type: "string"
2624
- }).option("onlyCompositions", {
2625
- describe: "Only pulling compositions and not patterns",
2626
- default: false,
2627
- type: "boolean"
2628
- }).option("onlyPatterns", {
2629
- describe: "Only pulling patterns and not compositions",
2630
- default: false,
2631
- type: "boolean",
2632
- hidden: true
2633
- }).option("mode", {
2634
- alias: ["m"],
2635
- describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
2636
- choices: ["create", "createOrUpdate", "mirror"],
2637
- default: "mirror",
2638
- type: "string"
2639
- })
2606
+ var CompositionPullModule = componentInstancePullModuleFactory("compositions");
2607
+ function componentInstancePullModuleFactory(type) {
2608
+ return {
2609
+ command: "pull <directory>",
2610
+ describe: "Pulls all compositions to local files in a directory",
2611
+ builder: (yargs35) => withConfiguration(
2612
+ withApiOptions(
2613
+ withProjectOptions(
2614
+ withStateOptions(
2615
+ withDebugOptions(
2616
+ withDiffOptions(
2617
+ yargs35.positional("directory", {
2618
+ describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2619
+ type: "string"
2620
+ }).option("format", {
2621
+ alias: ["f"],
2622
+ describe: "Output format",
2623
+ default: "yaml",
2624
+ choices: ["yaml", "json"],
2625
+ type: "string"
2626
+ }).option("onlyCompositions", {
2627
+ describe: "Only pulling compositions and not patterns",
2628
+ default: false,
2629
+ type: "boolean"
2630
+ }).option("onlyPatterns", {
2631
+ describe: "Only pulling patterns and not compositions",
2632
+ default: false,
2633
+ type: "boolean",
2634
+ hidden: true
2635
+ }).option("mode", {
2636
+ alias: ["m"],
2637
+ describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
2638
+ choices: ["create", "createOrUpdate", "mirror"],
2639
+ default: "mirror",
2640
+ type: "string"
2641
+ })
2642
+ )
2640
2643
  )
2641
2644
  )
2642
2645
  )
2643
2646
  )
2644
- )
2645
- ),
2646
- handler: async ({
2647
- apiHost,
2648
- apiKey,
2649
- proxy,
2650
- directory,
2651
- format,
2652
- onlyCompositions,
2653
- onlyPatterns,
2654
- patternType = "all",
2655
- mode,
2656
- whatIf,
2657
- state,
2658
- project: projectId,
2659
- diff: diffMode,
2660
- allowEmptySource,
2661
- verbose
2662
- }) => {
2663
- const fetch2 = nodeFetchProxy(proxy, verbose);
2664
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
2665
- const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
2666
- const source = createComponentInstanceEngineDataSource({
2667
- client,
2668
- state,
2647
+ ),
2648
+ handler: async ({
2649
+ apiHost,
2650
+ apiKey,
2651
+ proxy,
2652
+ directory,
2653
+ format,
2669
2654
  onlyCompositions,
2670
2655
  onlyPatterns,
2671
- patternType,
2656
+ patternType = "all",
2657
+ mode,
2658
+ whatIf,
2659
+ state,
2660
+ project: projectId,
2661
+ diff: diffMode,
2662
+ allowEmptySource,
2672
2663
  verbose
2673
- });
2674
- const isPackage = isPathAPackageFile(directory);
2675
- let target;
2676
- if (isPackage) {
2677
- const packageContents = readCanvasPackage(directory, false, verbose);
2678
- target = await createArraySyncEngineDataSource({
2679
- name: `Package file ${directory}`,
2680
- objects: packageContents?.compositions ?? [],
2681
- selectIdentifier: selectIdentifier3,
2682
- selectDisplayName: selectDisplayName3,
2683
- onSyncComplete: async (_, synced) => {
2684
- packageContents.compositions = synced;
2685
- writeCanvasPackage(directory, packageContents);
2686
- }
2687
- });
2688
- } else {
2689
- target = await createFileSyncEngineDataSource({
2690
- directory,
2691
- selectIdentifier: selectIdentifier3,
2692
- selectDisplayName: selectDisplayName3,
2693
- format,
2664
+ }) => {
2665
+ const fetch2 = nodeFetchProxy(proxy, verbose);
2666
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
2667
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
2668
+ const source = createComponentInstanceEngineDataSource({
2669
+ client,
2670
+ state,
2671
+ onlyCompositions,
2672
+ onlyPatterns,
2673
+ patternType,
2694
2674
  verbose
2695
2675
  });
2696
- }
2697
- await syncEngine({
2698
- source,
2699
- target,
2700
- mode,
2701
- whatIf,
2702
- allowEmptySource: allowEmptySource ?? true,
2703
- log: createSyncEngineConsoleLogger({ diffMode }),
2704
- onBeforeCompareObjects: async (sourceObject, targetObject) => {
2705
- return replaceRemoteUrlsWithLocalReferences({
2706
- sourceEntity: sourceObject,
2707
- targetEntity: targetObject,
2708
- directory,
2709
- fileClient
2676
+ const isPackage = isPathAPackageFile(directory);
2677
+ let target;
2678
+ if (isPackage) {
2679
+ const packageContents = readCanvasPackage(directory, false, verbose);
2680
+ target = await createArraySyncEngineDataSource({
2681
+ name: `Package file ${directory}`,
2682
+ objects: packageContents?.[type] ?? [],
2683
+ selectIdentifier: selectIdentifier3,
2684
+ selectDisplayName: selectDisplayName3,
2685
+ onSyncComplete: async (_, synced) => {
2686
+ packageContents[type] = synced;
2687
+ writeCanvasPackage(directory, packageContents);
2688
+ }
2710
2689
  });
2711
- },
2712
- compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
2713
- onBeforeWriteObject: async (sourceObject) => {
2714
- await downloadFilesForCompositionOrEntry({
2715
- entity: sourceObject.object,
2690
+ } else {
2691
+ target = await createFileSyncEngineDataSource({
2716
2692
  directory,
2717
- fileClient
2693
+ selectIdentifier: selectIdentifier3,
2694
+ selectDisplayName: selectDisplayName3,
2695
+ format,
2696
+ verbose
2718
2697
  });
2719
- return sourceObject;
2720
2698
  }
2721
- });
2722
- }
2723
- };
2699
+ await syncEngine({
2700
+ source,
2701
+ target,
2702
+ mode,
2703
+ whatIf,
2704
+ allowEmptySource: allowEmptySource ?? true,
2705
+ log: createSyncEngineConsoleLogger({ diffMode }),
2706
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
2707
+ return replaceRemoteUrlsWithLocalReferences({
2708
+ sourceEntity: sourceObject,
2709
+ targetEntity: targetObject,
2710
+ directory,
2711
+ fileClient
2712
+ });
2713
+ },
2714
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
2715
+ onBeforeWriteObject: async (sourceObject) => {
2716
+ await downloadFilesForCompositionOrEntry({
2717
+ entity: sourceObject.object,
2718
+ directory,
2719
+ fileClient
2720
+ });
2721
+ return sourceObject;
2722
+ }
2723
+ });
2724
+ }
2725
+ };
2726
+ }
2724
2727
 
2725
2728
  // src/commands/canvas/commands/componentPattern/pull.ts
2726
2729
  var ComponentPatternPullModule = {
2727
- ...CompositionPullModule,
2730
+ ...componentInstancePullModuleFactory("componentPatterns"),
2728
2731
  describe: "Pulls all component patterns to local files in a directory",
2729
2732
  builder: (yargs35) => withConfiguration(
2730
2733
  withApiOptions(
@@ -2748,6 +2751,7 @@ var ComponentPatternPullModule = {
2748
2751
  type: "boolean",
2749
2752
  hidden: true
2750
2753
  }).option("patternType", {
2754
+ // This default differentiate this list command from composition list command
2751
2755
  default: "component",
2752
2756
  choices: ["all", "component", "composition"],
2753
2757
  hidden: true
@@ -2772,114 +2776,117 @@ var ComponentPatternPullModule = {
2772
2776
  };
2773
2777
 
2774
2778
  // src/commands/canvas/commands/composition/push.ts
2775
- var CompositionPushModule = {
2776
- command: "push <directory>",
2777
- describe: "Pushes all compositions from files in a directory to Uniform Canvas",
2778
- builder: (yargs35) => withConfiguration(
2779
- withApiOptions(
2780
- withProjectOptions(
2781
- withStateOptions(
2782
- withDebugOptions(
2783
- withDiffOptions(
2784
- yargs35.positional("directory", {
2785
- describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
2786
- type: "string"
2787
- }).option("mode", {
2788
- alias: ["m"],
2789
- describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
2790
- choices: ["create", "createOrUpdate", "mirror"],
2791
- default: "mirror",
2792
- type: "string"
2793
- }).option("onlyCompositions", {
2794
- describe: "Only pulling compositions and not patterns",
2795
- default: false,
2796
- type: "boolean"
2797
- }).option("onlyPatterns", {
2798
- describe: "Only pulling patterns and not compositions",
2799
- default: false,
2800
- type: "boolean",
2801
- hidden: true
2802
- })
2779
+ var CompositionPushModule = componentInstancePushModuleFactory("compositions");
2780
+ function componentInstancePushModuleFactory(type) {
2781
+ return {
2782
+ command: "push <directory>",
2783
+ describe: "Pushes all compositions from files in a directory to Uniform Canvas",
2784
+ builder: (yargs35) => withConfiguration(
2785
+ withApiOptions(
2786
+ withProjectOptions(
2787
+ withStateOptions(
2788
+ withDebugOptions(
2789
+ withDiffOptions(
2790
+ yargs35.positional("directory", {
2791
+ describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
2792
+ type: "string"
2793
+ }).option("mode", {
2794
+ alias: ["m"],
2795
+ describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
2796
+ choices: ["create", "createOrUpdate", "mirror"],
2797
+ default: "mirror",
2798
+ type: "string"
2799
+ }).option("onlyCompositions", {
2800
+ describe: "Only pulling compositions and not patterns",
2801
+ default: false,
2802
+ type: "boolean"
2803
+ }).option("onlyPatterns", {
2804
+ // backwards compatibility
2805
+ default: false,
2806
+ type: "boolean",
2807
+ hidden: true
2808
+ })
2809
+ )
2803
2810
  )
2804
2811
  )
2805
2812
  )
2806
2813
  )
2807
- )
2808
- ),
2809
- handler: async ({
2810
- apiHost,
2811
- apiKey,
2812
- proxy,
2813
- directory,
2814
- mode,
2815
- whatIf,
2816
- state,
2817
- project: projectId,
2818
- onlyCompositions,
2819
- onlyPatterns,
2820
- patternType,
2821
- diff: diffMode,
2822
- allowEmptySource,
2823
- verbose
2824
- }) => {
2825
- const fetch2 = nodeFetchProxy(proxy, verbose);
2826
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
2827
- let source;
2828
- const isPackage = isPathAPackageFile(directory);
2829
- if (isPackage) {
2830
- const packageContents = readCanvasPackage(directory, true, verbose);
2831
- source = await createArraySyncEngineDataSource({
2832
- name: `Package file ${directory}`,
2833
- objects: packageContents.compositions ?? [],
2834
- selectIdentifier: selectIdentifier3,
2835
- selectDisplayName: selectDisplayName3
2836
- });
2837
- } else {
2838
- source = await createFileSyncEngineDataSource({
2839
- directory,
2840
- selectIdentifier: selectIdentifier3,
2841
- selectDisplayName: selectDisplayName3,
2842
- verbose
2843
- });
2844
- }
2845
- const target = createComponentInstanceEngineDataSource({
2846
- client,
2814
+ ),
2815
+ handler: async ({
2816
+ apiHost,
2817
+ apiKey,
2818
+ proxy,
2819
+ directory,
2820
+ mode,
2821
+ whatIf,
2847
2822
  state,
2823
+ project: projectId,
2848
2824
  onlyCompositions,
2849
2825
  onlyPatterns,
2850
2826
  patternType,
2851
- verbose
2852
- });
2853
- const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
2854
- await syncEngine({
2855
- source,
2856
- target,
2857
- mode,
2858
- whatIf,
2859
- verbose,
2827
+ diff: diffMode,
2860
2828
  allowEmptySource,
2861
- log: createSyncEngineConsoleLogger({ diffMode }),
2862
- onBeforeCompareObjects: async (sourceObject) => {
2863
- return replaceLocalUrlsWithRemoteReferences({
2864
- entity: sourceObject,
2865
- fileClient
2829
+ verbose
2830
+ }) => {
2831
+ const fetch2 = nodeFetchProxy(proxy, verbose);
2832
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
2833
+ let source;
2834
+ const isPackage = isPathAPackageFile(directory);
2835
+ if (isPackage) {
2836
+ const packageContents = readCanvasPackage(directory, true, verbose);
2837
+ source = await createArraySyncEngineDataSource({
2838
+ name: `Package file ${directory}`,
2839
+ objects: packageContents[type] ?? [],
2840
+ selectIdentifier: selectIdentifier3,
2841
+ selectDisplayName: selectDisplayName3
2866
2842
  });
2867
- },
2868
- compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
2869
- onBeforeWriteObject: async (sourceObject) => {
2870
- return uploadFilesForCompositionOrEntry({
2871
- entity: sourceObject,
2843
+ } else {
2844
+ source = await createFileSyncEngineDataSource({
2872
2845
  directory,
2873
- fileClient
2846
+ selectIdentifier: selectIdentifier3,
2847
+ selectDisplayName: selectDisplayName3,
2848
+ verbose
2874
2849
  });
2875
2850
  }
2876
- });
2877
- }
2878
- };
2851
+ const target = createComponentInstanceEngineDataSource({
2852
+ client,
2853
+ state,
2854
+ onlyCompositions,
2855
+ onlyPatterns,
2856
+ patternType,
2857
+ verbose
2858
+ });
2859
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
2860
+ await syncEngine({
2861
+ source,
2862
+ target,
2863
+ mode,
2864
+ whatIf,
2865
+ verbose,
2866
+ allowEmptySource,
2867
+ log: createSyncEngineConsoleLogger({ diffMode }),
2868
+ onBeforeCompareObjects: async (sourceObject) => {
2869
+ return replaceLocalUrlsWithRemoteReferences({
2870
+ entity: sourceObject,
2871
+ fileClient
2872
+ });
2873
+ },
2874
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
2875
+ onBeforeWriteObject: async (sourceObject) => {
2876
+ return uploadFilesForCompositionOrEntry({
2877
+ entity: sourceObject,
2878
+ directory,
2879
+ fileClient
2880
+ });
2881
+ }
2882
+ });
2883
+ }
2884
+ };
2885
+ }
2879
2886
 
2880
2887
  // src/commands/canvas/commands/componentPattern/push.ts
2881
2888
  var ComponentPatternPushModule = {
2882
- ...CompositionPushModule,
2889
+ ...componentInstancePushModuleFactory("componentPatterns"),
2883
2890
  describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
2884
2891
  builder: (yargs35) => withConfiguration(
2885
2892
  withApiOptions(
@@ -2903,6 +2910,7 @@ var ComponentPatternPushModule = {
2903
2910
  type: "boolean",
2904
2911
  hidden: true
2905
2912
  }).option("patternType", {
2913
+ // This default differentiate this list command from composition list command
2906
2914
  default: "component",
2907
2915
  choices: ["all", "component", "composition"],
2908
2916
  hidden: true
@@ -3263,7 +3271,7 @@ var CompositionPatternPublishModule = {
3263
3271
 
3264
3272
  // src/commands/canvas/commands/compositionPattern/pull.ts
3265
3273
  var CompositionPatternPullModule = {
3266
- ...CompositionPullModule,
3274
+ ...componentInstancePullModuleFactory("compositionPatterns"),
3267
3275
  describe: "Pulls all composition patterns to local files in a directory",
3268
3276
  builder: (yargs35) => withConfiguration(
3269
3277
  withApiOptions(
@@ -3307,7 +3315,7 @@ var CompositionPatternPullModule = {
3307
3315
 
3308
3316
  // src/commands/canvas/commands/compositionPattern/push.ts
3309
3317
  var CompositionPatternPushModule = {
3310
- ...CompositionPushModule,
3318
+ ...componentInstancePushModuleFactory("compositionPatterns"),
3311
3319
  describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
3312
3320
  builder: (yargs35) => withConfiguration(
3313
3321
  withApiOptions(
@@ -3331,6 +3339,7 @@ var CompositionPatternPushModule = {
3331
3339
  type: "boolean",
3332
3340
  hidden: true
3333
3341
  }).option("patternType", {
3342
+ // This default differentiate this list command from composition list command
3334
3343
  default: "composition",
3335
3344
  choices: ["all", "component", "composition"],
3336
3345
  hidden: true
@@ -8455,7 +8464,7 @@ import { PostHog } from "posthog-node";
8455
8464
  // package.json
8456
8465
  var package_default = {
8457
8466
  name: "@uniformdev/cli",
8458
- version: "20.22.0",
8467
+ version: "20.23.0",
8459
8468
  description: "Uniform command line interface tool",
8460
8469
  license: "SEE LICENSE IN LICENSE.txt",
8461
8470
  main: "./cli.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.22.1-alpha.0+b02aa0b2f0",
3
+ "version": "20.23.0",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@thi.ng/mime": "^2.2.23",
30
- "@uniformdev/assets": "20.22.1-alpha.0+b02aa0b2f0",
31
- "@uniformdev/canvas": "20.22.1-alpha.0+b02aa0b2f0",
32
- "@uniformdev/context": "20.22.1-alpha.0+b02aa0b2f0",
33
- "@uniformdev/files": "20.22.1-alpha.0+b02aa0b2f0",
34
- "@uniformdev/project-map": "20.22.1-alpha.0+b02aa0b2f0",
35
- "@uniformdev/redirect": "20.22.1-alpha.0+b02aa0b2f0",
36
- "@uniformdev/richtext": "20.22.1-alpha.0+b02aa0b2f0",
30
+ "@uniformdev/assets": "20.23.0",
31
+ "@uniformdev/canvas": "20.23.0",
32
+ "@uniformdev/context": "20.23.0",
33
+ "@uniformdev/files": "20.23.0",
34
+ "@uniformdev/project-map": "20.23.0",
35
+ "@uniformdev/redirect": "20.23.0",
36
+ "@uniformdev/richtext": "20.23.0",
37
37
  "call-bind": "^1.0.2",
38
38
  "colorette": "2.0.20",
39
39
  "cosmiconfig": "9.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "b02aa0b2f0c3d94ec1f20953cb5bc36dfa9cdbc7"
82
+ "gitHead": "cc8a0ba91f036c7dea8d3a2dffad3373dec9cf2b"
83
83
  }