symlx 0.1.4 → 0.1.7
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 +49 -36
- package/dist/cli.js +16 -9
- package/dist/commands/link.js +66 -0
- package/dist/commands/serve copy.js +169 -0
- package/dist/commands/serve.js +32 -110
- package/dist/commands/serve_stash.js +169 -0
- package/dist/lib/bin-targets.js +23 -5
- package/dist/lib/constants.js +4 -0
- package/dist/lib/link-manager.js +37 -18
- package/dist/lib/link-result.js +22 -0
- package/dist/lib/options.js +55 -7
- package/dist/lib/schema.js +2 -4
- package/dist/lib/serve-runtime.js +81 -0
- package/dist/lib/session-store.js +50 -11
- package/dist/lib/utils.js +2 -1
- package/dist/lib/validator.js +2 -0
- package/dist/options.js +37 -0
- package/dist/ui/prompts.js +2 -2
- package/dist/ui/serve-output.js +55 -0
- package/package.json +1 -1
package/dist/options.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.binOption = exports.nonInteractiveOption = exports.binResolutionStrategyOption = exports.collisionOption = exports.binDirOption = void 0;
|
|
4
|
+
function collectBinEntry(value, previous = []) {
|
|
5
|
+
previous.push(value);
|
|
6
|
+
return previous;
|
|
7
|
+
}
|
|
8
|
+
const binDirOption = [
|
|
9
|
+
'--bin-dir <dir>',
|
|
10
|
+
'target bin directory (default: ~/.symlx/bin)',
|
|
11
|
+
];
|
|
12
|
+
exports.binDirOption = binDirOption;
|
|
13
|
+
const collisionOption = [
|
|
14
|
+
'--collision <policy>',
|
|
15
|
+
'collision mode: prompt|skip|fail|overwrite',
|
|
16
|
+
'prompt',
|
|
17
|
+
];
|
|
18
|
+
exports.collisionOption = collisionOption;
|
|
19
|
+
const binResolutionStrategyOption = [
|
|
20
|
+
'--bin-resolution-strategy <strategy>',
|
|
21
|
+
'bin precedence strategy: replace|merge',
|
|
22
|
+
'replace',
|
|
23
|
+
];
|
|
24
|
+
exports.binResolutionStrategyOption = binResolutionStrategyOption;
|
|
25
|
+
const nonInteractiveOption = [
|
|
26
|
+
'--non-interactive',
|
|
27
|
+
'disable interactive prompts',
|
|
28
|
+
false,
|
|
29
|
+
];
|
|
30
|
+
exports.nonInteractiveOption = nonInteractiveOption;
|
|
31
|
+
const binOption = [
|
|
32
|
+
'--bin <name=path>',
|
|
33
|
+
'custom bin mapping (repeatable), e.g. --bin my-cli=dist/cli.js',
|
|
34
|
+
collectBinEntry,
|
|
35
|
+
[],
|
|
36
|
+
];
|
|
37
|
+
exports.binOption = binOption;
|
package/dist/ui/prompts.js
CHANGED
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.promptCollisionResolver = promptCollisionResolver;
|
|
7
7
|
const prompts_1 = __importDefault(require("prompts"));
|
|
8
8
|
// Interactive collision resolver for --collision prompt.
|
|
9
9
|
// Returning "abort" bubbles up as an error to stop the current serve run.
|
|
10
|
-
async function
|
|
10
|
+
async function promptCollisionResolver(conflict) {
|
|
11
11
|
const response = await (0, prompts_1.default)({
|
|
12
12
|
type: 'select',
|
|
13
13
|
name: 'decision',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.printLinkOutcome = printLinkOutcome;
|
|
37
|
+
exports.printPathHintIfNeeded = printPathHintIfNeeded;
|
|
38
|
+
const utils_1 = require("../lib/utils");
|
|
39
|
+
const log = __importStar(require("./logger"));
|
|
40
|
+
function printLinkOutcome(binDir, linkResult) {
|
|
41
|
+
const createdLinks = linkResult.created;
|
|
42
|
+
log.info(`linked ${createdLinks.length} command${createdLinks.length > 1 ? 's' : ''} into ${binDir}`);
|
|
43
|
+
for (const link of createdLinks) {
|
|
44
|
+
log.info(`${link.name} -> ${link.target}`);
|
|
45
|
+
}
|
|
46
|
+
for (const skip of linkResult.skipped) {
|
|
47
|
+
log.warn(`skip "${skip.name}": ${skip.reason} (${skip.linkPath})`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function printPathHintIfNeeded(binDir, currentPath) {
|
|
51
|
+
if ((0, utils_1.pathContainsDir)(currentPath, binDir)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
log.info(`add this to your shell config if needed:\nexport PATH="${binDir}:$PATH"`);
|
|
55
|
+
}
|