@eighty4/c2 0.0.3-1 → 0.0.4
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/CHANGELOG.md +13 -1
- package/lib/attachments.ts +2 -2
- package/lib/{c2.bin.ts → bin.ts} +8 -5
- package/lib/cli.ts +1 -5
- package/lib_js/attachments.js +3 -3
- package/lib_js/{c2.bin.js → bin.js} +7 -5
- package/lib_js/cli.js +1 -5
- package/lib_types/{c2.api.d.ts → api.d.ts} +1 -1
- package/lib_types/api.d.ts.map +1 -0
- package/lib_types/bin.d.ts +3 -0
- package/lib_types/bin.d.ts.map +1 -0
- package/lib_types/cli.d.ts.map +1 -1
- package/package.json +5 -5
- package/lib_types/c2.api.d.ts.map +0 -1
- package/lib_types/c2.bin.d.ts +0 -3
- package/lib_types/c2.bin.d.ts.map +0 -1
- /package/lib/{c2.api.ts → api.ts} +0 -0
- /package/lib_js/{c2.api.js → api.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
- ???
|
|
6
|
+
|
|
7
|
+
## [v0.0.4] - 2025-06-30
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Cleaning up console output of errors and CLI usage
|
|
12
|
+
|
|
13
|
+
## [v0.0.3] - 2025-06-26
|
|
14
|
+
|
|
5
15
|
### Fixed
|
|
6
16
|
|
|
7
17
|
- TypeScript type declarations were broken because subpath imports
|
|
@@ -18,5 +28,7 @@
|
|
|
18
28
|
- Evaluate env() and file() expressions in user data
|
|
19
29
|
- Merge multiple user data into a MIME multipart message
|
|
20
30
|
|
|
21
|
-
[Unreleased]: https://github.com/eighty4/c2/compare/v0.0.
|
|
31
|
+
[Unreleased]: https://github.com/eighty4/c2/compare/v0.0.4...HEAD
|
|
32
|
+
[v0.0.4]: https://github.com/eighty4/c2/compare/v0.0.3...v0.0.4
|
|
33
|
+
[v0.0.3]: https://github.com/eighty4/c2/compare/v0.0.2...v0.0.3
|
|
22
34
|
[v0.0.2]: https://github.com/eighty4/c2/releases/tag/v0.0.2
|
package/lib/attachments.ts
CHANGED
|
@@ -31,9 +31,9 @@ function compareAttachmentFilenames(
|
|
|
31
31
|
a1: Attachment,
|
|
32
32
|
a2: Attachment,
|
|
33
33
|
): 1 | 0 | -1 {
|
|
34
|
-
if (a1.filename
|
|
34
|
+
if (a1.filename < a2.filename) return -1
|
|
35
35
|
if (a1.filename > a2.filename) return 1
|
|
36
|
-
return
|
|
36
|
+
return 0
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export function resolveAttachmentType(
|
package/lib/{c2.bin.ts → bin.ts}
RENAMED
|
@@ -9,17 +9,16 @@ let args: ParsedArgs | undefined
|
|
|
9
9
|
try {
|
|
10
10
|
args = parseArgs()
|
|
11
11
|
} catch (e: any) {
|
|
12
|
-
|
|
13
|
-
console.error(e.message)
|
|
14
|
-
}
|
|
12
|
+
errorExit(e.message)
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
if (!args || args.help) {
|
|
18
16
|
const optional = (s: string) => `\u001b[90m${s}\u001b[0m`
|
|
19
17
|
const required = (s: string) => `\u001b[1m${s}\u001b[0m`
|
|
20
|
-
|
|
18
|
+
console.error(
|
|
21
19
|
`c2 ${optional('[[--base64] | [--http PORT]]')} ${required('USER_DATA_DIR')}`,
|
|
22
20
|
)
|
|
21
|
+
process.exit(1)
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
if (!(await doesDirExist(args.userDataDir))) {
|
|
@@ -46,6 +45,10 @@ try {
|
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
function errorExit(msg: string): never {
|
|
49
|
-
console.error(msg)
|
|
48
|
+
console.error(errorText('error:'), msg)
|
|
50
49
|
process.exit(1)
|
|
51
50
|
}
|
|
51
|
+
|
|
52
|
+
function errorText(s: string): string {
|
|
53
|
+
return `\u001b[1;31m${s}\u001b[0m`
|
|
54
|
+
}
|
package/lib/cli.ts
CHANGED
|
@@ -7,11 +7,7 @@ export type ParsedArgs =
|
|
|
7
7
|
userDataDir: string
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const SCRIPT_SUFFIXES = Object.freeze([
|
|
11
|
-
'/c2',
|
|
12
|
-
'/lib_js/c2.bin.js',
|
|
13
|
-
'/lib/c2.bin.ts',
|
|
14
|
-
])
|
|
10
|
+
const SCRIPT_SUFFIXES = Object.freeze(['/c2', '/lib_js/bin.js', '/lib/bin.ts'])
|
|
15
11
|
|
|
16
12
|
export function parseArgs(input?: Array<string>): ParsedArgs {
|
|
17
13
|
if (!input) {
|
package/lib_js/attachments.js
CHANGED
|
@@ -12,11 +12,11 @@ export async function collectAttachments(dir) {
|
|
|
12
12
|
return attachments.sort(compareAttachmentFilenames);
|
|
13
13
|
}
|
|
14
14
|
function compareAttachmentFilenames(a1, a2) {
|
|
15
|
-
if (a1.filename
|
|
16
|
-
return
|
|
15
|
+
if (a1.filename < a2.filename)
|
|
16
|
+
return -1;
|
|
17
17
|
if (a1.filename > a2.filename)
|
|
18
18
|
return 1;
|
|
19
|
-
return
|
|
19
|
+
return 0;
|
|
20
20
|
}
|
|
21
21
|
export function resolveAttachmentType(filename, source) {
|
|
22
22
|
if (filename.endsWith('.yml') || filename.endsWith('.yaml')) {
|
|
@@ -8,14 +8,13 @@ try {
|
|
|
8
8
|
args = parseArgs();
|
|
9
9
|
}
|
|
10
10
|
catch (e) {
|
|
11
|
-
|
|
12
|
-
console.error(e.message);
|
|
13
|
-
}
|
|
11
|
+
errorExit(e.message);
|
|
14
12
|
}
|
|
15
13
|
if (!args || args.help) {
|
|
16
14
|
const optional = (s) => `\u001b[90m${s}\u001b[0m`;
|
|
17
15
|
const required = (s) => `\u001b[1m${s}\u001b[0m`;
|
|
18
|
-
|
|
16
|
+
console.error(`c2 ${optional('[[--base64] | [--http PORT]]')} ${required('USER_DATA_DIR')}`);
|
|
17
|
+
process.exit(1);
|
|
19
18
|
}
|
|
20
19
|
if (!(await doesDirExist(args.userDataDir))) {
|
|
21
20
|
errorExit(`${args.userDataDir} directory does not exist`);
|
|
@@ -39,6 +38,9 @@ catch (e) {
|
|
|
39
38
|
errorExit(e.message);
|
|
40
39
|
}
|
|
41
40
|
function errorExit(msg) {
|
|
42
|
-
console.error(msg);
|
|
41
|
+
console.error(errorText('error:'), msg);
|
|
43
42
|
process.exit(1);
|
|
44
43
|
}
|
|
44
|
+
function errorText(s) {
|
|
45
|
+
return `\u001b[1;31m${s}\u001b[0m`;
|
|
46
|
+
}
|
package/lib_js/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { type BuildUserDataOpts, buildUserData } from './build.ts';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../lib/bin.ts"],"names":[],"mappings":""}
|
package/lib_types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAChB;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IACI,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAChB;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IACI,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAIP,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,UAAU,CAqD3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eighty4/c2",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"author": "Adam McKee <adam.be.g84d@gmail.com>",
|
|
5
5
|
"repository": "https://github.com/eighty4/c2",
|
|
6
6
|
"homepage": "https://github.com/eighty4/c2",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"node": ">=23"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
|
-
"c2": "./lib_js/
|
|
23
|
+
"c2": "./lib_js/bin.js"
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
-
"bun": "./lib/
|
|
28
|
-
"node": "./lib_js/
|
|
29
|
-
"types": "./lib_types/
|
|
27
|
+
"bun": "./lib/api.ts",
|
|
28
|
+
"node": "./lib_js/api.js",
|
|
29
|
+
"types": "./lib_types/api.d.ts"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"c2.api.d.ts","sourceRoot":"","sources":["../lib/c2.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
package/lib_types/c2.bin.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"c2.bin.d.ts","sourceRoot":"","sources":["../lib/c2.bin.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|