@alchemy/cli 0.4.0 → 0.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Alchemy CLI — interact with blockchain data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const { unlinkSync } = require("node:fs");
4
+ const { join } = require("node:path");
5
+
3
6
  function isGlobalInstall() {
4
7
  return process.env.npm_config_global === "true";
5
8
  }
@@ -8,8 +11,21 @@ function isCI() {
8
11
  return process.env.CI === "true";
9
12
  }
10
13
 
14
+ function clearUpdateCache() {
15
+ const home = process.env.HOME || require("node:os").homedir();
16
+ const configHome = process.env.XDG_CONFIG_HOME || join(home, ".config");
17
+ const cachePath = process.env.ALCHEMY_CONFIG
18
+ ? process.env.ALCHEMY_CONFIG.replace(/config\.json$/, ".update-check")
19
+ : join(configHome, "alchemy", ".update-check");
20
+ try {
21
+ unlinkSync(cachePath);
22
+ } catch {
23
+ // Cache file may not exist yet — that's fine.
24
+ }
25
+ }
26
+
11
27
  if (isGlobalInstall() && !isCI()) {
12
- // Keep this concise so it stays readable in npm install output.
28
+ clearUpdateCache();
13
29
  console.log("");
14
30
  console.log("◆ Alchemy CLI installed");
15
31
  console.log(" Run `alchemy` to get started.");