helpshelf 0.1.0 → 0.1.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/dist/index.js +12 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
-
}) : x)(function(x) {
|
|
5
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
2
|
|
|
9
3
|
// src/index.ts
|
|
10
4
|
import { Command } from "commander";
|
|
@@ -1106,7 +1100,7 @@ GUIDELINES:
|
|
|
1106
1100
|
|
|
1107
1101
|
// src/commands/push.ts
|
|
1108
1102
|
import { resolve as resolve2, join as join9, basename as basename2 } from "path";
|
|
1109
|
-
import { readFileSync as readFileSync8, existsSync as existsSync9, readdirSync as readdirSync5 } from "fs";
|
|
1103
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync5, mkdirSync as mkdirSync2 } from "fs";
|
|
1110
1104
|
import chalk2 from "chalk";
|
|
1111
1105
|
import ora2 from "ora";
|
|
1112
1106
|
async function pushCommand(options) {
|
|
@@ -1285,15 +1279,14 @@ function loadConfig() {
|
|
|
1285
1279
|
}
|
|
1286
1280
|
function saveConfig(config) {
|
|
1287
1281
|
try {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
ws(resolve2(".helpshelf/config.json"), JSON.stringify(config, null, 2));
|
|
1282
|
+
mkdirSync2(resolve2(".helpshelf"), { recursive: true });
|
|
1283
|
+
writeFileSync2(resolve2(".helpshelf/config.json"), JSON.stringify(config, null, 2));
|
|
1291
1284
|
} catch {
|
|
1292
1285
|
}
|
|
1293
1286
|
}
|
|
1294
1287
|
|
|
1295
1288
|
// src/commands/init.ts
|
|
1296
|
-
import { writeFileSync as
|
|
1289
|
+
import { writeFileSync as writeFileSync3, readFileSync as readFileSync9, existsSync as existsSync10, mkdirSync as mkdirSync3 } from "fs";
|
|
1297
1290
|
import { resolve as resolve3, join as join10 } from "path";
|
|
1298
1291
|
import chalk3 from "chalk";
|
|
1299
1292
|
async function initCommand() {
|
|
@@ -1303,12 +1296,12 @@ async function initCommand() {
|
|
|
1303
1296
|
console.log(chalk3.bold("\u{1F680} Initializing HelpShelf"));
|
|
1304
1297
|
console.log();
|
|
1305
1298
|
if (!existsSync10(helpshelfDir)) {
|
|
1306
|
-
|
|
1299
|
+
mkdirSync3(helpshelfDir, { recursive: true });
|
|
1307
1300
|
console.log(chalk3.green(" \u2713"), "Created .helpshelf/ directory");
|
|
1308
1301
|
}
|
|
1309
1302
|
const configPath = join10(helpshelfDir, "config.json");
|
|
1310
1303
|
if (!existsSync10(configPath)) {
|
|
1311
|
-
|
|
1304
|
+
writeFileSync3(configPath, JSON.stringify({
|
|
1312
1305
|
siteHash: "",
|
|
1313
1306
|
apiKey: "",
|
|
1314
1307
|
autoSync: false
|
|
@@ -1317,9 +1310,9 @@ async function initCommand() {
|
|
|
1317
1310
|
}
|
|
1318
1311
|
const gitignorePath = join10(dir, ".gitignore");
|
|
1319
1312
|
if (existsSync10(gitignorePath)) {
|
|
1320
|
-
const gitignore =
|
|
1313
|
+
const gitignore = readFileSync9(gitignorePath, "utf-8");
|
|
1321
1314
|
if (!gitignore.includes(".helpshelf/snapshot.json")) {
|
|
1322
|
-
|
|
1315
|
+
writeFileSync3(gitignorePath, gitignore.trimEnd() + "\n\n# HelpShelf\n.helpshelf/snapshot.json\n");
|
|
1323
1316
|
console.log(chalk3.green(" \u2713"), "Added .helpshelf/snapshot.json to .gitignore");
|
|
1324
1317
|
}
|
|
1325
1318
|
}
|
|
@@ -1333,7 +1326,7 @@ async function initCommand() {
|
|
|
1333
1326
|
|
|
1334
1327
|
// src/commands/screenshot.ts
|
|
1335
1328
|
import { resolve as resolve5, join as join12 } from "path";
|
|
1336
|
-
import { readFileSync as
|
|
1329
|
+
import { readFileSync as readFileSync10, existsSync as existsSync12, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
1337
1330
|
import chalk4 from "chalk";
|
|
1338
1331
|
import ora3 from "ora";
|
|
1339
1332
|
|
|
@@ -1555,7 +1548,7 @@ async function screenshotCommand(options) {
|
|
|
1555
1548
|
let snapshot = null;
|
|
1556
1549
|
const snapshotPath = resolve5(options.snapshot || ".helpshelf/snapshot.json");
|
|
1557
1550
|
if (existsSync12(snapshotPath)) {
|
|
1558
|
-
snapshot = JSON.parse(
|
|
1551
|
+
snapshot = JSON.parse(readFileSync10(snapshotPath, "utf-8"));
|
|
1559
1552
|
console.log(chalk4.dim(` Using scan data: ${snapshot.apiRoutes.length} routes`));
|
|
1560
1553
|
console.log();
|
|
1561
1554
|
} else {
|
|
@@ -1563,7 +1556,7 @@ async function screenshotCommand(options) {
|
|
|
1563
1556
|
console.log();
|
|
1564
1557
|
}
|
|
1565
1558
|
const outputDir = resolve5(options.output || ".helpshelf/screenshots");
|
|
1566
|
-
|
|
1559
|
+
mkdirSync4(outputDir, { recursive: true });
|
|
1567
1560
|
const maxPages = parseInt(options.maxPages || "20", 10);
|
|
1568
1561
|
const spinner = ora3("Launching browser...").start();
|
|
1569
1562
|
try {
|
|
@@ -1595,7 +1588,7 @@ async function screenshotCommand(options) {
|
|
|
1595
1588
|
})),
|
|
1596
1589
|
navigation: result.navigation
|
|
1597
1590
|
};
|
|
1598
|
-
|
|
1591
|
+
writeFileSync5(
|
|
1599
1592
|
join12(outputDir, "manifest.json"),
|
|
1600
1593
|
JSON.stringify(manifest, null, 2)
|
|
1601
1594
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helpshelf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Scan your codebase and auto-generate support docs for HelpShelf",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "tsup src/index.ts --format esm --dts --clean --external playwright-core",
|
|
13
|
+
"build": "tsup src/index.ts --format esm --dts --clean --platform node --external playwright-core",
|
|
14
14
|
"dev": "tsup src/index.ts --format esm --watch",
|
|
15
15
|
"lint": "eslint src/",
|
|
16
16
|
"type-check": "tsc --noEmit",
|