@jinshuju/cli 0.1.1 → 0.1.2
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/README.md +2 -0
- package/dist/cli.d.ts +6 -1
- package/dist/cli.js +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export type CliRuntime = {
|
|
|
11
11
|
/** How wide a table may be. Defaults to the terminal, or 120 through a pipe. */
|
|
12
12
|
width?: number;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Read from package.json, not restated here. A release bumps that file and
|
|
16
|
+
* nothing else, so a constant reports the previous version from the moment it
|
|
17
|
+
* is published — 0.1.1 shipped saying 0.1.0.
|
|
18
|
+
*/
|
|
19
|
+
export declare const VERSION: string;
|
|
15
20
|
export declare function terminalWidth(stream?: NodeJS.WriteStream): number;
|
|
16
21
|
export declare function runCli(args?: string[], runtime?: CliRuntime): Promise<CliResult>;
|
package/dist/cli.js
CHANGED
|
@@ -186,7 +186,21 @@ function localOptions(flags, stdin) {
|
|
|
186
186
|
showSecret: Boolean(bound.show_secret)
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Read from package.json, not restated here. A release bumps that file and
|
|
191
|
+
* nothing else, so a constant reports the previous version from the moment it
|
|
192
|
+
* is published — 0.1.1 shipped saying 0.1.0.
|
|
193
|
+
*/
|
|
194
|
+
export const VERSION = readVersion();
|
|
195
|
+
function readVersion() {
|
|
196
|
+
try {
|
|
197
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
198
|
+
return pkg.version ?? 'unknown';
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return 'unknown';
|
|
202
|
+
}
|
|
203
|
+
}
|
|
190
204
|
function ok(stdout) {
|
|
191
205
|
return { exitCode: 0, stdout: stdout.endsWith('\n') ? stdout : `${stdout}\n`, stderr: '' };
|
|
192
206
|
}
|