New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

figma-backup

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

figma-backup - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

Dockerfile

32

lib/Bot.js

@@ -142,5 +142,4 @@ "use strict";

}
catch (e) {
await this.stop();
throw new errors_1.BackupError(e);
catch (err) {
throw new errors_1.BackupError(err);
}

@@ -152,5 +151,7 @@ }

const isWindows = process.platform === "win32";
const ownArgs = ["--disable-dev-shm-usage"];
const rootUserArgs = [...ownArgs, "--no-sandbox"];
this._browser = await puppeteer_1.default.launch({
headless: !this._debug,
args: isRootUser ? ["--no-sandbox"] : undefined,
args: isRootUser ? rootUserArgs : ownArgs,
ignoreDefaultArgs: isWindows ? ["--disable-extensions"] : undefined

@@ -168,11 +169,22 @@ });

_timer.start();
await this._backupProjects();
(0, utils_1.log)(chalk_1.default.red.bold(`Backup task finished! (time elapsed: ${_timer.end()}s)`));
await this.stop();
try {
await this._backupProjects();
(0, utils_1.log)(chalk_1.default.red.bold(`Backup task finished! (time elapsed: ${_timer.end()}s)`));
}
catch (err) {
(0, utils_1.log)(chalk_1.default.bold.red(`ERR. ${err.message}`));
}
finally {
await this.stop();
}
}
async stop() {
(0, utils_1.log)(chalk_1.default.red(">") + chalk_1.default.bold(" Stopping the bot..."));
if (this._browser)
await this._browser.close();
this._browser = null;
try {
if (this._browser)
await this._browser.close();
}
finally {
this._browser = null;
}
}

@@ -179,0 +191,0 @@ }

@@ -8,3 +8,3 @@ "use strict";

const path_1 = __importDefault(require("path"));
exports.VERSION = "2.0.1";
exports.VERSION = "2.0.2";
exports.ROOT_DIR = "figma-backup-root";

@@ -11,0 +11,0 @@ exports.BACKUP_DIR = path_1.default.join(exports.ROOT_DIR, "backups");

@@ -68,3 +68,3 @@ #! /usr/bin/env node

].join("\n"),
default: 5,
default: 60,
type: "number"

@@ -71,0 +71,0 @@ },

@@ -57,3 +57,3 @@ #! /usr/bin/env node

type: "number",
default: 5,
default: 60,
describe: "This number indicates the maximum amount of time the bot has to wait for a file to be downloaded. (in minutes)."

@@ -60,0 +60,0 @@ })

@@ -11,4 +11,4 @@ "use strict";

const { Spinner } = clui_1.default;
const saveLocalCopy = async (page, file, options) => {
const { interactionDelay, typingDelay, downloadTimeout } = options;
const saveLocalCopy = async (page, file, init) => {
const { interactionDelay, typingDelay, downloadTimeout } = init;
(0, log_1.default)(chalk_1.default.red("\t\t.") + chalk_1.default.bold(` Opening up the figma command palette...`));

@@ -19,3 +19,2 @@ const MainKeyInput = process.platform === "darwin" ? "Meta" : "Control";

await page.keyboard.up(MainKeyInput);
await (0, wait_1.default)(interactionDelay);
try {

@@ -27,3 +26,3 @@ await page.waitForSelector("[class*='quick_actions--search']", {

catch (_a) {
chalk_1.default.bold.red("\t\tERR. Couldn't open the figma command palette.");
(0, log_1.default)(chalk_1.default.bold.red("\t\tERR. Couldn't open the figma command palette."));
await (0, wait_1.default)(interactionDelay);

@@ -35,3 +34,2 @@ await page.close();

try {
await (0, wait_1.default)(interactionDelay);
await page.waitForSelector("[class*='quick_actions--result']", {

@@ -42,3 +40,3 @@ timeout: interactionDelay

catch (_b) {
chalk_1.default.bold.red("\t\tERR. Couldn't find the download command.");
(0, log_1.default)(chalk_1.default.bold.red("\t\tERR. Couldn't find the download command."));
await (0, wait_1.default)(interactionDelay);

@@ -48,3 +46,2 @@ await page.close();

(0, log_1.default)(chalk_1.default.red("\t\t.") + chalk_1.default.bold(` Execute the download command...`));
await (0, wait_1.default)(interactionDelay);
await page.keyboard.press("Enter");

@@ -54,5 +51,9 @@ const spinner = new Spinner("\t\t. Waiting for the file to be downloaded...");

spinner.start();
await page.waitForNetworkIdle({ timeout: downloadTimeout });
await page.waitForNetworkIdle({
timeout: downloadTimeout,
idleTime: 5000 + interactionDelay
});
spinner.stop();
(0, log_1.default)(chalk_1.default.green.bold(`\t\t. File (${file.name}) successfully downloaded.`));
(0, log_1.default)(chalk_1.default.green.bold(`\t\t. File (${file.name}) successfully downloaded.` +
"\n\t\t (You are seeing this message because the bot has detected network idleness and assumes the download has finished)"));
}

@@ -59,0 +60,0 @@ catch (_c) {

{
"name": "figma-backup",
"version": "2.0.1",
"version": "2.0.2",
"main": "./lib/index.js",

@@ -5,0 +5,0 @@ "repository": "git@github.com:mimshins/figma-backup.git",

@@ -113,2 +113,38 @@ <div align="center">

### Docker Container
You can also use docker container and run the `figma-backup` command in it.
<details>
<summary>Usage
</summary>
Building image:
```bash
docker build -t <image_name> -f Dockerfile .
```
Running the container:
```bash
docker run --name <container_name> -it <image_name> bash
```
**Note:**
If you face the following error:
```bash
Error: Failed to launch the browser process!
[19:19:0914/132053.471715:ERROR:browser_main_loop.cc(1409)] Unable to open X display.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203:20)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:194:79)
at ChildProcess.emit (node:events:525:35)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
```
You can follow [this](https://stackoverflow.com/questions/60304251/unable-to-open-x-display-when-trying-to-run-google-chrome-on-centos-rhel-7-5/61043049#61043049) and set the screen to something like:
```bash
Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99
```
</details>
---

@@ -115,0 +151,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc