@lumpcode/core 0.0.9 → 0.0.11
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/helpers/executeStepsForContextList/main.d.ts.map +1 -1
- package/dist/helpers/getContextStatus/main.d.ts.map +1 -1
- package/dist/index.cjs +35 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -51
- package/dist/index.js.map +1 -1
- package/dist/utils/appendMissingGitignoreLines/index.d.ts +2 -0
- package/dist/utils/appendMissingGitignoreLines/index.d.ts.map +1 -0
- package/dist/utils/appendMissingGitignoreLines/main.d.ts +6 -0
- package/dist/utils/appendMissingGitignoreLines/main.d.ts.map +1 -0
- package/dist/utils/historyFile/main.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/isProcessAlive/index.d.ts +2 -0
- package/dist/utils/isProcessAlive/index.d.ts.map +1 -0
- package/dist/utils/isProcessAlive/main.d.ts +6 -0
- package/dist/utils/isProcessAlive/main.d.ts.map +1 -0
- package/dist/utils/nodeErrnoCode/index.d.ts +2 -0
- package/dist/utils/nodeErrnoCode/index.d.ts.map +1 -0
- package/dist/utils/nodeErrnoCode/main.d.ts +3 -0
- package/dist/utils/nodeErrnoCode/main.d.ts.map +1 -0
- package/dist/utils/parseGitLogHashSubjectLines/index.d.ts +2 -0
- package/dist/utils/parseGitLogHashSubjectLines/index.d.ts.map +1 -0
- package/dist/utils/parseGitLogHashSubjectLines/main.d.ts +7 -0
- package/dist/utils/parseGitLogHashSubjectLines/main.d.ts.map +1 -0
- package/dist/utils/pathExists/index.d.ts +2 -0
- package/dist/utils/pathExists/index.d.ts.map +1 -0
- package/dist/utils/pathExists/main.d.ts +3 -0
- package/dist/utils/pathExists/main.d.ts.map +1 -0
- package/dist/utils/readJsonFile/index.d.ts +2 -0
- package/dist/utils/readJsonFile/index.d.ts.map +1 -0
- package/dist/utils/readJsonFile/main.d.ts +21 -0
- package/dist/utils/readJsonFile/main.d.ts.map +1 -0
- package/dist/utils/resolveBundledAssetPath/index.d.ts +2 -0
- package/dist/utils/resolveBundledAssetPath/index.d.ts.map +1 -0
- package/dist/utils/resolveBundledAssetPath/main.d.ts +3 -0
- package/dist/utils/resolveBundledAssetPath/main.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/executeStepsForContextList/main.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EACX,eAAe,EACf,OAAO,EACP,MAAM,EAIT,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,gCAAgC,GAAG,QAAQ,CAAC,IAAI,CACxD,YAAY,EACV,YAAY,GACZ,UAAU,GACV,eAAe,GACf,OAAO,GACP,SAAS,GACT,YAAY,GACZ,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,kBAAkB,GAClB,qBAAqB,GACrB,0BAA0B,CAC/B,CAAC,GAAG;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,wBAAsB,0BAA0B,CAAC,EAC7C,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,EAAE,WAAW,GACtB,EAAE,gCAAgC;aAqEa,MAAM;;;;;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/executeStepsForContextList/main.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EACX,eAAe,EACf,OAAO,EACP,MAAM,EAIT,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,gCAAgC,GAAG,QAAQ,CAAC,IAAI,CACxD,YAAY,EACV,YAAY,GACZ,UAAU,GACV,eAAe,GACf,OAAO,GACP,SAAS,GACT,YAAY,GACZ,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,kBAAkB,GAClB,qBAAqB,GACrB,0BAA0B,CAC/B,CAAC,GAAG;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,wBAAsB,0BAA0B,CAAC,EAC7C,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,EAAE,WAAW,GACtB,EAAE,gCAAgC;aAqEa,MAAM;;;;;IAqOrD;AAED,MAAM,MAAM,gCAAgC,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/getContextStatus/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIpE,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/getContextStatus/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIpE,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmEzB"}
|
package/dist/index.cjs
CHANGED
|
@@ -59,18 +59,6 @@ function failure(data) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function decision(possibilities, defaultValue) {
|
|
63
|
-
for (const [condition, result] of possibilities) {
|
|
64
|
-
if (condition()) {
|
|
65
|
-
return result();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (defaultValue) {
|
|
69
|
-
return defaultValue;
|
|
70
|
-
}
|
|
71
|
-
throw new Error('No value found in decision');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
62
|
/**
|
|
75
63
|
* Wrap an arbitrary string in quotes so it can be safely embedded in
|
|
76
64
|
* a shell command (e.g. the command string passed to `execAsync`).
|
|
@@ -85,18 +73,6 @@ function shellSingleQuote(value) {
|
|
|
85
73
|
return `'${value.split("'").join(`'\\''`)}'`;
|
|
86
74
|
}
|
|
87
75
|
|
|
88
|
-
/**
|
|
89
|
-
* Wrap a shell fragment so failure does not break a surrounding `&&` chain.
|
|
90
|
-
*
|
|
91
|
-
* Unix: `cmd || true`. Windows cmd.exe: `(cmd || cd .)`.
|
|
92
|
-
*/
|
|
93
|
-
function shellBestEffort(command) {
|
|
94
|
-
if (process.platform === 'win32') {
|
|
95
|
-
return `(${command} || cd .)`;
|
|
96
|
-
}
|
|
97
|
-
return `${command} || true`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
76
|
const DEFAULT_WINDOWS_PATHEXT = [
|
|
101
77
|
'.COM',
|
|
102
78
|
'.EXE',
|
|
@@ -247,14 +223,6 @@ function createConsoleLogger(input) {
|
|
|
247
223
|
return makeLogger(prefix);
|
|
248
224
|
}
|
|
249
225
|
|
|
250
|
-
const noopLogger = {
|
|
251
|
-
error: () => { },
|
|
252
|
-
warn: () => { },
|
|
253
|
-
info: () => { },
|
|
254
|
-
verbose: () => { },
|
|
255
|
-
child: () => noopLogger,
|
|
256
|
-
};
|
|
257
|
-
|
|
258
226
|
function firstNonEmptyLine(value) {
|
|
259
227
|
if (value == null)
|
|
260
228
|
return undefined;
|
|
@@ -3186,6 +3154,17 @@ function dump(input, options = {}) {
|
|
|
3186
3154
|
});
|
|
3187
3155
|
}
|
|
3188
3156
|
|
|
3157
|
+
/** Returns whether `filePath` is accessible to this process (typically exists). */
|
|
3158
|
+
async function pathExists(filePath) {
|
|
3159
|
+
try {
|
|
3160
|
+
await fs__namespace$1.access(filePath);
|
|
3161
|
+
return true;
|
|
3162
|
+
}
|
|
3163
|
+
catch {
|
|
3164
|
+
return false;
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3189
3168
|
function historyFormatFromPath(filePath) {
|
|
3190
3169
|
const ext = path.extname(filePath).toLowerCase();
|
|
3191
3170
|
if (ext === '.yaml' || ext === '.yml') {
|
|
@@ -3272,7 +3251,7 @@ async function appendHistoryEntry({ filePath, entry, }) {
|
|
|
3272
3251
|
if (!formatResult.success) {
|
|
3273
3252
|
return formatResult;
|
|
3274
3253
|
}
|
|
3275
|
-
const exists = await
|
|
3254
|
+
const exists = await pathExists(filePath);
|
|
3276
3255
|
let entries;
|
|
3277
3256
|
if (exists) {
|
|
3278
3257
|
const readResult = await readHistoryFile({ filePath });
|
|
@@ -3289,6 +3268,21 @@ async function appendHistoryEntry({ filePath, entry, }) {
|
|
|
3289
3268
|
return writeHistoryFile({ filePath, entries });
|
|
3290
3269
|
}
|
|
3291
3270
|
|
|
3271
|
+
/** Parses `git log --format='%H %s'` lines into commit hash and subject pairs. */
|
|
3272
|
+
function parseGitLogHashSubjectLines(stdout) {
|
|
3273
|
+
return stdout
|
|
3274
|
+
.split('\n')
|
|
3275
|
+
.map((line) => line.trim())
|
|
3276
|
+
.filter(Boolean)
|
|
3277
|
+
.map((line) => {
|
|
3278
|
+
const sp = line.indexOf(' ');
|
|
3279
|
+
return {
|
|
3280
|
+
hash: sp === -1 ? line : line.slice(0, sp),
|
|
3281
|
+
subject: sp === -1 ? '' : line.slice(sp + 1),
|
|
3282
|
+
};
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3292
3286
|
const execAsyncBase = node_util.promisify(node_child_process.exec);
|
|
3293
3287
|
async function execAsync(command, options) {
|
|
3294
3288
|
const { stdout, stderr, hasErrored } = await execAsyncBase(command, { cwd: options?.cwd })
|
|
@@ -3584,8 +3578,8 @@ async function executeStepsForContextList({ baseBranch, branchFn, lumpVariables,
|
|
|
3584
3578
|
entry: postCommandExecFnInput,
|
|
3585
3579
|
});
|
|
3586
3580
|
if (!appendResult.success) {
|
|
3587
|
-
|
|
3588
|
-
|
|
3581
|
+
// TODO: sanitize history appending to avoid this warning for certain commands outputs
|
|
3582
|
+
logger.warn(`Failed to append history entry to ${keepHistoryFilePath}: ${appendResult.data}`);
|
|
3589
3583
|
}
|
|
3590
3584
|
}
|
|
3591
3585
|
if (postCommandExecFn) {
|
|
@@ -3675,7 +3669,7 @@ async function getGitignoresMap({ startDir, stopAtDir }) {
|
|
|
3675
3669
|
const stopAtDirParent = path__namespace.dirname(stopAtDir);
|
|
3676
3670
|
while (currentDir !== stopAtDirParent) {
|
|
3677
3671
|
const gitignorePath = path__namespace.join(currentDir, '.gitignore');
|
|
3678
|
-
const hasGitignore = await
|
|
3672
|
+
const hasGitignore = await pathExists(gitignorePath);
|
|
3679
3673
|
if (hasGitignore) {
|
|
3680
3674
|
const gitignoreContent = await fs__namespace$1.readFile(gitignorePath, 'utf-8');
|
|
3681
3675
|
gitignores.set(currentDir, ignore().add(gitignoreContent));
|
|
@@ -3742,19 +3736,9 @@ async function getContextStatus(params) {
|
|
|
3742
3736
|
return 'toDo';
|
|
3743
3737
|
logger?.verbose(`logResult ${JSON.stringify(logResult.data)}`);
|
|
3744
3738
|
const logResultOutput = logResult.data.stdout || logResult.data.stderr || '';
|
|
3745
|
-
const matchingHashes = logResultOutput
|
|
3746
|
-
.
|
|
3747
|
-
.map((
|
|
3748
|
-
.filter((line) => !!line)
|
|
3749
|
-
.map((line) => {
|
|
3750
|
-
const sp = line ? line.indexOf(' ') : -1;
|
|
3751
|
-
return {
|
|
3752
|
-
hash: sp === -1 ? line : line.slice(0, sp),
|
|
3753
|
-
subject: sp === -1 ? '' : line.slice(sp + 1),
|
|
3754
|
-
};
|
|
3755
|
-
})
|
|
3756
|
-
.filter((c) => c.subject === commitMessage)
|
|
3757
|
-
.map((c) => c.hash);
|
|
3739
|
+
const matchingHashes = parseGitLogHashSubjectLines(logResultOutput)
|
|
3740
|
+
.filter((entry) => entry.subject === commitMessage)
|
|
3741
|
+
.map((entry) => entry.hash);
|
|
3758
3742
|
logger?.verbose(`remoteName ${remoteName}`);
|
|
3759
3743
|
logger?.verbose(`baseBranch ${baseBranch}`);
|
|
3760
3744
|
logger?.verbose(`commitMessage ${commitMessage}`);
|
|
@@ -3967,7 +3951,6 @@ exports.collectStepsForContext = collectStepsForContext;
|
|
|
3967
3951
|
exports.contextStatus = contextStatus;
|
|
3968
3952
|
exports.contextStatusSchema = contextStatusSchema;
|
|
3969
3953
|
exports.createConsoleLogger = createConsoleLogger;
|
|
3970
|
-
exports.decision = decision;
|
|
3971
3954
|
exports.defaultGitAddCommandFn = defaultGitAddCommandFn;
|
|
3972
3955
|
exports.defaultGitCommitCommandFn = defaultGitCommitCommandFn;
|
|
3973
3956
|
exports.defaultGitCommitMessageFn = defaultGitCommitMessageFn;
|
|
@@ -3985,12 +3968,12 @@ exports.getCodeBasePaths = getCodeBasePaths;
|
|
|
3985
3968
|
exports.getContextStatus = getContextStatus;
|
|
3986
3969
|
exports.getToDoContextList = getToDoContextList;
|
|
3987
3970
|
exports.historyFormatFromPath = historyFormatFromPath;
|
|
3988
|
-
exports.
|
|
3971
|
+
exports.parseGitLogHashSubjectLines = parseGitLogHashSubjectLines;
|
|
3972
|
+
exports.pathExists = pathExists;
|
|
3989
3973
|
exports.readHistoryFile = readHistoryFile;
|
|
3990
3974
|
exports.resolveSpawnExecutable = resolveSpawnExecutable;
|
|
3991
3975
|
exports.runLump = runLump;
|
|
3992
3976
|
exports.set = set;
|
|
3993
|
-
exports.shellBestEffort = shellBestEffort;
|
|
3994
3977
|
exports.shellSingleQuote = shellSingleQuote;
|
|
3995
3978
|
exports.success = success;
|
|
3996
3979
|
exports.validateContextListNames = validateContextListNames;
|