Debian 10 Buster headless
Shared Libraries needed
$ sudo apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0
Local user
| // Updated version of script by Todd Linkner | |
| // This script is for Photoshop CS6. It outputs Android icons of the | |
| // xxxhdpi - ldpi from a source PSD at least 512px x 512px | |
| /* | |
| // BEGIN__HARVEST_EXCEPTION_ZSTRING | |
| <javascriptresource> | |
| <name>$$$/JavaScripts/OutputAndroidIcons/MenuAlt=Output Android Icons</name> | |
| <category>mobile</category> |
| const puppeteer = require('puppeteer'); | |
| const merge = require('merge-img'); | |
| const pageUrl = ''; // REPLACE ME | |
| const pageElement = '#svgcanvas'; // REPLACE ME | |
| (async() => { | |
| const browser = await puppeteer.launch(); | |
| const page = await browser.newPage(); | |
| await page.goto(pageUrl); |
| // Install 'module-name' as a dependency, then: | |
| function init () { | |
| return new Promise ((resolve, reject) => { | |
| const injectScript = (src, callback) => { | |
| const script = document.createElement('script'); | |
| document.head.appendChild(script); | |
| script.onload = callback; | |
| script.src = src; | |
| }; |
| const fs = require("fs"); | |
| const path = require("path"); | |
| function newItem(name, url) { | |
| return { name, url }; | |
| } | |
| const bookmarkPath = path.join( | |
| process.env.HOME, | |
| "/Library/Application Support/Google/Chrome/Default/Bookmarks" |
| var groupBy = function(data, key) { // `data` is an array of objects, `key` is the key (or property accessor) to group by | |
| // reduce runs this anonymous function on each element of `data` (the `item` parameter, | |
| // returning the `storage` parameter at the end | |
| return data.reduce(function(storage, item) { | |
| // get the first instance of the key by which we're grouping | |
| var group = item[key]; | |
| // set `storage` for this instance of group to the outer scope (if not empty) or initialize it | |
| storage[group] = storage[group] || []; | |
| const os = require('os'); | |
| // See docs: https://nodejs.org/api/os.html | |
| const usage = {}; | |
| usage[`require('os').type()`] = { | |
| value: os.type(), | |
| otherValues: [ | |
| 'Linux', 'Darwin', 'Windows_NT' | |
| ], |
| import React, { ReactNode, useContext, useEffect, useState } from 'react'; | |
| import { Websocket } from './websocket'; | |
| export type EchoWebSocketContextType = [ | |
| (event: any, filter?: string) => void, | |
| (event: any) => void | |
| ]; | |
| export const EchoWebSocketContext = React.createContext<EchoWebSocketContextType>([ | |
| () => {}, | |
| () => {}, |
| // modified from https://stackoverflow.com/a/52008131/1461204 | |
| const zoomEvent = new Event('zoom') | |
| let currentRatio = window.devicePixelRatio | |
| function checkZooming() { | |
| if (currentRatio !== window.devicePixelRatio) { | |
| window.dispatchEvent(zoomEvent) | |
| } | |
| } |
The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.await import(…) from CommonJS instead of require(…).