@fgv/ts-res-cli 5.0.0-9 → 5.0.1-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/CHANGELOG.json +23 -0
- package/eslint.config.js +16 -0
- package/lib/cli.d.ts +4 -0
- package/lib/cli.js +66 -0
- package/lib/compiler.js +2 -1
- package/package.json +19 -18
- package/.eslintrc.js +0 -9
- package/.rush/temp/chunked-rush-logs/ts-res-cli.build.chunks.jsonl +0 -6
- package/.rush/temp/operation/build/log-chunks.jsonl +0 -6
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/shrinkwrap-deps.json +0 -649
- package/config/jest.config.json +0 -9
- package/config/rig.json +0 -16
- package/lib/cli.d.ts.map +0 -1
- package/lib/cli.js.map +0 -1
- package/lib/compiler.d.ts.map +0 -1
- package/lib/compiler.js.map +0 -1
- package/lib/defaultConfiguration.d.ts.map +0 -1
- package/lib/defaultConfiguration.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/options.d.ts.map +0 -1
- package/lib/options.js.map +0 -1
- package/src/cli.ts +0 -607
- package/src/compiler.ts +0 -545
- package/src/defaultConfiguration.ts +0 -78
- package/src/index.ts +0 -25
- package/src/options.ts +0 -101
- package/test/integration/cli-configuration.test.ts +0 -419
- package/test/integration/cli-context-filter-working.test.ts +0 -341
- package/test/integration/cli-integration.test.ts +0 -581
- package/test/unit/cli.test.ts +0 -413
- package/test/unit/compiler.test.ts +0 -1084
- package/tsconfig.json +0 -8
package/CHANGELOG.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fgv/ts-res-cli",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "5.0.1",
|
|
6
|
+
"tag": "@fgv/ts-res-cli_v5.0.1",
|
|
7
|
+
"date": "Tue, 23 Sep 2025 03:13:55 GMT",
|
|
8
|
+
"comments": {}
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "5.0.0",
|
|
12
|
+
"tag": "@fgv/ts-res-cli_v5.0.0",
|
|
13
|
+
"date": "Tue, 23 Sep 2025 02:54:20 GMT",
|
|
14
|
+
"comments": {
|
|
15
|
+
"none": [
|
|
16
|
+
{
|
|
17
|
+
"comment": "initial checkin"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// ESLint 9 flat config
|
|
2
|
+
const nodeProfile = require('@rushstack/eslint-config/flat/profile/node');
|
|
3
|
+
const packletsPlugin = require('@rushstack/eslint-config/flat/mixins/packlets');
|
|
4
|
+
const tsdocPlugin = require('@rushstack/eslint-config/flat/mixins/tsdoc');
|
|
5
|
+
|
|
6
|
+
module.exports = [
|
|
7
|
+
...nodeProfile,
|
|
8
|
+
packletsPlugin,
|
|
9
|
+
...tsdocPlugin,
|
|
10
|
+
{
|
|
11
|
+
// Override specific rules if needed
|
|
12
|
+
rules: {
|
|
13
|
+
'@rushstack/packlets/mechanics': 'warn'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
];
|
package/lib/cli.d.ts
CHANGED
package/lib/cli.js
CHANGED
|
@@ -142,6 +142,17 @@ class TsResCliApp {
|
|
|
142
142
|
.action(async (options) => {
|
|
143
143
|
await this._handleConfigCommand(options);
|
|
144
144
|
});
|
|
145
|
+
this._program
|
|
146
|
+
.command('archive')
|
|
147
|
+
.description('Create ZIP archive of resources and configuration')
|
|
148
|
+
.option('-i, --input <path>', 'Input file or directory path')
|
|
149
|
+
.option('--config <path>', 'Configuration file path')
|
|
150
|
+
.requiredOption('-o, --output <path>', 'Output ZIP file path')
|
|
151
|
+
.option('-v, --verbose', 'Verbose output', false)
|
|
152
|
+
.option('-q, --quiet', 'Quiet output', false)
|
|
153
|
+
.action(async (options) => {
|
|
154
|
+
await this._handleArchiveCommand(options);
|
|
155
|
+
});
|
|
145
156
|
}
|
|
146
157
|
/**
|
|
147
158
|
* Handles the compile command
|
|
@@ -413,6 +424,61 @@ class TsResCliApp {
|
|
|
413
424
|
process.exit(1);
|
|
414
425
|
}
|
|
415
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Handles the archive command
|
|
429
|
+
*/
|
|
430
|
+
async _handleArchiveCommand(options) {
|
|
431
|
+
try {
|
|
432
|
+
// Import ZipArchive dynamically to avoid loading if not needed
|
|
433
|
+
const { ZipArchive } = await Promise.resolve().then(() => __importStar(require('@fgv/ts-res')));
|
|
434
|
+
if (!options.input && !options.config) {
|
|
435
|
+
console.error('Error: At least one of --input or --config must be specified');
|
|
436
|
+
process.exit(1);
|
|
437
|
+
}
|
|
438
|
+
if (!options.quiet) {
|
|
439
|
+
console.log('Creating ZIP archive...');
|
|
440
|
+
if (options.input)
|
|
441
|
+
console.log(`Input: ${options.input}`);
|
|
442
|
+
if (options.config)
|
|
443
|
+
console.log(`Config: ${options.config}`);
|
|
444
|
+
console.log(`Output: ${options.output}`);
|
|
445
|
+
}
|
|
446
|
+
// Create ZIP archive using the new zip-archive packlet
|
|
447
|
+
const creator = new ZipArchive.ZipArchiveCreator();
|
|
448
|
+
const createResult = await creator.createFromBuffer({
|
|
449
|
+
inputPath: options.input,
|
|
450
|
+
configPath: options.config
|
|
451
|
+
}, options.verbose
|
|
452
|
+
? (phase, progress, message) => {
|
|
453
|
+
console.log(`[${phase}] ${progress}% - ${message}`);
|
|
454
|
+
}
|
|
455
|
+
: undefined);
|
|
456
|
+
if (createResult.isFailure()) {
|
|
457
|
+
console.error(`Error: Failed to create ZIP archive: ${createResult.message}`);
|
|
458
|
+
process.exit(1);
|
|
459
|
+
}
|
|
460
|
+
const { zipBuffer, manifest, size } = createResult.value;
|
|
461
|
+
// Write the ZIP buffer to the specified output file
|
|
462
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs'))).then((m) => m.promises);
|
|
463
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
464
|
+
const outputPath = path.resolve(options.output);
|
|
465
|
+
const outputDir = path.dirname(outputPath);
|
|
466
|
+
// Ensure output directory exists
|
|
467
|
+
await fs.mkdir(outputDir, { recursive: true });
|
|
468
|
+
// Write ZIP file
|
|
469
|
+
await fs.writeFile(outputPath, zipBuffer);
|
|
470
|
+
if (!options.quiet) {
|
|
471
|
+
console.log(`ZIP archive created successfully: ${outputPath}`);
|
|
472
|
+
console.log(`Archive size: ${(size / 1024).toFixed(2)} KB`);
|
|
473
|
+
console.log(`Manifest:`);
|
|
474
|
+
console.log(JSON.stringify(manifest, null, 2));
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
catch (error) {
|
|
478
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
479
|
+
process.exit(1);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
416
482
|
/**
|
|
417
483
|
* Parses and validates compile options
|
|
418
484
|
*/
|
package/lib/compiler.js
CHANGED
|
@@ -56,6 +56,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
57
|
exports.ResourceCompiler = void 0;
|
|
58
58
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
59
|
+
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
59
60
|
const TsRes = __importStar(require("@fgv/ts-res"));
|
|
60
61
|
const defaultConfiguration_1 = require("./defaultConfiguration");
|
|
61
62
|
const fs_1 = require("fs");
|
|
@@ -263,7 +264,7 @@ class ResourceCompiler {
|
|
|
263
264
|
try {
|
|
264
265
|
const inputPath = path.resolve(this._options.input);
|
|
265
266
|
// Create FileTree for file system operations
|
|
266
|
-
const fileTree =
|
|
267
|
+
const fileTree = ts_json_base_1.FileTree.forFilesystem();
|
|
267
268
|
if (fileTree.isFailure()) {
|
|
268
269
|
return (0, ts_utils_1.fail)(`Failed to create file tree: ${fileTree.message}`);
|
|
269
270
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-res-cli",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.1-0",
|
|
4
4
|
"description": "Command-line interface for ts-res resource compilation and management",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,26 +18,27 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"commander": "^11.0.0",
|
|
21
|
-
"@fgv/ts-res": "5.0.0
|
|
22
|
-
"@fgv/ts-utils": "5.0.0
|
|
23
|
-
"@fgv/ts-
|
|
24
|
-
"@fgv/ts-json
|
|
25
|
-
"@fgv/ts-
|
|
21
|
+
"@fgv/ts-res": "5.0.1-0",
|
|
22
|
+
"@fgv/ts-utils": "5.0.1-0",
|
|
23
|
+
"@fgv/ts-extras": "5.0.1-0",
|
|
24
|
+
"@fgv/ts-json": "5.0.1-0",
|
|
25
|
+
"@fgv/ts-json-base": "5.0.1-0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@rushstack/heft": "
|
|
29
|
-
"@rushstack/heft-node-rig": "
|
|
30
|
-
"@rushstack/eslint-config": "
|
|
28
|
+
"@rushstack/heft": "0.74.4",
|
|
29
|
+
"@rushstack/heft-node-rig": "2.9.5",
|
|
30
|
+
"@rushstack/eslint-config": "4.4.0",
|
|
31
31
|
"@types/heft-jest": "1.0.6",
|
|
32
32
|
"@types/jest": "^29.5.14",
|
|
33
33
|
"@types/node": "^20.14.9",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
35
|
-
"@typescript-eslint/parser": "^
|
|
36
|
-
"eslint": "^
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.42.0",
|
|
35
|
+
"@typescript-eslint/parser": "^8.42.0",
|
|
36
|
+
"eslint": "^9.35.0",
|
|
37
37
|
"jest": "^29.7.0",
|
|
38
|
-
"ts-jest": "^29.4.
|
|
39
|
-
"typescript": "
|
|
40
|
-
"@
|
|
38
|
+
"ts-jest": "^29.4.1",
|
|
39
|
+
"typescript": "5.8.3",
|
|
40
|
+
"@rushstack/heft-jest-plugin": "0.16.13",
|
|
41
|
+
"@fgv/ts-utils-jest": "5.0.1-0"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"typescript": "^5.7.3"
|
|
@@ -50,10 +51,10 @@
|
|
|
50
51
|
"clean": "heft clean",
|
|
51
52
|
"lint": "eslint src --ext .ts",
|
|
52
53
|
"fixlint": "eslint src --ext .ts --fix",
|
|
53
|
-
"build-docs": "
|
|
54
|
+
"build-docs": "echo nothing to de",
|
|
54
55
|
"test-handles": "rushx test --detectOpenHandles",
|
|
55
56
|
"clean-jest": "rushx test --clearCache",
|
|
56
|
-
"build-samples": "node bin/ts-res-compile.js compile -i
|
|
57
|
-
"build-samples-all": "
|
|
57
|
+
"build-samples": "node bin/ts-res-compile.js compile -i test/data/sample-resources.json -o temp/sample-output.json --include-metadata",
|
|
58
|
+
"build-samples-all": "rushx build-samples && node bin/ts-res-compile.js compile -i test/data/resource-collection.json -o temp/collection-output.json --include-metadata && node bin/ts-res-compile.js compile -i test/data/sample-resources.json -o temp/sample-output.js -f js && node bin/ts-res-compile.js compile -i test/data/sample-resources.json -o temp/sample-output.ts -f ts"
|
|
58
59
|
}
|
|
59
60
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// This is a workaround for https://github.com/eslint/eslint/issues/3458
|
|
2
|
-
require('@rushstack/eslint-config/patch/modern-module-resolution');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['@rushstack/eslint-config/profile/node'],
|
|
6
|
-
parserOptions: {
|
|
7
|
-
tsconfigRootDir: __dirname
|
|
8
|
-
}
|
|
9
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{"kind":"O","text":"Invoking: heft build --clean \n"}
|
|
2
|
-
{"kind":"O","text":" ---- build started ---- \n"}
|
|
3
|
-
{"kind":"O","text":"[build:typescript] Using TypeScript version 5.8.3\n"}
|
|
4
|
-
{"kind":"O","text":"[build:lint] Using ESLint version 8.57.0\n"}
|
|
5
|
-
{"kind":"O","text":" ---- build finished (5.929s) ---- \n"}
|
|
6
|
-
{"kind":"O","text":"-------------------- Finished (5.934s) --------------------\n"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{"kind":"O","text":"Invoking: heft build --clean \n"}
|
|
2
|
-
{"kind":"O","text":" ---- build started ---- \n"}
|
|
3
|
-
{"kind":"O","text":"[build:typescript] Using TypeScript version 5.8.3\n"}
|
|
4
|
-
{"kind":"O","text":"[build:lint] Using ESLint version 8.57.0\n"}
|
|
5
|
-
{"kind":"O","text":" ---- build finished (5.929s) ---- \n"}
|
|
6
|
-
{"kind":"O","text":"-------------------- Finished (5.934s) --------------------\n"}
|