prompsit-cli 26.227.1942 → 26.227.2006
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/repl/examples.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundled example files deployed to ~/.prompsit/examples/.
|
|
3
3
|
*
|
|
4
|
-
* Copies sample files on
|
|
5
|
-
*
|
|
4
|
+
* Copies sample files on REPL launch. Re-copies when CLI version
|
|
5
|
+
* changes (version marker stored in ~/.prompsit/examples/.version).
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Copy bundled examples to ~/.prompsit/examples
|
|
8
|
+
* Copy bundled examples to ~/.prompsit/examples/.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* Returns the examples directory path.
|
|
10
|
+
* On version mismatch (or first run), overwrites all example files
|
|
11
|
+
* and updates the version marker. Returns the examples directory path.
|
|
12
12
|
*/
|
|
13
13
|
export declare function ensureExamples(): string;
|
|
14
14
|
//# sourceMappingURL=examples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../../src/repl/examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../../src/repl/examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,MAAM,CA0BvC"}
|
package/dist/repl/examples.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundled example files deployed to ~/.prompsit/examples/.
|
|
3
3
|
*
|
|
4
|
-
* Copies sample files on
|
|
5
|
-
*
|
|
4
|
+
* Copies sample files on REPL launch. Re-copies when CLI version
|
|
5
|
+
* changes (version marker stored in ~/.prompsit/examples/.version).
|
|
6
6
|
*/
|
|
7
|
-
import { existsSync, mkdirSync, copyFileSync } from "node:fs";
|
|
7
|
+
import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { join, dirname } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { getConfigDir } from "../config/paths.js";
|
|
11
|
+
import { getVersion } from "../version.js";
|
|
11
12
|
const EXAMPLE_FILES = [
|
|
12
13
|
"sample.txt",
|
|
13
14
|
"sample.tmx",
|
|
@@ -15,31 +16,37 @@ const EXAMPLE_FILES = [
|
|
|
15
16
|
"sample.xliff",
|
|
16
17
|
"sample.csv",
|
|
17
18
|
];
|
|
19
|
+
const VERSION_MARKER = ".version";
|
|
18
20
|
/** @returns Absolute path to ~/.prompsit/examples/ directory. */
|
|
19
21
|
function getExamplesDir() {
|
|
20
22
|
return join(getConfigDir(), "examples");
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
|
-
* Copy bundled examples to ~/.prompsit/examples
|
|
25
|
+
* Copy bundled examples to ~/.prompsit/examples/.
|
|
24
26
|
*
|
|
25
|
-
*
|
|
26
|
-
* Returns the examples directory path.
|
|
27
|
+
* On version mismatch (or first run), overwrites all example files
|
|
28
|
+
* and updates the version marker. Returns the examples directory path.
|
|
27
29
|
*/
|
|
28
30
|
export function ensureExamples() {
|
|
29
31
|
const dest = getExamplesDir();
|
|
30
32
|
mkdirSync(dest, { recursive: true });
|
|
33
|
+
const markerPath = join(dest, VERSION_MARKER);
|
|
34
|
+
const currentVersion = getVersion();
|
|
35
|
+
// Fast path: examples already up-to-date
|
|
36
|
+
if (existsSync(markerPath) && readFileSync(markerPath, "utf8").trim() === currentVersion) {
|
|
37
|
+
return dest;
|
|
38
|
+
}
|
|
31
39
|
// Resolve bundled examples relative to compiled output
|
|
32
40
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
33
41
|
const srcDir = join(thisDir, "../../examples");
|
|
34
42
|
for (const name of EXAMPLE_FILES) {
|
|
43
|
+
const source = join(srcDir, name);
|
|
35
44
|
const target = join(dest, name);
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
if (existsSync(source)) {
|
|
39
|
-
copyFileSync(source, target);
|
|
40
|
-
}
|
|
45
|
+
if (existsSync(source)) {
|
|
46
|
+
copyFileSync(source, target);
|
|
41
47
|
}
|
|
42
48
|
}
|
|
49
|
+
writeFileSync(markerPath, currentVersion, "utf8");
|
|
43
50
|
return dest;
|
|
44
51
|
}
|
|
45
52
|
//# sourceMappingURL=examples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../../src/repl/examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../../src/repl/examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,aAAa,GAAG;IACpB,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,YAAY;CACJ,CAAC;AAEX,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC,iEAAiE;AACjE,SAAS,cAAc;IACrB,OAAO,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAErC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC9C,MAAM,cAAc,GAAG,UAAU,EAAE,CAAC;IAEpC,yCAAyC;IACzC,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;QACzF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uDAAuD;IACvD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAE/C,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prompsit-cli",
|
|
3
|
-
"version": "26.227.
|
|
3
|
+
"version": "26.227.2006",
|
|
4
4
|
"description": "CLI for the Prompsit Translation API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"format:check": "prettier --check \"src/**/*.{ts,json}\"",
|
|
39
39
|
"lint:unused": "knip --production",
|
|
40
40
|
"lint:arch": "depcruise src --config",
|
|
41
|
-
"lint:all": "npm run typecheck && npm run lint && npm run lint:unused && npm run lint:arch"
|
|
41
|
+
"lint:all": "npm run typecheck && npm run lint && npm run format:check && npm run check:terminal-io && npm run lint:unused && npm run lint:arch"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@commander-js/extra-typings": "^14.0.0",
|