xertz 0.58.0 → 0.59.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.
package/dist/cli.js CHANGED
@@ -30,11 +30,17 @@ const builder_1 = require("./builder");
30
30
  const path = __importStar(require("path"));
31
31
  const fse = __importStar(require("fs-extra"));
32
32
  const chokidar = __importStar(require("chokidar"));
33
- const package_json_1 = __importDefault(require("package-json"));
34
33
  const child_process_1 = require("child_process");
35
34
  const express = require("express");
36
- const package_json_2 = __importDefault(require("../package.json"));
35
+ const package_json_1 = __importDefault(require("../package.json"));
37
36
  const dateHelper_1 = require("./dateHelper");
37
+ async function fetchLatestPackageInfo(name) {
38
+ const response = await fetch(`https://registry.npmjs.org/${name}/latest`);
39
+ if (!response.ok) {
40
+ throw new Error(`npm registry returned ${response.status} for ${name}`);
41
+ }
42
+ return (await response.json());
43
+ }
38
44
  class cli {
39
45
  scaffoldDirectoryName = "scaffold";
40
46
  scaffoldContentExampleFileName = "YYYY-MM-DD-my-first-post.md";
@@ -59,7 +65,7 @@ Commands:
59
65
  `);
60
66
  }
61
67
  async run() {
62
- console.log(`${package_json_2.default.name} - Version: ${package_json_2.default.version}`);
68
+ console.log(`${package_json_1.default.name} - Version: ${package_json_1.default.version}`);
63
69
  this.watchSignal();
64
70
  const command = this.args[0] || "build";
65
71
  switch (command) {
@@ -110,7 +116,7 @@ Commands:
110
116
  const scaffoldFile = path.join(scaffoldDirectory, "package.json");
111
117
  const scaffoldPackageContent = JSON.parse(fse.readFileSync(scaffoldFile, "utf8"));
112
118
  scaffoldPackageContent.name = targetDirectoryName;
113
- const latestPackageInfo = await (0, package_json_1.default)(package_json_2.default.name);
119
+ const latestPackageInfo = await fetchLatestPackageInfo(package_json_1.default.name);
114
120
  scaffoldPackageContent.dependencies.xertz = latestPackageInfo.version;
115
121
  fse.writeFileSync(scaffoldFile, JSON.stringify(scaffoldPackageContent));
116
122
  // Run npm install
@@ -208,14 +214,14 @@ This is a new post.
208
214
  async updateCommand() {
209
215
  console.log(`[update]: Start`);
210
216
  // Update xertz depedency to latest version in package.json
211
- const latestNpmPackageInfo = await (0, package_json_1.default)(package_json_2.default.name);
217
+ const latestNpmPackageInfo = await fetchLatestPackageInfo(package_json_1.default.name);
212
218
  const packageFile = path.join(this.cwd, "package.json");
213
219
  const sitePackageInfo = JSON.parse(fse.readFileSync(packageFile, "utf8"));
214
- sitePackageInfo.dependencies[package_json_2.default.name] =
220
+ sitePackageInfo.dependencies[package_json_1.default.name] =
215
221
  latestNpmPackageInfo.version;
216
222
  fse.writeFileSync(packageFile, JSON.stringify(sitePackageInfo, null, 2));
217
223
  (0, child_process_1.execSync)(`npm install --silent`, { cwd: this.cwd });
218
- console.log(`[update]: Successfully updated ${package_json_2.default.name} to version ${latestNpmPackageInfo.version}.`);
224
+ console.log(`[update]: Successfully updated ${package_json_1.default.name} to version ${latestNpmPackageInfo.version}.`);
219
225
  }
220
226
  /* Misc */
221
227
  watchSignal() {
@@ -224,11 +230,11 @@ This is a new post.
224
230
  });
225
231
  }
226
232
  async checkForUpdates() {
227
- const latestNpmPackageInfo = await (0, package_json_1.default)(package_json_2.default.name);
233
+ const latestNpmPackageInfo = await fetchLatestPackageInfo(package_json_1.default.name);
228
234
  const sitePackageInfo = JSON.parse(fse.readFileSync(path.join(this.cwd, "package.json"), "utf8"));
229
235
  if (latestNpmPackageInfo.version !=
230
- sitePackageInfo.dependencies[package_json_2.default.name]) {
231
- console.log("\x1b[33m%s", `New version is available (${latestNpmPackageInfo.version}). Run \`npx ${package_json_2.default.name} update\` to update.`, "\x1b[0m");
236
+ sitePackageInfo.dependencies[package_json_1.default.name]) {
237
+ console.log("\x1b[33m%s", `New version is available (${latestNpmPackageInfo.version}). Run \`npx ${package_json_1.default.name} update\` to update.`, "\x1b[0m");
232
238
  }
233
239
  }
234
240
  exitWithError(errorMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xertz",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "description": "A static site generator written in TypeScript",
5
5
  "author": "Brady Holt",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  "access": "public"
13
13
  },
14
14
  "engines": {
15
- "node": ">=16"
15
+ "node": ">=18"
16
16
  },
17
17
  "main": "index.js",
18
18
  "bin": "bin/start.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@bradymholt/ampify": "^1.4.0",
31
- "chokidar": "^3.5.3",
31
+ "chokidar": "^4.0.3",
32
32
  "dateformat": "^4.5.1",
33
33
  "express": "^4.18.1",
34
34
  "fs-extra": "^10.1.0",
@@ -36,7 +36,6 @@
36
36
  "handlebars": "^4.7.7",
37
37
  "js-yaml": "^4.1.0",
38
38
  "marked": "^4.0.17",
39
- "package-json": "^6.5.0",
40
39
  "prismjs": "^1.28.0",
41
40
  "sass": "^1.52.3"
42
41
  },
@@ -44,15 +43,13 @@
44
43
  "@types/dateformat": "^5.0.0",
45
44
  "@types/express": "^4.17.13",
46
45
  "@types/fs-extra": "^9.0.13",
47
- "@types/jest": "^28.1.2",
46
+ "@types/jest": "^30.0.0",
48
47
  "@types/js-yaml": "^4.0.5",
49
48
  "@types/marked": "^4.0.3",
50
49
  "@types/node": "^18.0.0",
51
- "@types/package-json": "^5.0.1",
52
50
  "@types/prismjs": "^1.26.0",
53
- "jest": "^28.1.1",
54
- "npm-check-updates": "^14.0.1",
55
- "ts-jest": "^28.0.5",
51
+ "jest": "^30.5.2",
52
+ "ts-jest": "^29.4.15",
56
53
  "ts-node": "^10.8.1",
57
54
  "typescript": "^4.7.4"
58
55
  }
@@ -1 +1 @@
1
- {"name":"tmp_init","version":"1.0.0","description":"A site built with xertz.","dependencies":{"xertz":"0.56.0"}}
1
+ {"name":"tmp_init","version":"1.0.0","description":"A site built with xertz.","dependencies":{"xertz":"0.58.0"}}