single-file-cli 2.0.6 → 2.0.7

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/README.MD CHANGED
@@ -6,7 +6,11 @@ SingleFile can be launched from the command line by running it into a (headless)
6
6
 
7
7
  It runs through Deno as a standalone script injected into the web page via the Chrome DevTools Protocol instead of being embedded into a WebExtension.
8
8
 
9
+ ## Installation
9
10
 
11
+ SingleFile can be run without installing it, just download the executable file and save it in the directory of your choice here: https://github.com/gildas-lormeau/single-file-cli/releases
12
+
13
+ Make sure Chrome or a Chromium-based browser is installed in the default folder. Otherwise you might need to set the `--browser-executable-path` option to help SingleFile locating the path of the executable file.
10
14
 
11
15
  ## Installation with Docker
12
16
 
@@ -57,11 +61,18 @@ It runs through Deno as a standalone script injected into the web page via the C
57
61
 
58
62
  ## Manual installation
59
63
 
60
- - Make sure Chrome or a Chromium-based browser is installed. Otherwise you might need to set the `--browser-executable-path` option to help SingleFile locating the path of the executable file.
61
-
62
64
  - Install [Deno](https://deno.com/)
63
65
 
64
- - There are 2 ways to download the code of SingleFile, choose the one you prefer:
66
+ - There are 3 ways to download the code of SingleFile, choose the one you prefer:
67
+
68
+ - Download and install with `npm` (`npm` is installed with Node.js)
69
+
70
+ ```sh
71
+ npm install "single-file-cli"
72
+ cd single-file-cli-master
73
+ ```
74
+
75
+ You can also install SingleFile globally with `-g` when running `npm install`.
65
76
 
66
77
  - Download and unzip manually the
67
78
  [master archive](https://github.com/gildas-lormeau/single-file-cli/archive/master.zip)
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@single-file/single-file-cli",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "SingleFile CLI",
5
5
  "nodeModulesDir": true,
6
6
  "exports": {
package/lib/browser.js CHANGED
@@ -42,14 +42,14 @@ async function launchBrowser(options = {}, indexPath = 0) {
42
42
  if (options.executablePath) {
43
43
  path = options.executablePath;
44
44
  }
45
- if (options.browserDebug) {
45
+ if (options.debug) {
46
46
  args.push("--auto-open-devtools-for-tabs");
47
47
  }
48
- if (options.browserDisableWebSecurity) {
48
+ if (options.disableWebSecurity) {
49
49
  args.push("--disable-web-security");
50
50
  }
51
- if (options.browserWidth && options.browserHeight) {
52
- args.push("--window-size=" + options.browserWidth + "," + options.browserHeight);
51
+ if (options.width && options.height) {
52
+ args.push("--window-size=" + options.width + "," + options.height);
53
53
  }
54
54
  if (options.userAgent) {
55
55
  args.push("--user-agent=" + options.userAgent);
package/lib/cdp-client.js CHANGED
@@ -209,10 +209,10 @@ function getBrowserOptions(options) {
209
209
  browserOptions.args = options.browserArgs;
210
210
  browserOptions.headless = options.browserHeadless && !options.browserDebug;
211
211
  browserOptions.executablePath = options.browserExecutablePath;
212
- browserOptions.browserDebug = options.browserDebug;
213
- browserOptions.browserDisableWebSecurity = options.browserDisableWebSecurity === undefined || options.browserDisableWebSecurity;
214
- browserOptions.browserWidth = options.browserWidth;
215
- browserOptions.browserHeight = options.browserHeight;
212
+ browserOptions.debug = options.browserDebug;
213
+ browserOptions.disableWebSecurity = options.browserDisableWebSecurity === undefined || options.browserDisableWebSecurity;
214
+ browserOptions.width = options.browserWidth;
215
+ browserOptions.height = options.browserHeight;
216
216
  browserOptions.userAgent = options.userAgent;
217
217
  browserOptions.httpProxyServer = options.httpProxyServer;
218
218
  return browserOptions;
package/options.js CHANGED
@@ -120,14 +120,15 @@ const OPTIONS_INFO = {
120
120
  "create-root-directory": { description: "Create a root directory based on the timestamp", type: "boolean" },
121
121
  "extract-data-from-page": { description: "Extract compressed data from the page instead of fetching the page in order to create universal self-extracting HTML files", type: "boolean", defaultValue: true },
122
122
  "prevent-appended-data": { description: "Prevent appending data after the compressed data when creating self-extracting HTML files", type: "boolean" },
123
- "output-directory": { description: "Path to where to save files, this path must exist.", type: "string" }
123
+ "output-directory": { description: "Path to where to save files, this path must exist.", type: "string" },
124
+ "version": { description: "Print the version number and exit.", type: "boolean" }
124
125
  };
125
126
 
126
127
  const { args, exit } = Deno;
127
- const options = getOptions();
128
+ const options = await getOptions();
128
129
  export default options;
129
130
 
130
- function getOptions() {
131
+ async function getOptions() {
131
132
  const { positionals, options } = parseArgs(Array.from(args));
132
133
  if ((!positionals.length && !Object.keys(options).length) || positionals.length > 2 || options.help) {
133
134
  console.log(USAGE_TEXT + "\n"); // eslint-disable-line no-console
@@ -145,6 +146,11 @@ function getOptions() {
145
146
  console.log(""); // eslint-disable-line no-console
146
147
  exit(0);
147
148
  }
149
+ if (options.version) {
150
+ const version = JSON.parse(await Deno.readTextFile("./deno.json")).version;
151
+ console.log(version); // eslint-disable-line no-console
152
+ exit(0);
153
+ }
148
154
  Object.keys(OPTIONS_INFO).forEach(optionName => {
149
155
  const optionInfo = getOptionInfo(optionName);
150
156
  const optionKey = getOptionKey(optionName, optionInfo);
@@ -283,4 +289,4 @@ function isValid(type, value) {
283
289
 
284
290
  function isArray(type) {
285
291
  return type.endsWith("[]");
286
- }
292
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-cli",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "SingleFile CLI",
5
5
  "author": "Gildas Lormeau",
6
6
  "engines": {