@shell-shock/plugin-upgrade 0.1.5 → 0.1.7

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.
@@ -6,8 +6,10 @@ exports.FetchNpmPackageFunctionDeclaration = require_components_upgrade_builtin.
6
6
  exports.GetLatestVersionFunctionDeclaration = require_components_upgrade_builtin.GetLatestVersionFunctionDeclaration;
7
7
  exports.GetPackageManagerFunctionDeclaration = require_components_upgrade_builtin.GetPackageManagerFunctionDeclaration;
8
8
  exports.GetUpgradeCommandFunctionDeclaration = require_components_upgrade_builtin.GetUpgradeCommandFunctionDeclaration;
9
+ exports.IsCheckForUpdatesRequiredFunctionDeclaration = require_components_upgrade_builtin.IsCheckForUpdatesRequiredFunctionDeclaration;
9
10
  exports.LocateLockfileFunctionDeclaration = require_components_upgrade_builtin.LocateLockfileFunctionDeclaration;
10
11
  exports.LocatePackageJsonFunctionDeclaration = require_components_upgrade_builtin.LocatePackageJsonFunctionDeclaration;
12
+ exports.UpdateVersionCheckFileFunctionDeclaration = require_components_upgrade_builtin.UpdateVersionCheckFileFunctionDeclaration;
11
13
  exports.UpgradeBuiltin = require_components_upgrade_builtin.UpgradeBuiltin;
12
14
  exports.UpgradeCommand = require_components_upgrade_command.UpgradeCommand;
13
15
  exports.UpgradeFunctionDeclaration = require_components_upgrade_builtin.UpgradeFunctionDeclaration;
@@ -1,3 +1,3 @@
1
- import { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration } from "./upgrade-builtin.cjs";
1
+ import { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration } from "./upgrade-builtin.cjs";
2
2
  import { UpgradeCommand } from "./upgrade-command.cjs";
3
- export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeCommand, UpgradeFunctionDeclaration };
3
+ export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeCommand, UpgradeFunctionDeclaration };
@@ -1,3 +1,3 @@
1
- import { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration } from "./upgrade-builtin.mjs";
1
+ import { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration } from "./upgrade-builtin.mjs";
2
2
  import { UpgradeCommand } from "./upgrade-command.mjs";
3
- export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeCommand, UpgradeFunctionDeclaration };
3
+ export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeCommand, UpgradeFunctionDeclaration };
@@ -1,4 +1,4 @@
1
- import { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeFunctionDeclaration } from "./upgrade-builtin.mjs";
1
+ import { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeFunctionDeclaration } from "./upgrade-builtin.mjs";
2
2
  import { UpgradeCommand } from "./upgrade-command.mjs";
3
3
 
4
- export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeCommand, UpgradeFunctionDeclaration };
4
+ export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeCommand, UpgradeFunctionDeclaration };
@@ -247,7 +247,7 @@ function GetPackageManagerFunctionDeclaration() {
247
247
  type: "GetPackageManagerOptions",
248
248
  default: "{}"
249
249
  }],
250
- returnType: __alloy_js_core.code`Promise<"npm" | "yarn" | "deno" | "pnpm" | "bun">`,
250
+ returnType: __alloy_js_core.code`"npm" | "yarn" | "deno" | "pnpm" | "bun"`,
251
251
  get children() {
252
252
  return [
253
253
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
@@ -532,7 +532,7 @@ function FetchNpmPackageFunctionDeclaration() {
532
532
  name: "packageName",
533
533
  type: "string"
534
534
  }],
535
- returnType: __alloy_js_core.code`Promise<NpmPackage | undefined>`,
535
+ returnType: __alloy_js_core.code`NpmPackage | undefined`,
536
536
  get children() {
537
537
  return [
538
538
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
@@ -579,7 +579,7 @@ function GetLatestVersionFunctionDeclaration() {
579
579
  default: `"${context.packageJson.name}"`
580
580
  }];
581
581
  },
582
- returnType: __alloy_js_core.code`Promise<string | undefined>`,
582
+ returnType: __alloy_js_core.code`string | undefined`,
583
583
  get children() {
584
584
  return [
585
585
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
@@ -627,7 +627,7 @@ function GetUpgradeCommandFunctionDeclaration() {
627
627
  type: "string",
628
628
  default: "process.cwd()"
629
629
  }],
630
- returnType: "Promise<string[]>",
630
+ returnType: "string[]",
631
631
  get children() {
632
632
  return [
633
633
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
@@ -770,6 +770,92 @@ function UpgradeFunctionDeclaration() {
770
770
  ];
771
771
  }
772
772
  /**
773
+ * The `updateVersionCheckFile` handler function declaration code for the Shell Shock project.
774
+ */
775
+ function UpdateVersionCheckFileFunctionDeclaration() {
776
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDoc, {
777
+ heading: "A helper function that updates the version check file.",
778
+ get children() {
779
+ return [
780
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to update the version check file with the current timestamp. It can be used in the CLI upgrade command to record the last time a check for updates was performed. The function writes a "version-check.json" file in the data directory, which contains a timestamp of the last check for updates.` }),
781
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
782
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to a boolean indicating whether a check for updates is required.` })
783
+ ];
784
+ }
785
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
786
+ "export": true,
787
+ async: true,
788
+ name: "updateVersionCheckFile",
789
+ returnType: "void",
790
+ get children() {
791
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
792
+ condition: __alloy_js_core.code`!existsSync(paths.data)`,
793
+ children: __alloy_js_core.code`await mkdir(paths.data, { recursive: true }); `
794
+ }), __alloy_js_core.code`await writeFile(join(paths.data, "version-check.json"), JSON.stringify({ timestamp: new Date().getTime() }), "utf8"); `];
795
+ }
796
+ })];
797
+ }
798
+ /**
799
+ * The `isCheckForUpdatesRequired` handler function declaration code for the Shell Shock project.
800
+ */
801
+ function IsCheckForUpdatesRequiredFunctionDeclaration() {
802
+ const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
803
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDoc, {
804
+ heading: "A helper function that verifies if a check for updates is required.",
805
+ get children() {
806
+ return [
807
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDocRemarks, { children: `This function is used to determine if a check for updates is required based on the last time a check was performed. It can be used in the CLI upgrade command to avoid unnecessary checks for updates if one was recently performed. The function checks for the existence of a "version-check.json" file in the data directory, which contains a timestamp of the last check for updates. If the file does not exist or if the timestamp is older than a specified stale time, the function will return true, indicating that a check for updates is required. Otherwise, it will return false.` }),
808
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
809
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDocReturns, { children: `A promise that resolves to a boolean indicating whether a check for updates is required.` })
810
+ ];
811
+ }
812
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
813
+ "export": true,
814
+ async: true,
815
+ name: "isCheckForUpdatesRequired",
816
+ get children() {
817
+ return [
818
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
819
+ condition: __alloy_js_core.code`!isInteractive || isCI || env.SKIP_VERSION_CHECK`,
820
+ children: __alloy_js_core.code`return false; `
821
+ }),
822
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
823
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
824
+ "const": true,
825
+ name: "filePath",
826
+ initializer: __alloy_js_core.code`join(paths.data, "version-check.json"); `
827
+ }),
828
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
829
+ condition: __alloy_js_core.code`existsSync(filePath)`,
830
+ get children() {
831
+ return [
832
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
833
+ "const": true,
834
+ name: "file",
835
+ type: "{ timestamp: number; }",
836
+ initializer: __alloy_js_core.code` JSON.parse(await readFile(filePath, "utf8")); `
837
+ }),
838
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
839
+ condition: __alloy_js_core.code`!file.timestamp`,
840
+ children: __alloy_js_core.code`await updateVersionCheckFile();
841
+ return true; `
842
+ }),
843
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
844
+ get condition() {
845
+ return __alloy_js_core.code`new Date().getTime() - file.timestamp < ${context.config.upgrade.staleTime}`;
846
+ },
847
+ children: __alloy_js_core.code`return false; `
848
+ })
849
+ ];
850
+ }
851
+ }),
852
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { children: __alloy_js_core.code`await updateVersionCheckFile();
853
+ return true; ` })
854
+ ];
855
+ }
856
+ })];
857
+ }
858
+ /**
773
859
  * The `checkForUpdates` handler function declaration code for the Shell Shock project.
774
860
  */
775
861
  function CheckForUpdatesFunctionDeclaration() {
@@ -779,13 +865,32 @@ function CheckForUpdatesFunctionDeclaration() {
779
865
  "export": true,
780
866
  name: "CheckForUpdatesOptions",
781
867
  "extends": "GetPackageManagerOptions",
782
- doc: "Options for the `checkForUpdates` handler function."
868
+ doc: "Options for the `checkForUpdates` handler function.",
869
+ get children() {
870
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
871
+ name: "force",
872
+ optional: true,
873
+ type: "boolean",
874
+ doc: "Whether to force a check for updates regardless of the last check timestamp. If set to `true`, the function will bypass the timestamp check and perform a check for updates, updating the timestamp in the process. This can be useful if you want to ensure that a check for updates is performed even if one was recently done, such as when the user explicitly requests it or when certain conditions are met that warrant an immediate check."
875
+ });
876
+ }
783
877
  }),
784
878
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
785
879
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, {
786
- "export": true,
787
- name: "CheckForUpdatesResult",
788
- doc: "The result for the `checkForUpdates` handler function.",
880
+ name: "CheckForUpdatesBaseResult",
881
+ get children() {
882
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
883
+ name: "isError",
884
+ type: "boolean",
885
+ optional: true,
886
+ doc: "Indicates whether an error occurred while checking for updates."
887
+ });
888
+ }
889
+ }),
890
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
891
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, {
892
+ name: "CheckForUpdatesSuccessResult",
893
+ "extends": "CheckForUpdatesBaseResult",
789
894
  get children() {
790
895
  return [
791
896
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
@@ -809,18 +914,32 @@ function CheckForUpdatesFunctionDeclaration() {
809
914
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
810
915
  name: "package",
811
916
  type: "NpmPackage",
917
+ optional: true,
812
918
  doc: "The npm package that was checked for updates."
813
- }),
814
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
815
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
816
- name: "packageManager",
817
- type: "'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun'",
818
- doc: "The package manager used to check for updates."
819
919
  })
820
920
  ];
821
921
  }
822
922
  }),
823
923
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
924
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, {
925
+ name: "CheckForUpdatesErrorResult",
926
+ "extends": "CheckForUpdatesBaseResult",
927
+ get children() {
928
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
929
+ name: "error",
930
+ type: "Error",
931
+ doc: "The error that occurred while checking for updates."
932
+ });
933
+ }
934
+ }),
935
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
936
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TypeDeclaration, {
937
+ "export": true,
938
+ name: "CheckForUpdatesResult",
939
+ doc: "The result for the `checkForUpdates` handler function.",
940
+ children: __alloy_js_core.code`CheckForUpdatesSuccessResult | CheckForUpdatesErrorResult;`
941
+ }),
942
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
824
943
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TSDoc, {
825
944
  heading: "Check for updates to the application dependencies.",
826
945
  get children() {
@@ -844,67 +963,41 @@ function CheckForUpdatesFunctionDeclaration() {
844
963
  type: "CheckForUpdatesOptions",
845
964
  default: "{}"
846
965
  }],
847
- returnType: "Promise<CheckForUpdatesResult | undefined>",
966
+ returnType: "CheckForUpdatesResult",
848
967
  get children() {
849
968
  return [
850
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
851
- "const": true,
852
- name: "filePath",
853
- initializer: __alloy_js_core.code`join(paths.data, "version-check.json"); `
854
- }),
855
969
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
856
- condition: __alloy_js_core.code`existsSync(filePath)`,
970
+ condition: __alloy_js_core.code`!options.force && !(await isCheckForUpdatesRequired())`,
857
971
  get children() {
858
- return [
859
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
860
- "const": true,
861
- name: "file",
862
- type: "{ timestamp: number; }",
863
- initializer: __alloy_js_core.code` JSON.parse(await readFile(filePath, "utf8")); `
864
- }),
865
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
866
- condition: __alloy_js_core.code`!file.timestamp`,
867
- children: __alloy_js_core.code`await writeFile(filePath, JSON.stringify({ timestamp: new Date().getTime() }), "utf8");
868
- return undefined; `
869
- }),
870
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
871
- get condition() {
872
- return __alloy_js_core.code`new Date().getTime() - file.timestamp < ${context.config.upgrade.staleTime}`;
873
- },
874
- children: __alloy_js_core.code`return undefined; `
875
- })
876
- ];
972
+ return __alloy_js_core.code`return {
973
+ latestVersion: "${context.packageJson.version}",
974
+ currentVersion: "${context.packageJson.version}",
975
+ isUpToDate: true,
976
+ isError: false,
977
+ }; `;
877
978
  }
878
979
  }),
879
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseClause, { children: __alloy_js_core.code`await writeFile(filePath, JSON.stringify({ timestamp: new Date().getTime() }), "utf8");
880
- return undefined; ` }),
881
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
882
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
883
- "const": true,
884
- name: "packageManager",
885
- initializer: __alloy_js_core.code`await getPackageManager(options); `
886
- }),
887
980
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
981
+ __alloy_js_core.code`try { `,
888
982
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
889
983
  "const": true,
890
984
  name: "pkg",
891
- initializer: __alloy_js_core.code`await fetchNpmPackage(); `
892
- }),
893
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
894
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
895
- condition: __alloy_js_core.code`!pkg`,
896
- children: __alloy_js_core.code`return undefined; `
985
+ get initializer() {
986
+ return __alloy_js_core.code`await fetchNpmPackage("${context.packageJson.name}"); `;
987
+ }
897
988
  }),
898
989
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
899
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`await writeFile(filePath, JSON.stringify({ timestamp: new Date().getTime() }), "utf8");
900
-
990
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
901
991
  return {
902
- latestVersion: pkg?.version ?? "0.0.0",
903
- currentVersion: "${context.packageJson.version}",
904
- isUpToDate: pkg ? "${context.packageJson.version}" === pkg.version : true,
905
- package: pkg,
906
- packageManager,
907
- }; `)
992
+ latestVersion: pkg?.version || "${context.packageJson.version}",
993
+ currentVersion: "${context.packageJson.version}",
994
+ isUpToDate: pkg ? "${context.packageJson.version}" === pkg.version : true,
995
+ package: pkg,
996
+ isError: false,
997
+ };
998
+ } catch (err) {
999
+ return { isError: true, error: err instanceof Error ? err : new Error(String(err)) };
1000
+ } `)
908
1001
  ];
909
1002
  }
910
1003
  })
@@ -924,7 +1017,11 @@ function UpgradeBuiltin(props) {
924
1017
  "node:os": "os",
925
1018
  "node:path": ["join", "resolve"],
926
1019
  "node:fs": ["existsSync"],
927
- "node:fs/promises": ["readFile", "writeFile"],
1020
+ "node:fs/promises": [
1021
+ "readFile",
1022
+ "writeFile",
1023
+ "mkdir"
1024
+ ],
928
1025
  "node:process": "process"
929
1026
  });
930
1027
  },
@@ -935,8 +1032,17 @@ function UpgradeBuiltin(props) {
935
1032
  "verbose",
936
1033
  "writeLine"
937
1034
  ],
938
- env: ["paths", "isWindows"],
939
- utils: ["isColorSupported", "spawn"]
1035
+ env: [
1036
+ "paths",
1037
+ "isWindows",
1038
+ "isCI",
1039
+ "env"
1040
+ ],
1041
+ utils: [
1042
+ "isColorSupported",
1043
+ "isInteractive",
1044
+ "spawn"
1045
+ ]
940
1046
  });
941
1047
  },
942
1048
  get children() {
@@ -971,6 +1077,10 @@ function UpgradeBuiltin(props) {
971
1077
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
972
1078
  (0, __alloy_js_core_jsx_runtime.createComponent)(CheckForUpdatesFunctionDeclaration, {}),
973
1079
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1080
+ (0, __alloy_js_core_jsx_runtime.createComponent)(IsCheckForUpdatesRequiredFunctionDeclaration, {}),
1081
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
1082
+ (0, __alloy_js_core_jsx_runtime.createComponent)(UpdateVersionCheckFileFunctionDeclaration, {}),
1083
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
974
1084
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
975
1085
  get when() {
976
1086
  return Boolean(children);
@@ -988,7 +1098,9 @@ exports.FetchNpmPackageFunctionDeclaration = FetchNpmPackageFunctionDeclaration;
988
1098
  exports.GetLatestVersionFunctionDeclaration = GetLatestVersionFunctionDeclaration;
989
1099
  exports.GetPackageManagerFunctionDeclaration = GetPackageManagerFunctionDeclaration;
990
1100
  exports.GetUpgradeCommandFunctionDeclaration = GetUpgradeCommandFunctionDeclaration;
1101
+ exports.IsCheckForUpdatesRequiredFunctionDeclaration = IsCheckForUpdatesRequiredFunctionDeclaration;
991
1102
  exports.LocateLockfileFunctionDeclaration = LocateLockfileFunctionDeclaration;
992
1103
  exports.LocatePackageJsonFunctionDeclaration = LocatePackageJsonFunctionDeclaration;
1104
+ exports.UpdateVersionCheckFileFunctionDeclaration = UpdateVersionCheckFileFunctionDeclaration;
993
1105
  exports.UpgradeBuiltin = UpgradeBuiltin;
994
1106
  exports.UpgradeFunctionDeclaration = UpgradeFunctionDeclaration;
@@ -30,6 +30,14 @@ declare function GetUpgradeCommandFunctionDeclaration(): _alloy_js_core0.Childre
30
30
  * The `upgrade` handler function declaration code for the Shell Shock project.
31
31
  */
32
32
  declare function UpgradeFunctionDeclaration(): _alloy_js_core0.Children;
33
+ /**
34
+ * The `updateVersionCheckFile` handler function declaration code for the Shell Shock project.
35
+ */
36
+ declare function UpdateVersionCheckFileFunctionDeclaration(): _alloy_js_core0.Children;
37
+ /**
38
+ * The `isCheckForUpdatesRequired` handler function declaration code for the Shell Shock project.
39
+ */
40
+ declare function IsCheckForUpdatesRequiredFunctionDeclaration(): _alloy_js_core0.Children;
33
41
  /**
34
42
  * The `checkForUpdates` handler function declaration code for the Shell Shock project.
35
43
  */
@@ -40,5 +48,5 @@ interface UpgradeBuiltinProps extends Omit<BuiltinFileProps, "id" | "description
40
48
  */
41
49
  declare function UpgradeBuiltin(props: UpgradeBuiltinProps): _alloy_js_core0.Children;
42
50
  //#endregion
43
- export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration };
51
+ export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration };
44
52
  //# sourceMappingURL=upgrade-builtin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-builtin.d.cts","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA6CgB,iBAAA,oCAAA,CAAA,CAAoC,EAAA,eAAA,CAAA,QAAA;AAgGpD;AAuFA;AAkJA;AA6KgB,iBAtZA,iCAAA,CAAA,CAsZmC,EAtZF,eAAA,CAAA,QAsZE;AA2CnD;AAyEA;AAyFA;AAgIiB,iBA5oBD,oCAAA,CAAA,CA4oBiC,EA5oBG,eAAA,CAAA,QA4oBH;AAQjD;;;iBAlgBgB,kCAAA,CAAA,GAAkC,eAAA,CAAA;;;;iBA6KlC,mCAAA,CAAA,GAAmC,eAAA,CAAA;;;;iBA2CnC,oCAAA,CAAA,GAAoC,eAAA,CAAA;;;;iBAyEpC,0BAAA,CAAA,GAA0B,eAAA,CAAA;;;;iBAyF1B,kCAAA,CAAA,GAAkC,eAAA,CAAA;UAgIjC,mBAAA,SAA4B,KAC3C;;;;iBAOc,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
1
+ {"version":3,"file":"upgrade-builtin.d.cts","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA6CgB,iBAAA,oCAAA,CAAA,CAAoC,EAAA,eAAA,CAAA,QAAA;AAgGpD;AAuFA;AAkJA;AA6KgB,iBAtZA,iCAAA,CAAA,CAsZmC,EAtZF,eAAA,CAAA,QAsZE;AA2CnD;AAyEA;AAyFA;AA6BgB,iBAziBA,oCAAA,CAAA,CAyiB4C,EAziBR,eAAA,CAAA,QAyiBQ;AAuD5D;AAoIA;AAQA;iBA1lBgB,kCAAA,CAAA,GAAkC,eAAA,CAAA;;;;iBA6KlC,mCAAA,CAAA,GAAmC,eAAA,CAAA;;;;iBA2CnC,oCAAA,CAAA,GAAoC,eAAA,CAAA;;;;iBAyEpC,0BAAA,CAAA,GAA0B,eAAA,CAAA;;;;iBAyF1B,yCAAA,CAAA,GAAyC,eAAA,CAAA;;;;iBA6BzC,4CAAA,CAAA,GAA4C,eAAA,CAAA;;;;iBAuD5C,kCAAA,CAAA,GAAkC,eAAA,CAAA;UAoIjC,mBAAA,SAA4B,KAC3C;;;;iBAOc,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
@@ -30,6 +30,14 @@ declare function GetUpgradeCommandFunctionDeclaration(): _alloy_js_core0.Childre
30
30
  * The `upgrade` handler function declaration code for the Shell Shock project.
31
31
  */
32
32
  declare function UpgradeFunctionDeclaration(): _alloy_js_core0.Children;
33
+ /**
34
+ * The `updateVersionCheckFile` handler function declaration code for the Shell Shock project.
35
+ */
36
+ declare function UpdateVersionCheckFileFunctionDeclaration(): _alloy_js_core0.Children;
37
+ /**
38
+ * The `isCheckForUpdatesRequired` handler function declaration code for the Shell Shock project.
39
+ */
40
+ declare function IsCheckForUpdatesRequiredFunctionDeclaration(): _alloy_js_core0.Children;
33
41
  /**
34
42
  * The `checkForUpdates` handler function declaration code for the Shell Shock project.
35
43
  */
@@ -40,5 +48,5 @@ interface UpgradeBuiltinProps extends Omit<BuiltinFileProps, "id" | "description
40
48
  */
41
49
  declare function UpgradeBuiltin(props: UpgradeBuiltinProps): _alloy_js_core0.Children;
42
50
  //#endregion
43
- export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration };
51
+ export { CheckForUpdatesFunctionDeclaration, FetchNpmPackageFunctionDeclaration, GetLatestVersionFunctionDeclaration, GetPackageManagerFunctionDeclaration, GetUpgradeCommandFunctionDeclaration, IsCheckForUpdatesRequiredFunctionDeclaration, LocateLockfileFunctionDeclaration, LocatePackageJsonFunctionDeclaration, UpdateVersionCheckFileFunctionDeclaration, UpgradeBuiltin, UpgradeBuiltinProps, UpgradeFunctionDeclaration };
44
52
  //# sourceMappingURL=upgrade-builtin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-builtin.d.mts","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA6CgB,iBAAA,oCAAA,CAAA,CAAoC,EAAA,eAAA,CAAA,QAAA;AAgGpD;AAuFA;AAkJA;AA6KgB,iBAtZA,iCAAA,CAAA,CAsZmC,EAtZF,eAAA,CAAA,QAsZE;AA2CnD;AAyEA;AAyFA;AAgIiB,iBA5oBD,oCAAA,CAAA,CA4oBiC,EA5oBG,eAAA,CAAA,QA4oBH;AAQjD;;;iBAlgBgB,kCAAA,CAAA,GAAkC,eAAA,CAAA;;;;iBA6KlC,mCAAA,CAAA,GAAmC,eAAA,CAAA;;;;iBA2CnC,oCAAA,CAAA,GAAoC,eAAA,CAAA;;;;iBAyEpC,0BAAA,CAAA,GAA0B,eAAA,CAAA;;;;iBAyF1B,kCAAA,CAAA,GAAkC,eAAA,CAAA;UAgIjC,mBAAA,SAA4B,KAC3C;;;;iBAOc,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}
1
+ {"version":3,"file":"upgrade-builtin.d.mts","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA6CgB,iBAAA,oCAAA,CAAA,CAAoC,EAAA,eAAA,CAAA,QAAA;AAgGpD;AAuFA;AAkJA;AA6KgB,iBAtZA,iCAAA,CAAA,CAsZmC,EAtZF,eAAA,CAAA,QAsZE;AA2CnD;AAyEA;AAyFA;AA6BgB,iBAziBA,oCAAA,CAAA,CAyiB4C,EAziBR,eAAA,CAAA,QAyiBQ;AAuD5D;AAoIA;AAQA;iBA1lBgB,kCAAA,CAAA,GAAkC,eAAA,CAAA;;;;iBA6KlC,mCAAA,CAAA,GAAmC,eAAA,CAAA;;;;iBA2CnC,oCAAA,CAAA,GAAoC,eAAA,CAAA;;;;iBAyEpC,0BAAA,CAAA,GAA0B,eAAA,CAAA;;;;iBAyF1B,yCAAA,CAAA,GAAyC,eAAA,CAAA;;;;iBA6BzC,4CAAA,CAAA,GAA4C,eAAA,CAAA;;;;iBAuD5C,kCAAA,CAAA,GAAkC,eAAA,CAAA;UAoIjC,mBAAA,SAA4B,KAC3C;;;;iBAOc,cAAA,QAAsB,sBAAmB,eAAA,CAAA"}