single-file-cli 2.0.6 → 2.0.8

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/build-lib-dev.sh CHANGED
@@ -79,6 +79,8 @@ script += 'export { script, zipScript, hookScript };';
79
79
  await Deno.writeTextFile('lib/single-file-bundle.js', script)
80
80
  await Promise.all(SCRIPTS.map(script => Deno.remove(script)));
81
81
  await Deno.remove('lib/single-file-hooks-frames.js');
82
+ const version = JSON.parse(await Deno.readTextFile('./deno.json')).version;
83
+ await Deno.writeTextFile('lib/version.js', 'export const version = ' + JSON.stringify(version) + ';');
82
84
  " | deno run --allow-read --allow-write --allow-net --allow-run --allow-env --lock=node_modules/deno.lock.tmp -
83
85
 
84
86
  rm -rf node_modules
package/build-lib.sh CHANGED
@@ -78,6 +78,8 @@ script += 'export { script, zipScript, hookScript };';
78
78
  await Deno.writeTextFile('lib/single-file-bundle.js', script)
79
79
  await Promise.all(SCRIPTS.map(script => Deno.remove(script)));
80
80
  await Deno.remove('lib/single-file-hooks-frames.js');
81
+ const version = JSON.parse(await Deno.readTextFile('./deno.json')).version;
82
+ await Deno.writeTextFile('lib/version.js', 'export const version = ' + JSON.stringify(version) + ';');
81
83
  " | deno run --allow-read --allow-write --allow-net --allow-run --allow-env --lock=node_modules/deno.lock.tmp -
82
84
 
83
85
  rm -rf node_modules
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.8",
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/lib/version.js ADDED
@@ -0,0 +1 @@
1
+ export const version = "2.0.7";
package/options.js CHANGED
@@ -21,6 +21,7 @@
21
21
  * Source.
22
22
  */
23
23
 
24
+ import { version } from "./lib/version.js";
24
25
  import { Deno } from "./lib/deno-polyfill.js";
25
26
 
26
27
  const USAGE_TEXT = `single-file [url] [output]
@@ -120,14 +121,15 @@ const OPTIONS_INFO = {
120
121
  "create-root-directory": { description: "Create a root directory based on the timestamp", type: "boolean" },
121
122
  "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
123
  "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" }
124
+ "output-directory": { description: "Path to where to save files, this path must exist.", type: "string" },
125
+ "version": { description: "Print the version number and exit.", type: "boolean" }
124
126
  };
125
127
 
126
128
  const { args, exit } = Deno;
127
- const options = getOptions();
129
+ const options = await getOptions();
128
130
  export default options;
129
131
 
130
- function getOptions() {
132
+ async function getOptions() {
131
133
  const { positionals, options } = parseArgs(Array.from(args));
132
134
  if ((!positionals.length && !Object.keys(options).length) || positionals.length > 2 || options.help) {
133
135
  console.log(USAGE_TEXT + "\n"); // eslint-disable-line no-console
@@ -145,6 +147,10 @@ function getOptions() {
145
147
  console.log(""); // eslint-disable-line no-console
146
148
  exit(0);
147
149
  }
150
+ if (options.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.8",
4
4
  "description": "SingleFile CLI",
5
5
  "author": "Gildas Lormeau",
6
6
  "engines": {