Skip to content

Commit 68c0dba

Browse files
committed
Prepare for v2.1.0
1 parent 29bc79c commit 68c0dba

File tree

2 files changed

+91
-6
lines changed

2 files changed

+91
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v2.1.0
4+
5+
- Add `--raw2` option to specify resource type from predefined names
6+
- Add `--delete` and `--delete-xxxxx` options to delete existing resources, as well as `--fail-if-no-delete` option
7+
- Update cosmiconfig to support .mjs files
8+
- Use fetch in preference to `request`
9+
310
## v2.0.1
411

512
- Update resedit to fix #32

README.md

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Starting from v0.3.0, resedit-js-cli also supports creating empty (data-only) ex
1515
- [Icon resource options](#icon-resource-options)
1616
- [Version resource options](#version-resource-options)
1717
- [Raw resource options](#raw-resource-options)
18+
- [Delete options](#delete-options)
1819
- [Signing options](#signing-options)
1920
- [Other options](#other-options)
2021
- [Examples](#examples)
@@ -57,13 +58,25 @@ Options:
5758
--company-name Company name for version resource [string]
5859
--debug Output more logs than verbose mode while
5960
processing. [boolean]
61+
--delete One or more resources to delete from executable.
62+
The value must be one of following format:
63+
* <type>,<ID>
64+
* <type> [array]
65+
--delete-xxxxx One or more resources to delete from executable
66+
(xxxxx is one of the predefined type names
67+
described below).
68+
The value must be <ID> or no value. [array]
6069
--definition Resource definition file which contains resource
6170
data to write (see document for details) [string]
6271
--digest Digest algorithm for signing. (default: 'sha256')
6372
Requires --sign option.
6473
[string] [choices: "sha1", "sha256", "sha512", "sha224", "sha384",
6574
"sha512-224", "sha512-256", "sha3-224", "sha3-256", "sha3-384", "sha3-512",
6675
"shake128", "shake256"]
76+
--fail-if-no-delete If specified and the resource to be deleted does
77+
not exist, the operation will fail.
78+
If no delete options are specified, this flag is
79+
ignored. [boolean]
6780
--file-description File description for version resource [string]
6881
--file-version File version for version resource.
6982
Must be 'n.n.n.n' format (n is an integer) [string]
@@ -99,6 +112,13 @@ Options:
99112
* <type>,<ID>,@<file-name>
100113
(<string-value> will be stored as UTF-8 string)
101114
[array]
115+
--raw2 One or more resources to add to executable.
116+
The value must be one of following format:
117+
* <type-name>,<ID>,<string-value>
118+
* <type-name>,<ID>,@<file-name>
119+
(<string-value> will be stored as UTF-8 string)
120+
Type names must be the predefined names described
121+
below. [array]
102122
--select Certificate selection mode whether to pick
103123
certificates from the specified file (default:
104124
leaf)
@@ -113,6 +133,14 @@ Options:
113133
Requires --sign option. [string]
114134
-v, --verbose Output logs while processing. [boolean]
115135
-V, --version Show version number of this tool [boolean]
136+
137+
The predefined type names are: accelerator, anicursor, aniCursor, aniicon,
138+
aniIcon, bitmap, cursor, dialog, dlginclude, dlgInclude, font, fontdir, fontDir,
139+
groupcursor, groupCursor, groupicon, groupIcon, html, icon, manifest, menu,
140+
messagetable, messageTable, plugplay, plugPlay, rcdata, rcData, string, version,
141+
vxd
142+
In addition, 'allicon'/'allIcon' and 'allcursor'/'allCursor' can also be used
143+
for --delete-xxxxx (e.g. --delete-allicon).
116144
```
117145

118146
### Main options
@@ -277,13 +305,61 @@ Note: The value from `--lang` will be used as the language for all resources. To
277305

278306
Specifies any resource data to contain. `<data>` must be either `<type>,<ID>,<string-value>` or `<type>,<ID>,@<file-name>`, whose values are as followings:
279307

280-
- `<type>` : Resource type value which must be integer or string. This tool does not convert the type value to commonly-used type identifier (e.g. specify `24` value for `RT_MANIFEST`, not specify `"RT_MANIFEST"`)
308+
- `<type>` : Resource type value which must be integer or string. This tool does not convert the type value to commonly-used type identifier (e.g. specify `24` value for `RT_MANIFEST`, not specify `"RT_MANIFEST"`). To use commonly name, use `--raw2` instead.
309+
- `<ID>` : Resource ID value which must be integer or string.
310+
- `<string-value>` : Actual resource data. The value will be stored as UTF-8 string data.
311+
- `@<file-name>` : File name containing data for the resource. `@` character must be followed by the file name.
312+
313+
This option can be specified one or more.
314+
315+
#### `--raw2 <data>`
316+
317+
- `string`
318+
319+
Specifies any resource data to contain. Similar to `--raw`, but `<type>` will be `<typeName>`, which must be the predefined type name, instead.
320+
321+
`<data>` must be either `<typeName>,<ID>,<string-value>` or `<typeName>,<ID>,@<file-name>`, whose values are as followings:
322+
323+
- `<typeName>` : Predefine resource type name. Valid names are: `accelerator`, `anicursor`, `aniCursor`, `aniicon`, `aniIcon`, `bitmap`, `cursor`, `dialog`, `dlginclude`, `dlgInclude`, `font`, `fontdir`, `fontDir`, `groupcursor`, `groupCursor`, `groupicon`, `groupIcon`, `html`, `icon`, `manifest`, `menu`, `messagetable`, `messageTable`, `plugplay`, `plugPlay`, `rcdata`, `rcData`, `string`, `version`, `vxd`
281324
- `<ID>` : Resource ID value which must be integer or string.
282325
- `<string-value>` : Actual resource data. The value will be stored as UTF-8 string data.
283326
- `@<file-name>` : File name containing data for the resource. `@` character must be followed by the file name.
284327

285328
This option can be specified one or more.
286329

330+
### Delete options
331+
332+
If following options are used, appropriate resources are deleted first, and adding/replacing operations will be performed.
333+
334+
#### `--delete <data>`
335+
336+
- `string`
337+
338+
Specifies resource data to delete. `<data>` must be `<type>` or `<type>,<ID>`, whose values are as followings:
339+
340+
- `<type>` : Resource type value which must be integer or string. This tool does not convert the type value to commonly-used type identifier (e.g. specify `24` value for `RT_MANIFEST`, not specify `"RT_MANIFEST"`). To use commonly name, use `--delete-xxxxx` instead.
341+
- `<ID>` : (optional) Resource ID value which must be integer or string. `,<ID>` can be omitted; in this case, all resources with the type will be deleted.
342+
343+
Note that `--lang` value is ignored for deletion.
344+
345+
#### `--delete-xxxxx [<ID>]`
346+
347+
- `string`
348+
349+
Specifies resource data to delete by type. `xxxxx` is a placeholder (see below). `[<ID>]` is a resource ID value, which must be integer or string, to delete. If omitted, all resources with the type will be deleted.
350+
351+
`xxxxx` must be the predefined names as: `accelerator`, `anicursor`, `aniCursor`, `aniicon`, `aniIcon`, `bitmap`, `cursor`, `dialog`, `dlginclude`, `dlgInclude`, `font`, `fontdir`, `fontDir`, `groupcursor`, `groupCursor`, `groupicon`, `groupIcon`, `html`, `icon`, `manifest`, `menu`, `messagetable`, `messageTable`, `plugplay`, `plugPlay`, `rcdata`, `rcData`, `string`, `version`, `vxd` (these are equal to the name available in `--raw2`).
352+
353+
Additionally, `allicon`, `allIcon`, `allcursor`, `allCursor` can be used for `xxxxx`. `allicon` and `allIcon` deletes `icon`, `groupIcon`, and `aniIcon`, and `allcursor` and `allCursor` deletes `cursor`, `groupCursor`, and `aniCursor`.
354+
355+
Note that `--lang` value is ignored for deletion.
356+
357+
#### `--fail-if-no-delete`
358+
359+
- Flag (`boolean`)
360+
361+
If specified, and the resource data to be deleted does not exist, the tool will fail.
362+
287363
### Signing options
288364

289365
#### `--sign`
@@ -363,7 +439,7 @@ Specifies an algorithm for generating digest. Some algorithms are available only
363439

364440
Specifies a URL of the Time Stamping Authority (TSA), to add a time-stamp information for signed binary. The server must accept and response Time-Stamp Protocol (TSP) based on RFC 3161.
365441

366-
By default Node.js `http` or `https` module will be used for connection, but you can use [request](https://www.npmjs.com/package/request) module or [node-fetch](https://www.npmjs.com/package/node-fetch) by installing it manually as followings:
442+
By default Node.js native `fetch`, or `http` or `https` module will be used for connection, but you can use [request](https://www.npmjs.com/package/request) module or [node-fetch](https://www.npmjs.com/package/node-fetch) by installing it manually as followings:
367443

368444
```
369445
npm install resedit-cli request
@@ -373,7 +449,7 @@ npm install resedit-cli node-fetch
373449

374450
> - For `request`, at least `request@2.88.0` is expected. If less than 2.88.0, a warning log will be printed.
375451
> - For `node-fetch`, `node-fetch@3` is expected. You can instead set `global.fetch` variable with a valid function. This means that you can use another `fetch` library such as `isomorphic-fetch`.
376-
> - Currently if both `request` and fetch are available, `request` is used.
452+
> - Currently if both `request` and fetch are available, fetch is used.
377453
378454
By installing one of them, you can connect to the server with features that those module supports, such as with a HTTP proxy. (If those modules are not installed, HTTP proxies cannot be used.)
379455

@@ -458,9 +534,9 @@ version:
458534
productVersion: 2.3.0.0
459535
```
460536
461-
As JS file:
537+
As JS file (.mjs):
462538
463-
```js
539+
```mjs
464540
import * as path from 'path';
465541

466542
// a user-defined function to retrieve data asynchronously
@@ -496,9 +572,11 @@ async function loadDefintion() {
496572
}
497573

498574
// Since cosmiconfig supports, you can export 'Promise' object.
499-
module.exports = loadDefintion();
575+
export default loadDefintion();
500576
```
501577

578+
> .cjs is still supported.
579+
502580
## APIs
503581

504582
This tool is created for the command line tool, but you can also use this as a Node.js library.

0 commit comments

Comments
 (0)