litmus-cli 0.2.4 → 0.2.5
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/lib/zip.d.ts.map +1 -1
- package/dist/lib/zip.js +23 -17
- package/dist/lib/zip.js.map +1 -1
- package/package.json +4 -5
- package/src/lib/zip.ts +24 -18
package/dist/lib/zip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/lib/zip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/lib/zip.ts"],"names":[],"mappings":"AAgCA;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B7E"}
|
package/dist/lib/zip.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createWriteStream, readFileSync, existsSync } from "fs";
|
|
1
|
+
import { readFileSync, existsSync } from "fs";
|
|
3
2
|
import path from "path";
|
|
4
3
|
import os from "os";
|
|
4
|
+
import fg from "fast-glob";
|
|
5
|
+
import { Zip } from "zip-lib";
|
|
5
6
|
// Directories always excluded from submissions.
|
|
6
7
|
// NOTE: .git is intentionally NOT excluded — git history is included so the
|
|
7
8
|
// analysis backend can run parse_git_history() on the submission.
|
|
@@ -37,22 +38,27 @@ const ALWAYS_EXCLUDE = [
|
|
|
37
38
|
*/
|
|
38
39
|
export async function createSubmissionZip(projectDir) {
|
|
39
40
|
const tmpFile = path.join(os.tmpdir(), `litmus-submission-${Date.now()}.zip`);
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
archive.glob("**/*", {
|
|
50
|
-
cwd: projectDir,
|
|
51
|
-
dot: true, // Include dotfiles like .litmus/
|
|
52
|
-
ignore: ignoredGlobs,
|
|
53
|
-
});
|
|
54
|
-
archive.finalize();
|
|
41
|
+
// Compute glob patterns to ignore
|
|
42
|
+
const ignoredGlobs = buildIgnoreGlobs(projectDir);
|
|
43
|
+
// Find all files, including dotfiles
|
|
44
|
+
const files = await fg(["**/*"], {
|
|
45
|
+
cwd: projectDir,
|
|
46
|
+
dot: true,
|
|
47
|
+
onlyFiles: true,
|
|
48
|
+
followSymbolicLinks: false,
|
|
49
|
+
ignore: ignoredGlobs,
|
|
55
50
|
});
|
|
51
|
+
// Always include activity log if it exists
|
|
52
|
+
const activityPath = ".litmus/activity.jsonl";
|
|
53
|
+
if (existsSync(path.join(projectDir, activityPath)) && !files.includes(activityPath)) {
|
|
54
|
+
files.push(activityPath);
|
|
55
|
+
}
|
|
56
|
+
const zip = new Zip({ compressionLevel: 6 });
|
|
57
|
+
for (const file of files) {
|
|
58
|
+
zip.addFile(path.join(projectDir, file), file);
|
|
59
|
+
}
|
|
60
|
+
await zip.archive(tmpFile);
|
|
61
|
+
return tmpFile;
|
|
56
62
|
}
|
|
57
63
|
function buildIgnoreGlobs(projectDir) {
|
|
58
64
|
const patterns = [];
|
package/dist/lib/zip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/lib/zip.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/lib/zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC7C,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,WAAW,CAAA;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAE7B,gDAAgD;AAChD,4EAA4E;AAC5E,kEAAkE;AAClE,MAAM,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,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;oBAC1B,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;gBAC/B,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBACnB,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litmus-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "CLI tool for Litmus engineering assessments",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "elenazhao",
|
|
@@ -16,16 +16,15 @@
|
|
|
16
16
|
"prepublishOnly": "npm run build"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"archiver": "^7.0.1",
|
|
20
19
|
"chalk": "^5.3.0",
|
|
21
20
|
"chokidar": "^3.6.0",
|
|
22
21
|
"commander": "^12.1.0",
|
|
23
|
-
"
|
|
22
|
+
"fast-glob": "^3.3.3",
|
|
24
23
|
"ora": "^8.1.1",
|
|
25
|
-
"unzipper": "^0.12.3"
|
|
24
|
+
"unzipper": "^0.12.3",
|
|
25
|
+
"zip-lib": "^1.2.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/archiver": "^6.0.3",
|
|
29
28
|
"@types/node": "^20.0.0",
|
|
30
29
|
"@types/unzipper": "^0.10.10",
|
|
31
30
|
"typescript": "^5.4.5"
|
package/src/lib/zip.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createWriteStream, readFileSync, existsSync } from "fs"
|
|
1
|
+
import { readFileSync, existsSync } from "fs"
|
|
3
2
|
import path from "path"
|
|
4
3
|
import os from "os"
|
|
4
|
+
import fg from "fast-glob"
|
|
5
|
+
import { Zip } from "zip-lib"
|
|
5
6
|
|
|
6
7
|
// Directories always excluded from submissions.
|
|
7
8
|
// NOTE: .git is intentionally NOT excluded — git history is included so the
|
|
@@ -39,27 +40,32 @@ const ALWAYS_EXCLUDE = [
|
|
|
39
40
|
*/
|
|
40
41
|
export async function createSubmissionZip(projectDir: string): Promise<string> {
|
|
41
42
|
const tmpFile = path.join(os.tmpdir(), `litmus-submission-${Date.now()}.zip`)
|
|
42
|
-
const output = createWriteStream(tmpFile)
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
// Compute glob patterns to ignore
|
|
45
|
+
const ignoredGlobs = buildIgnoreGlobs(projectDir)
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
// Find all files, including dotfiles
|
|
48
|
+
const files = await fg(["**/*"], {
|
|
49
|
+
cwd: projectDir,
|
|
50
|
+
dot: true,
|
|
51
|
+
onlyFiles: true,
|
|
52
|
+
followSymbolicLinks: false,
|
|
53
|
+
ignore: ignoredGlobs,
|
|
54
|
+
})
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
// Always include activity log if it exists
|
|
57
|
+
const activityPath = ".litmus/activity.jsonl"
|
|
58
|
+
if (existsSync(path.join(projectDir, activityPath)) && !files.includes(activityPath)) {
|
|
59
|
+
files.push(activityPath)
|
|
60
|
+
}
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
})
|
|
62
|
+
const zip = new Zip({ compressionLevel: 6 })
|
|
63
|
+
for (const file of files) {
|
|
64
|
+
zip.addFile(path.join(projectDir, file), file)
|
|
65
|
+
}
|
|
66
|
+
await zip.archive(tmpFile)
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
})
|
|
68
|
+
return tmpFile
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
function buildIgnoreGlobs(projectDir: string): string[] {
|