reply-cli 0.3.0 → 0.5.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/README.md +102 -5
- package/dist/auth/oauth-flow.js +1 -1
- package/dist/auth/oauth-flow.js.map +1 -1
- package/dist/commands/install.d.ts +9 -0
- package/dist/commands/install.js +88 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/skills.d.ts +12 -0
- package/dist/commands/skills.js +138 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/config.d.ts +3 -1
- package/dist/config.js +7 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/dist/selfupdate/cache.d.ts +16 -0
- package/dist/selfupdate/cache.js +63 -0
- package/dist/selfupdate/cache.js.map +1 -0
- package/dist/selfupdate/detect.d.ts +15 -0
- package/dist/selfupdate/detect.js +88 -0
- package/dist/selfupdate/detect.js.map +1 -0
- package/dist/selfupdate/install.d.ts +34 -0
- package/dist/selfupdate/install.js +74 -0
- package/dist/selfupdate/install.js.map +1 -0
- package/dist/selfupdate/notice.d.ts +15 -0
- package/dist/selfupdate/notice.js +67 -0
- package/dist/selfupdate/notice.js.map +1 -0
- package/dist/selfupdate/npm.d.ts +20 -0
- package/dist/selfupdate/npm.js +47 -0
- package/dist/selfupdate/npm.js.map +1 -0
- package/dist/selfupdate/releases.d.ts +19 -0
- package/dist/selfupdate/releases.js +91 -0
- package/dist/selfupdate/releases.js.map +1 -0
- package/dist/selfupdate/routes.d.ts +4 -0
- package/dist/selfupdate/routes.js +52 -0
- package/dist/selfupdate/routes.js.map +1 -0
- package/dist/selfupdate/semver.d.ts +11 -0
- package/dist/selfupdate/semver.js +80 -0
- package/dist/selfupdate/semver.js.map +1 -0
- package/dist/selfupdate/types.d.ts +21 -0
- package/dist/selfupdate/types.js +3 -0
- package/dist/selfupdate/types.js.map +1 -0
- package/dist/skills/adapter-flat.d.ts +32 -0
- package/dist/skills/adapter-flat.js +480 -0
- package/dist/skills/adapter-flat.js.map +1 -0
- package/dist/skills/adapter-native.d.ts +22 -0
- package/dist/skills/adapter-native.js +335 -0
- package/dist/skills/adapter-native.js.map +1 -0
- package/dist/skills/detect.d.ts +21 -0
- package/dist/skills/detect.js +102 -0
- package/dist/skills/detect.js.map +1 -0
- package/dist/skills/hosts.d.ts +5 -0
- package/dist/skills/hosts.js +118 -0
- package/dist/skills/hosts.js.map +1 -0
- package/dist/skills/journal.d.ts +23 -0
- package/dist/skills/journal.js +91 -0
- package/dist/skills/journal.js.map +1 -0
- package/dist/skills/orchestrate.d.ts +27 -0
- package/dist/skills/orchestrate.js +124 -0
- package/dist/skills/orchestrate.js.map +1 -0
- package/dist/skills/packs.d.ts +16 -0
- package/dist/skills/packs.js +153 -0
- package/dist/skills/packs.js.map +1 -0
- package/dist/skills/report.d.ts +7 -0
- package/dist/skills/report.js +105 -0
- package/dist/skills/report.js.map +1 -0
- package/dist/skills/types.d.ts +80 -0
- package/dist/skills/types.js +5 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/utils/client.js +1 -1
- package/dist/utils/client.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FAILURE_TTL_MS = exports.SUCCESS_TTL_MS = exports.cache_is_fresh = exports.write_check_cache = exports.read_check_cache = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const config_1 = require("../config");
|
|
10
|
+
const SUCCESS_TTL_MS = 24 * 60 * 60 * 1000;
|
|
11
|
+
exports.SUCCESS_TTL_MS = SUCCESS_TTL_MS;
|
|
12
|
+
const FAILURE_TTL_MS = 60 * 60 * 1000;
|
|
13
|
+
exports.FAILURE_TTL_MS = FAILURE_TTL_MS;
|
|
14
|
+
const read_check_cache = (env) => {
|
|
15
|
+
let raw;
|
|
16
|
+
try {
|
|
17
|
+
raw = fs_1.default.readFileSync((0, config_1.update_check_file)(env), 'utf8');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(raw);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const doc = parsed;
|
|
30
|
+
if (!doc || typeof doc !== 'object' || Array.isArray(doc)
|
|
31
|
+
|| (doc.channel !== 'public' && doc.channel !== 'internal')) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return doc;
|
|
35
|
+
};
|
|
36
|
+
exports.read_check_cache = read_check_cache;
|
|
37
|
+
const write_check_cache = (entry, env) => {
|
|
38
|
+
const file = (0, config_1.update_check_file)(env);
|
|
39
|
+
fs_1.default.mkdirSync(path_1.default.dirname(file), { recursive: true, mode: 0o700 });
|
|
40
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
41
|
+
fs_1.default.writeFileSync(tmp, JSON.stringify(entry, null, 2) + '\n', 'utf8');
|
|
42
|
+
fs_1.default.renameSync(tmp, file);
|
|
43
|
+
};
|
|
44
|
+
exports.write_check_cache = write_check_cache;
|
|
45
|
+
// A cache written for one channel says nothing about the other, so switching
|
|
46
|
+
// package (public <-> internal) invalidates it outright.
|
|
47
|
+
const cache_is_fresh = (entry, channel, now) => {
|
|
48
|
+
if (!entry || entry.channel !== channel) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const stamp = entry.failed_at ?? entry.checked_at;
|
|
52
|
+
if (!stamp) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const at = Date.parse(stamp);
|
|
56
|
+
if (Number.isNaN(at)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const ttl = entry.failed_at ? FAILURE_TTL_MS : SUCCESS_TTL_MS;
|
|
60
|
+
return now.getTime() - at < ttl;
|
|
61
|
+
};
|
|
62
|
+
exports.cache_is_fresh = cache_is_fresh;
|
|
63
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/selfupdate/cache.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,sCAA4C;AAkB5C,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAsDkB,wCAAc;AArD3E,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAqDuC,wCAAc;AAnD3F,MAAM,gBAAgB,GAAG,CAAC,GAAS,EAA0B,EAAE;IAC3D,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACD,GAAG,GAAG,YAAE,CAAC,YAAY,CAAC,IAAA,0BAAiB,EAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACD,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,GAAG,GAAG,MAAqB,CAAC;IAClC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;WAClD,CAAC,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC,EAC/D,CAAC;QACG,OAAO,SAAS,CAAC;IACrB,CAA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cAAc,CAAC;IAC9D,OAAO,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AACpC,CAAC,CAAC;AAE2C,wCAAc"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Install_info } from './types';
|
|
2
|
+
declare const PUBLIC_PACKAGE = "reply-cli";
|
|
3
|
+
declare const INTERNAL_PACKAGE = "@reply-team/reply-cli";
|
|
4
|
+
type Package_json = {
|
|
5
|
+
name?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
};
|
|
8
|
+
type Detect_deps = {
|
|
9
|
+
module_dir?: string;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
read_package?: (dir: string) => Package_json | undefined;
|
|
12
|
+
};
|
|
13
|
+
declare const how_installed: (deps?: Detect_deps) => Install_info;
|
|
14
|
+
export { how_installed, PUBLIC_PACKAGE, INTERNAL_PACKAGE };
|
|
15
|
+
export type { Detect_deps, Package_json };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.INTERNAL_PACKAGE = exports.PUBLIC_PACKAGE = exports.how_installed = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// Which package this build is published as. The public one is unscoped on
|
|
10
|
+
// npmjs; the internal one lives on GitHub Packages and needs a token.
|
|
11
|
+
const PUBLIC_PACKAGE = 'reply-cli';
|
|
12
|
+
exports.PUBLIC_PACKAGE = PUBLIC_PACKAGE;
|
|
13
|
+
const INTERNAL_PACKAGE = '@reply-team/reply-cli';
|
|
14
|
+
exports.INTERNAL_PACKAGE = INTERNAL_PACKAGE;
|
|
15
|
+
const read_package_json = (dir) => {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(fs_1.default.readFileSync(path_1.default.join(dir, 'package.json'), 'utf8'));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Missing or malformed: the caller treats an unnamed package as an
|
|
21
|
+
// install layout we do not recognise, which is the safe answer.
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
// The directory holding dist/, resolved through symlinks: an npm global bin
|
|
26
|
+
// entry is a link, and the link's own path says nothing about the install.
|
|
27
|
+
// From dist/selfupdate/detect.js the package root is two levels up.
|
|
28
|
+
const default_module_dir = () => {
|
|
29
|
+
const dir = path_1.default.join(__dirname, '..', '..');
|
|
30
|
+
try {
|
|
31
|
+
return fs_1.default.realpathSync(dir);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return dir;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
// Case sensitivity follows the platform, which is what path.relative already
|
|
38
|
+
// does — the same reason the skills journal compares paths this way.
|
|
39
|
+
const inside = (parent, child) => {
|
|
40
|
+
const rel = path_1.default.relative(parent, child);
|
|
41
|
+
return rel !== '' && !rel.startsWith('..') && !path_1.default.isAbsolute(rel);
|
|
42
|
+
};
|
|
43
|
+
// The directory whose node_modules holds this package — its first one, so a
|
|
44
|
+
// transitive copy under a nested node_modules is still attributed to the
|
|
45
|
+
// project that owns the tree.
|
|
46
|
+
const owning_project = (module_dir, first_node_modules) => {
|
|
47
|
+
const depth = module_dir.split(/[\\/]+/).length - first_node_modules;
|
|
48
|
+
return path_1.default.resolve(module_dir, ...Array(depth).fill('..'));
|
|
49
|
+
};
|
|
50
|
+
const classify = (module_dir, cwd) => {
|
|
51
|
+
const parts = module_dir.split(/[\\/]+/);
|
|
52
|
+
// Checked before node_modules on purpose: an npx cache contains both.
|
|
53
|
+
if (parts.includes('_npx')) {
|
|
54
|
+
return 'npx';
|
|
55
|
+
}
|
|
56
|
+
const at = parts.indexOf('node_modules');
|
|
57
|
+
if (at === -1) {
|
|
58
|
+
return 'source';
|
|
59
|
+
}
|
|
60
|
+
// Local means node resolves it by walking up from the working directory,
|
|
61
|
+
// so the owning project must BE the working directory or an ancestor of
|
|
62
|
+
// it. Asking only whether module_dir sits under cwd gets this backwards
|
|
63
|
+
// for a version-manager install — ~/.nvm/.../node_modules is under $HOME,
|
|
64
|
+
// and a user standing in $HOME would see their global install called
|
|
65
|
+
// project-local, with the update refused for a project that isn't there.
|
|
66
|
+
const project = owning_project(module_dir, at);
|
|
67
|
+
return project === cwd || inside(project, cwd) ? 'npm-local' : 'npm-global';
|
|
68
|
+
};
|
|
69
|
+
const how_installed = (deps = {}) => {
|
|
70
|
+
const module_dir = deps.module_dir ?? default_module_dir();
|
|
71
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
72
|
+
const pkg = (deps.read_package ?? read_package_json)(module_dir);
|
|
73
|
+
const package_name = typeof pkg?.name === 'string' ? pkg.name : '';
|
|
74
|
+
const version = typeof pkg?.version === 'string' && pkg.version ? pkg.version : '0.0.0';
|
|
75
|
+
// An unrecognised package name outranks whatever the path suggests: a fork
|
|
76
|
+
// or a vendored copy is not something we should offer to replace.
|
|
77
|
+
const known = package_name === PUBLIC_PACKAGE || package_name === INTERNAL_PACKAGE;
|
|
78
|
+
const channel = package_name === INTERNAL_PACKAGE ? 'internal' : 'public';
|
|
79
|
+
return {
|
|
80
|
+
kind: known ? classify(module_dir, cwd) : 'unknown',
|
|
81
|
+
channel,
|
|
82
|
+
package_name,
|
|
83
|
+
version,
|
|
84
|
+
module_dir,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
exports.how_installed = how_installed;
|
|
88
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/selfupdate/detect.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,0EAA0E;AAC1E,sEAAsE;AACtE,MAAM,cAAc,GAA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AAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,MAAM,OAAO,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACxF,2EAA2E;IAC3E,kEAAkE;IAClE,MAAM,KAAK,GAAG,YAAY,KAAK,cAAc,IAAI,YAAY,KAAK,gBAAgB,CAAC;IACnF,MAAM,OAAO,GAAY,YAAY,KAAK,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnF,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QACnD,OAAO;QACP,YAAY;QACZ,OAAO;QACP,UAAU;KACb,CAAC;AACN,CAAC,CAAC;AAEM,sCAAa"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Env } from '../config';
|
|
2
|
+
import type { Npm_outcome } from './npm';
|
|
3
|
+
import type { Channel, Install_info, Install_kind, Release } from './types';
|
|
4
|
+
type Install_action = 'updated' | 'current' | 'manual' | 'failed';
|
|
5
|
+
type Install_report = {
|
|
6
|
+
current: string;
|
|
7
|
+
latest: string;
|
|
8
|
+
up_to_date: boolean;
|
|
9
|
+
channel: Channel;
|
|
10
|
+
install: {
|
|
11
|
+
kind: Install_kind;
|
|
12
|
+
package: string;
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
action: Install_action;
|
|
16
|
+
command: string;
|
|
17
|
+
note: string;
|
|
18
|
+
detail?: string;
|
|
19
|
+
npm_output?: string;
|
|
20
|
+
};
|
|
21
|
+
type Install_deps = {
|
|
22
|
+
install?: Install_info;
|
|
23
|
+
release?: (channel: Channel) => Promise<Release>;
|
|
24
|
+
run_npm?: (package_name: string) => Promise<Npm_outcome>;
|
|
25
|
+
env?: Env;
|
|
26
|
+
now?: () => Date;
|
|
27
|
+
platform?: NodeJS.Platform;
|
|
28
|
+
progress?: (message: string) => void;
|
|
29
|
+
};
|
|
30
|
+
declare const run_install: (opts?: {
|
|
31
|
+
dry_run?: boolean;
|
|
32
|
+
}, deps?: Install_deps) => Promise<Install_report>;
|
|
33
|
+
export { run_install };
|
|
34
|
+
export type { Install_report, Install_action, Install_deps };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run_install = void 0;
|
|
4
|
+
const cache_1 = require("./cache");
|
|
5
|
+
const detect_1 = require("./detect");
|
|
6
|
+
const releases_1 = require("./releases");
|
|
7
|
+
const npm_1 = require("./npm");
|
|
8
|
+
const routes_1 = require("./routes");
|
|
9
|
+
const semver_1 = require("./semver");
|
|
10
|
+
// Elevation differs per platform and is never done for the user: we print what
|
|
11
|
+
// they would have to run, and leave the decision with them.
|
|
12
|
+
const elevated = (command, platform) => platform === 'win32' ? command : `sudo ${command}`;
|
|
13
|
+
const failure_detail = (outcome, platform) => {
|
|
14
|
+
if (outcome.npm_missing) {
|
|
15
|
+
return 'npm is not on PATH';
|
|
16
|
+
}
|
|
17
|
+
if (outcome.permission_denied) {
|
|
18
|
+
// Windows has no sudo to prepend, so the command alone would leave the
|
|
19
|
+
// user with nothing to change on a second attempt.
|
|
20
|
+
const remedy = platform === 'win32' ? '; try an elevated terminal' : '';
|
|
21
|
+
return `npm exited with code ${outcome.code} (permission denied${remedy})`;
|
|
22
|
+
}
|
|
23
|
+
return `npm exited with code ${outcome.code}`;
|
|
24
|
+
};
|
|
25
|
+
const run_install = async (opts = {}, deps = {}) => {
|
|
26
|
+
const install = deps.install ?? (0, detect_1.how_installed)();
|
|
27
|
+
const platform = deps.platform ?? process.platform;
|
|
28
|
+
const release = await (deps.release ?? releases_1.latest_release)(install.channel);
|
|
29
|
+
const now = (deps.now ?? (() => new Date()))();
|
|
30
|
+
try {
|
|
31
|
+
(0, cache_1.write_check_cache)({
|
|
32
|
+
version: 1,
|
|
33
|
+
channel: install.channel,
|
|
34
|
+
latest: release.version,
|
|
35
|
+
checked_at: now.toISOString(),
|
|
36
|
+
}, deps.env);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// A cache we could not write costs one HTTP request later. It is never
|
|
40
|
+
// a reason to fail an update the user asked for.
|
|
41
|
+
}
|
|
42
|
+
const route = (0, routes_1.route_for)(install);
|
|
43
|
+
// Field order is part of what `--json` readers see, so it is built in one
|
|
44
|
+
// place rather than spread differently per branch.
|
|
45
|
+
const report = (action, command, detail, npm_output) => ({
|
|
46
|
+
current: install.version,
|
|
47
|
+
latest: release.version,
|
|
48
|
+
up_to_date: action === 'current',
|
|
49
|
+
action,
|
|
50
|
+
channel: install.channel,
|
|
51
|
+
install: { kind: install.kind, package: install.package_name, path: install.module_dir },
|
|
52
|
+
command,
|
|
53
|
+
note: route.note,
|
|
54
|
+
...(detail ? { detail } : {}),
|
|
55
|
+
...(npm_output ? { npm_output } : {}),
|
|
56
|
+
});
|
|
57
|
+
if (!(0, semver_1.is_newer)(release.version, install.version)) {
|
|
58
|
+
return report('current', route.command);
|
|
59
|
+
}
|
|
60
|
+
if (opts.dry_run || !route.drivable) {
|
|
61
|
+
return report('manual', route.command);
|
|
62
|
+
}
|
|
63
|
+
deps.progress?.(`${install.version} → ${release.version}, updating with npm…`);
|
|
64
|
+
const outcome = await (deps.run_npm ?? (pkg => (0, npm_1.run_npm_install)(pkg)))(install.package_name);
|
|
65
|
+
if (outcome.ok) {
|
|
66
|
+
return report('updated', route.command);
|
|
67
|
+
}
|
|
68
|
+
return report('failed', outcome.permission_denied ? elevated(route.command, platform) : route.command, failure_detail(outcome, platform),
|
|
69
|
+
// npm's own words are what makes an unexpected failure diagnosable;
|
|
70
|
+
// carried only when it failed, so a normal run stays quiet.
|
|
71
|
+
outcome.output_tail || undefined);
|
|
72
|
+
};
|
|
73
|
+
exports.run_install = run_install;
|
|
74
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/selfupdate/install.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAC1C,qCAAuC;AACvC,yCAA0C;AAC1C,+BAAsC;AACtC,qCAAmC;AACnC,qCAAkC;AAsClC,+EAA+E;AAC/E,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,QAAyB,EAAS,EAAE,CACnE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,OAAO,EAAE,CAAC;AAEvD,MAAM,cAAc,GAAG,CAAC,OAAoB,EAAE,QAAyB,EAAS,EAAE;IAC9E,IAAI,OAAO,CAAC,WAAW,EACvB,CAAC;QACG,OAAO,oBAAoB,CAAC;IAChC,CAAC;IACD,IAAI,OAAO,CAAC,iBAAiB,EAC7B,CAAC;QACG,uEAAuE;QACvE,mDAAmD;QACnD,MAAM,MAAM,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,wBAAwB,OAAO,CAAC,IAAI,sBAAsB,MAAM,GAAG,CAAC;IAC/E,CAAC;IACD,OAAO,wBAAwB,OAAO,CAAC,IAAI,EAAE,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,KAAK,EACrB,OAA4B,EAAE,EAC9B,OAAqB,EAAE,EACD,EAAE;IACxB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAA,sBAAa,GAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,yBAAc,CAAC,CAAC,OAAO,CAAC,OAAO,CAA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,CAAC;QACG,OAAO,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EACnC,CAAC;QACG,OAAO,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,MAAM,OAAO,CAAC,OAAO,sBAAsB,CAAC,CAAC;IAC/E,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,CAAA,EAAE,CAAA,IAAA,qBAAe,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1F,IAAI,OAAO,CAAC,EAAE,EACd,CAAC;QACG,OAAO,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,MAAM,CACT,QAAQ,EACR,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAC7E,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC;IACjC,oEAAoE;IACpE,4DAA4D;IAC5D,OAAO,CAAC,WAAW,IAAI,SAAS,CACnC,CAAC;AACN,CAAC,CAAC;AAEM,kCAAW"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Env } from '../config';
|
|
2
|
+
import type { Channel, Install_info, Release } from './types';
|
|
3
|
+
type Notice_deps = {
|
|
4
|
+
json?: boolean;
|
|
5
|
+
quiet?: boolean;
|
|
6
|
+
tty?: boolean;
|
|
7
|
+
env?: Env;
|
|
8
|
+
now?: () => Date;
|
|
9
|
+
install?: Install_info;
|
|
10
|
+
release?: (channel: Channel) => Promise<Release>;
|
|
11
|
+
};
|
|
12
|
+
declare const hint_for: (current: string, latest: string) => string;
|
|
13
|
+
declare const update_notice: (deps?: Notice_deps) => Promise<string | undefined>;
|
|
14
|
+
export { update_notice, hint_for };
|
|
15
|
+
export type { Notice_deps };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hint_for = exports.update_notice = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const cache_1 = require("./cache");
|
|
6
|
+
const detect_1 = require("./detect");
|
|
7
|
+
const releases_1 = require("./releases");
|
|
8
|
+
const semver_1 = require("./semver");
|
|
9
|
+
const truthy = (value) => value !== undefined && value !== '' && value !== '0' && value.toLowerCase() !== 'false';
|
|
10
|
+
const suppressed = (deps, install) => {
|
|
11
|
+
const env = deps.env ?? process.env;
|
|
12
|
+
// A checkout sits on 0.0.0-development and belongs to whoever cuts the
|
|
13
|
+
// releases; telling them about one is noise.
|
|
14
|
+
return Boolean(deps.json)
|
|
15
|
+
|| Boolean(deps.quiet)
|
|
16
|
+
|| (deps.tty ?? process.stderr.isTTY) !== true
|
|
17
|
+
|| truthy(env.CI)
|
|
18
|
+
|| truthy(env.GITHUB_ACTIONS)
|
|
19
|
+
|| truthy(env.REPLY_NO_UPDATE_CHECK)
|
|
20
|
+
|| install.kind === 'source';
|
|
21
|
+
};
|
|
22
|
+
const hint_for = (current, latest) => `${config_1.PROGRAM_NAME} ${current} → ${latest} available · run \`${config_1.PROGRAM_NAME} install\``;
|
|
23
|
+
exports.hint_for = hint_for;
|
|
24
|
+
const update_notice = async (deps = {}) => {
|
|
25
|
+
const install = deps.install ?? (0, detect_1.how_installed)();
|
|
26
|
+
if (suppressed(deps, install)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const now = (deps.now ?? (() => new Date()))();
|
|
30
|
+
const cached = (0, cache_1.read_check_cache)(deps.env);
|
|
31
|
+
if ((0, cache_1.cache_is_fresh)(cached, install.channel, now)) {
|
|
32
|
+
const latest = cached?.latest;
|
|
33
|
+
return latest && (0, semver_1.is_newer)(latest, install.version)
|
|
34
|
+
? hint_for(install.version, latest)
|
|
35
|
+
: undefined;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const release = await (deps.release ?? releases_1.latest_release)(install.channel);
|
|
39
|
+
(0, cache_1.write_check_cache)({
|
|
40
|
+
version: 1,
|
|
41
|
+
channel: install.channel,
|
|
42
|
+
latest: release.version,
|
|
43
|
+
checked_at: now.toISOString(),
|
|
44
|
+
}, deps.env);
|
|
45
|
+
return (0, semver_1.is_newer)(release.version, install.version)
|
|
46
|
+
? hint_for(install.version, release.version)
|
|
47
|
+
: undefined;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Offline, rate-limited, or slow: record the attempt so we back off,
|
|
51
|
+
// and say nothing. A hint is never worth a delay or an error.
|
|
52
|
+
try {
|
|
53
|
+
(0, cache_1.write_check_cache)({
|
|
54
|
+
version: 1,
|
|
55
|
+
channel: install.channel,
|
|
56
|
+
latest: cached?.latest,
|
|
57
|
+
failed_at: now.toISOString(),
|
|
58
|
+
}, deps.env);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Nothing left to do — a cache we cannot write only costs a retry.
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.update_notice = update_notice;
|
|
67
|
+
//# sourceMappingURL=notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notice.js","sourceRoot":"","sources":["../../src/selfupdate/notice.ts"],"names":[],"mappings":";;;AAAA,sCAAuC;AACvC,mCAA4E;AAC5E,qCAAuC;AACvC,yCAA0C;AAC1C,qCAAkC;AAmBlC,MAAM,MAAM,GAAG,CAAC,KAAyB,EAAU,EAAE,CACjD,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,IAAI,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|
|
|
1
|
+
type Npm_result = {
|
|
2
|
+
code: number;
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
};
|
|
6
|
+
type Npm_runner = (args: string[]) => Promise<Npm_result>;
|
|
7
|
+
type Npm_outcome = {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
code: number;
|
|
10
|
+
output_tail: string;
|
|
11
|
+
permission_denied: boolean;
|
|
12
|
+
npm_missing: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const TAIL_BYTES = 8000;
|
|
15
|
+
declare const default_npm_runner: Npm_runner;
|
|
16
|
+
declare const run_npm_install: (package_name: string, deps?: {
|
|
17
|
+
run?: Npm_runner;
|
|
18
|
+
}) => Promise<Npm_outcome>;
|
|
19
|
+
export { run_npm_install, default_npm_runner, TAIL_BYTES };
|
|
20
|
+
export type { Npm_runner, Npm_result, Npm_outcome };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TAIL_BYTES = exports.default_npm_runner = exports.run_npm_install = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const detect_1 = require("./detect");
|
|
6
|
+
const errors_1 = require("../utils/errors");
|
|
7
|
+
const TAIL_BYTES = 8000;
|
|
8
|
+
exports.TAIL_BYTES = TAIL_BYTES;
|
|
9
|
+
// npm is a .cmd on Windows, which Node refuses to spawn directly since the
|
|
10
|
+
// CVE-2024-27980 fix — hence the shell there, and only there.
|
|
11
|
+
const default_npm_runner = args => new Promise(resolve => {
|
|
12
|
+
(0, child_process_1.execFile)('npm', args, {
|
|
13
|
+
encoding: 'utf8',
|
|
14
|
+
windowsHide: true,
|
|
15
|
+
shell: process.platform === 'win32',
|
|
16
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
17
|
+
}, (error, stdout, stderr) => {
|
|
18
|
+
const code = error && typeof error.code === 'number'
|
|
19
|
+
? error.code
|
|
20
|
+
: (error ? 1 : 0);
|
|
21
|
+
const message = error ? `${error.message}\n` : '';
|
|
22
|
+
resolve({ code, stdout: stdout ?? '', stderr: `${message}${stderr ?? ''}` });
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
exports.default_npm_runner = default_npm_runner;
|
|
26
|
+
const tail_of = (result) => `${result.stdout}\n${result.stderr}`.trim().slice(-TAIL_BYTES);
|
|
27
|
+
const run_npm_install = async (package_name, deps = {}) => {
|
|
28
|
+
if (package_name !== detect_1.PUBLIC_PACKAGE && package_name !== detect_1.INTERNAL_PACKAGE) {
|
|
29
|
+
// Refusing here rather than in the caller keeps the guarantee local to
|
|
30
|
+
// the one function that can spawn a process.
|
|
31
|
+
throw new errors_1.UsageError(`Refusing to run npm for an unrecognised package: ${package_name || '(none)'}`, {
|
|
32
|
+
code: 'update.unknown_package',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const run = deps.run ?? default_npm_runner;
|
|
36
|
+
const result = await run(['install', '-g', `${package_name}@latest`]);
|
|
37
|
+
const output_tail = tail_of(result);
|
|
38
|
+
return {
|
|
39
|
+
ok: result.code === 0,
|
|
40
|
+
code: result.code,
|
|
41
|
+
output_tail,
|
|
42
|
+
permission_denied: /EACCES|EPERM|permission denied/i.test(output_tail),
|
|
43
|
+
npm_missing: /ENOENT|not recognized as an internal|command not found/i.test(output_tail),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.run_npm_install = run_npm_install;
|
|
47
|
+
//# sourceMappingURL=npm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/selfupdate/npm.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AACvC,qCAA0D;AAC1D,4CAA2C;AAsB3C,MAAM,UAAU,GAAG,IAAI,CAAC;AA8CqB,gCAAU;AA5CvD,2EAA2E;AAC3E,8DAA8D;AAC9D,MAAM,kBAAkB,GAAe,IAAI,CAAA,EAAE,CAAA,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AE;YACjG,IAAI,EAAE,wBAAwB;SACjC,CAAC,CAAC;IACP,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,kBAAkB,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG,YAAY,SAAS,CAAC,CAAC,CAAC;IACtE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO;QACH,EAAE,EAAE,MAAM,CAAC,IAAI,KAAK,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW;QACX,iBAAiB,EAAE,iCAAiC,CAAC,IAAI,CAAC,WAAW,CAAC;QACtE,WAAW,EAAE,yDAAyD,CAAC,IAAI,CAAC,WAAW,CAAC;KAC3F,CAAC;AACN,CAAC,CAAC;AAEM,0CAAe"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Channel, Release } from './types';
|
|
2
|
+
declare const REPO = "reply-team/reply-cli";
|
|
3
|
+
declare const TIMEOUT_MS = 1500;
|
|
4
|
+
type Fetch_response = {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
status: number;
|
|
7
|
+
json: () => Promise<unknown>;
|
|
8
|
+
};
|
|
9
|
+
type Fetch_like = (url: string, init?: {
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
}) => Promise<Fetch_response>;
|
|
13
|
+
type Releases_deps = {
|
|
14
|
+
fetch?: Fetch_like;
|
|
15
|
+
timeout_ms?: number;
|
|
16
|
+
};
|
|
17
|
+
declare const latest_release: (channel: Channel, deps?: Releases_deps) => Promise<Release>;
|
|
18
|
+
export { latest_release, REPO, TIMEOUT_MS };
|
|
19
|
+
export type { Fetch_like, Fetch_response, Releases_deps };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TIMEOUT_MS = exports.REPO = exports.latest_release = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const errors_1 = require("../utils/errors");
|
|
6
|
+
const semver_1 = require("./semver");
|
|
7
|
+
// The version of record is the git tag, not a registry: package.json in the
|
|
8
|
+
// repository is deliberately 0.0.0-development and semantic-release stamps the
|
|
9
|
+
// real version at publish time. Asking GitHub is also one code path for both
|
|
10
|
+
// channels, needs no token, and costs no npm subprocess.
|
|
11
|
+
//
|
|
12
|
+
// Safe for the public channel because the publish workflow flips a Release to
|
|
13
|
+
// "latest" only after `npm publish` succeeds — a hit here means npm has it.
|
|
14
|
+
const REPO = 'reply-team/reply-cli';
|
|
15
|
+
exports.REPO = REPO;
|
|
16
|
+
const API = 'https://api.github.com';
|
|
17
|
+
// Long enough for a cold TLS handshake, short enough that `reply --version`
|
|
18
|
+
// never feels like it hung. A check that cannot answer fast is discarded.
|
|
19
|
+
const TIMEOUT_MS = 1500;
|
|
20
|
+
exports.TIMEOUT_MS = TIMEOUT_MS;
|
|
21
|
+
const headers = () => ({
|
|
22
|
+
Accept: 'application/vnd.github+json',
|
|
23
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
24
|
+
// GitHub rejects API requests that do not identify themselves.
|
|
25
|
+
'User-Agent': (0, config_1.user_agent)(),
|
|
26
|
+
});
|
|
27
|
+
// /releases/latest excludes pre-releases by design, which is exactly the
|
|
28
|
+
// promoted public build. The internal stream IS the pre-release stream, so it
|
|
29
|
+
// has to come off the unfiltered list.
|
|
30
|
+
const url_for = (channel) => channel === 'public'
|
|
31
|
+
? `${API}/repos/${REPO}/releases/latest`
|
|
32
|
+
: `${API}/repos/${REPO}/releases?per_page=1`;
|
|
33
|
+
const latest_release = async (channel, deps = {}) => {
|
|
34
|
+
const call = deps.fetch ?? globalThis.fetch;
|
|
35
|
+
const url = url_for(channel);
|
|
36
|
+
let response;
|
|
37
|
+
try {
|
|
38
|
+
response = await call(url, {
|
|
39
|
+
headers: headers(),
|
|
40
|
+
signal: AbortSignal.timeout(deps.timeout_ms ?? TIMEOUT_MS),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
throw new errors_1.RuntimeError('Could not reach GitHub to check for a newer release.', {
|
|
45
|
+
code: 'update.unreachable',
|
|
46
|
+
detail: url,
|
|
47
|
+
hint: e.message,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
if (response.status === 403 || response.status === 429) {
|
|
52
|
+
throw new errors_1.RuntimeError('GitHub is rate-limiting the update check.', {
|
|
53
|
+
code: 'update.rate_limited',
|
|
54
|
+
detail: `HTTP ${response.status}`,
|
|
55
|
+
hint: 'Unauthenticated requests are capped at 60 an hour. Try again later.',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
throw new errors_1.RuntimeError('GitHub did not return the release list.', {
|
|
59
|
+
code: 'update.http',
|
|
60
|
+
detail: `HTTP ${response.status}`,
|
|
61
|
+
hint: url,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const body = await response.json();
|
|
65
|
+
const found = (channel === 'public'
|
|
66
|
+
? body
|
|
67
|
+
: (Array.isArray(body) ? body[0] : undefined));
|
|
68
|
+
if (!found || typeof found !== 'object') {
|
|
69
|
+
throw new errors_1.RuntimeError('GitHub reported no releases for this channel.', {
|
|
70
|
+
code: 'update.no_release',
|
|
71
|
+
detail: url,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const tag = typeof found.tag_name === 'string' ? found.tag_name : '';
|
|
75
|
+
if (!(0, semver_1.parse_version)(tag)) {
|
|
76
|
+
throw new errors_1.RuntimeError('The newest release is not tagged with a version.', {
|
|
77
|
+
code: 'update.bad_release',
|
|
78
|
+
detail: tag || '(no tag)',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
version: tag.replace(/^v/, ''),
|
|
83
|
+
tag,
|
|
84
|
+
url: typeof found.html_url === 'string' && found.html_url
|
|
85
|
+
? found.html_url
|
|
86
|
+
: `https://github.com/${REPO}/releases/tag/${tag}`,
|
|
87
|
+
prerelease: found.prerelease === true,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
exports.latest_release = latest_release;
|
|
91
|
+
//# sourceMappingURL=releases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"releases.js","sourceRoot":"","sources":["../../src/selfupdate/releases.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,4CAA6C;AAC7C,qCAAuC;AAGvC,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,yDAAyD;AACzD,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAE5E,MAAM,IAAI,GAAG,sBAAsB,CAAC;AAwGZ,oBAAI;AAvG5B,MAAM,GAAG,GAAG,wBAAwB,CAAC;AAErC,4EAA4E;AAC5E,0EAA0E;AAC1E,MAAM,UAAU,GAAG,IAAI,CAAC;AAmGM,gCAAU;AA3ExC,MAAM,OAAO,GAAG,GAA0B,EAAE,CAAA,CAAC;IACzC,MAAM,EAAE,6BAA6B;IACrC,sBAAsB,EAAE,YAAY;IACpC,+DAA+D;IAC/D,YAAY,EAAE,IAAA,mBAAU,GAAE;CAC7B,CAAC,CAAC;AAEH,yEAAyE;AACzE,8EAA8E;AAC9E,uCAAuC;AACvC,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAS,EAAE,CAAA,OAAO,KAAK,QAAQ;IAC5D,CAAC,CAAC,GAAG,GAAG,UAAU,IAAI,kBAAkB;IACxC,CAAC,CAAC,GAAG,GAAG,UAAU,IAAI,sBAAsB,CAAC;AAEjD,MAAM,cAAc,GAAG,KAAK,EAAC,OAAgB,EAAE,OAAsB,EAAE,EAAmB,EAAE;IACxF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,IAAK,UAAU,CAAC,KAA+B,CAAC;IACvE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CA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K,IAAI,OAAO,KAAK,KAAK,QAAQ,EACvC,CAAC;QACG,MAAM,IAAI,qBAAY,CAAC,+CAA+C,EAAE;YACpE,IAAI,EAAE,mBAAmB;YACzB,MAAM,EAAE,GAAG;SACd,CAAC,CAAC;IACP,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,IAAI,CAAC,IAAA,sBAAa,EAAC,GAAG,CAAC,EACvB,CAAC;QACG,MAAM,IAAI,qBAAY,CAAC,kDAAkD,EAAE;YACvE,IAAI,EAAE,oBAAoB;YAC1B,MAAM,EAAE,GAAG,IAAI,UAAU;SAC5B,CAAC,CAAC;IACP,CAAC;IACD,OAAO;QACH,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,GAAG;QACH,GAAG,EAAE,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ;YACrD,CAAC,CAAC,KAAK,CAAC,QAAQ;YAChB,CAAC,CAAC,sBAAsB,IAAI,iBAAiB,GAAG,EAAE;QACtD,UAAU,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI;KACxC,CAAC;AACN,CAAC,CAAC;AAEM,wCAAc"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REGISTRY_LINE = exports.route_for = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const detect_1 = require("./detect");
|
|
6
|
+
// What `reply install` may do about each kind of install, and what it tells the
|
|
7
|
+
// user when the answer is "nothing". Only a global npm install is ours to
|
|
8
|
+
// drive; everything else belongs to a project, a cache, or a checkout, and
|
|
9
|
+
// touching it would be the corruption this command exists to avoid.
|
|
10
|
+
// The internal package is not on npmjs, and this line is the piece people miss.
|
|
11
|
+
const REGISTRY_LINE = '@reply-team:registry=https://npm.pkg.github.com';
|
|
12
|
+
exports.REGISTRY_LINE = REGISTRY_LINE;
|
|
13
|
+
const internal_hint = () => `The internal package needs "${REGISTRY_LINE}" in your .npmrc and a token with read:packages.`;
|
|
14
|
+
const route_for = (install) => {
|
|
15
|
+
// An unrecognised copy still gets a useful command: the public package is
|
|
16
|
+
// what a stranger to this layout most likely wants.
|
|
17
|
+
const pkg = install.package_name || detect_1.PUBLIC_PACKAGE;
|
|
18
|
+
const suffix = install.channel === 'internal' ? ` ${internal_hint()}` : '';
|
|
19
|
+
const routes = {
|
|
20
|
+
'npm-global': {
|
|
21
|
+
drivable: true,
|
|
22
|
+
command: `npm install -g ${pkg}@latest`,
|
|
23
|
+
note: `Installed globally with npm (${install.module_dir}).${suffix}`,
|
|
24
|
+
},
|
|
25
|
+
'npm-local': {
|
|
26
|
+
drivable: false,
|
|
27
|
+
command: `npm install ${pkg}@latest`,
|
|
28
|
+
note: `Installed inside a project (${install.module_dir}), so it is that project's to update.`
|
|
29
|
+
+ ` Run the command there.${suffix}`,
|
|
30
|
+
},
|
|
31
|
+
npx: {
|
|
32
|
+
drivable: false,
|
|
33
|
+
command: `npx ${pkg}@latest`,
|
|
34
|
+
note: 'Running through npx, which resolves the newest published version on each run —'
|
|
35
|
+
+ ' there is no installed copy to update.',
|
|
36
|
+
},
|
|
37
|
+
source: {
|
|
38
|
+
drivable: false,
|
|
39
|
+
command: 'git pull && npm ci && npm run build',
|
|
40
|
+
note: `Running from a source checkout (${install.module_dir}).`,
|
|
41
|
+
},
|
|
42
|
+
unknown: {
|
|
43
|
+
drivable: false,
|
|
44
|
+
command: `npm install -g ${pkg}@latest`,
|
|
45
|
+
note: `Could not tell how this copy was installed (${install.module_dir}),`
|
|
46
|
+
+ ` so ${config_1.PROGRAM_NAME} will not change it.${suffix}`,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
return routes[install.kind];
|
|
50
|
+
};
|
|
51
|
+
exports.route_for = route_for;
|
|
52
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/selfupdate/routes.ts"],"names":[],"mappings":";;;AAAA,sCAAuC;AACvC,qCAAwC;AAGxC,gFAAgF;AAChF,0EAA0E;AAC1E,2EAA2E;AAC3E,oEAAoE;AAEpE,gFAAgF;AAChF,MAAM,aAAa,GAAG,iDAAiD,CAAC;AA2CrD,sCAAa;AAzChC,MAAM,aAAa,GAAG,GAAU,EAAE,CAC9B,+BAA+B,aAAa,kDAAkD,CAAC;AAEnG,MAAM,SAAS,GAAG,CAAC,OAAqB,EAAQ,EAAE;IAC9C,0EAA0E;IAC1E,oDAAoD;IACpD,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,IAAI,uBAAc,CAAC;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,MAAM,GAAgC;QACxC,YAAY,EAAE;YACV,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,kBAAkB,GAAG,SAAS;YACvC,IAAI,EAAE,gCAAgC,OAAO,CAAC,UAAU,KAAK,MAAM,EAAE;SACxE;QACD,WAAW,EAAE;YACT,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,eAAe,GAAG,SAAS;YACpC,IAAI,EAAE,+BAA+B,OAAO,CAAC,UAAU,uCAAuC;kBACxF,0BAA0B,MAAM,EAAE;SAC3C;QACD,GAAG,EAAE;YACD,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,OAAO,GAAG,SAAS;YAC5B,IAAI,EAAE,gFAAgF;kBAChF,wCAAwC;SACjD;QACD,MAAM,EAAE;YACJ,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,qCAAqC;YAC9C,IAAI,EAAE,mCAAmC,OAA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