Skip to content

Instantly share code, notes, and snippets.

View frank-dspeed's full-sized avatar
🇩🇪
I Engineer

Frank Lemanschik frank-dspeed

🇩🇪
I Engineer
View GitHub Profile
@frank-dspeed
frank-dspeed / Replace PNPM or use it with NPM.md
Created June 10, 2022 10:02
Replace PNPM or use it with NPM

It looks like this already may be possible, unless I'm misunderstanding the exact use case:

Generate a package-lock.json file without installing dependencies in node_modules: npm i --package-lock-only

I was only using pnpm for demo projects to save disk space because I needed a package-lock.json on the CI servers, but it looks like I can just generate it via npm while keeping the node_modules symlinked to a central store. I think this means I can now use pnpm for work projects too.

See https://stackoverflow.com/a/54910009/552792

@frank-dspeed
frank-dspeed / Run puppeteer with prepend or custom args arrguments docker.md
Created June 8, 2022 15:05
Run puppeteer with prepend or custom args arrguments for docker and so on

Final Solution!

The following example exposes defaultArgs for the Chrome and Firefox Launcher via undocumented api's and uses the documented ignoreDefaultArgs: true option to supply fully costumized args: [] containing the defaults for the given browser launcher

import

import Puppeteer from 'puppeteer';

in case of firefox inside docker set product before running the next part:

@frank-dspeed
frank-dspeed / Topic Complex User Management on Github and gitlab for Big Distributed Organisations.md
Created June 3, 2022 07:12
Topic Complex User Management on Github and gitlab for Big Distributed Organisations

Topic Complex User Management on Github and gitlab for Big Distributed Organisations

You will learn how to create so called right repos they are like block chains for User Authorization and Access rules in a universal fassion they consist of key value pairs space seperated and a additional project config

groups

# UUID                                  	Group Name
#
90ae353754880d03a2d1d10f7d14f56da93d2624	chrome-infra-team
@frank-dspeed
frank-dspeed / puppeteer docker image.md
Created June 1, 2022 09:38
How to run pupeeter with a docker image as binary

docketeer.cjs

const os = require('os');
const path = require('path');
const fs = require('fs');

const dockerImage = 'browserless/chrome:latest'
const dockerExecutablePath = '/usr/bin/google-chrome'
const executablePath = path.join(__dirname, 'Chrome-Launcher');
@frank-dspeed
frank-dspeed / The Myth about ESM Module System as Answer to everything. in the ECMAScript World.md
Last active April 27, 2022 08:45
The Myth about ESM Module System as Answer to everything. in the ECMAScript World

The Myth about ESM Module System as Answer to everything. in the ECMAScript World

The Problem is easy to Explain the ECMAScript Engine Boots Sync for good reason and ESModules are designed to be Async by default as they have to come from a external source.

So in some development strategies you need Sync behavior from start till end this is not archive able with ESModules again by design!

In general everything that interacts with the nativeCode of the engine needs to use so called NativeRequire a function that exposes modules that are loaded inside the Engine it self not the JS Scope then it exposes that loaded NativModule via Bindings in the JS Scope. NativModule Loading is a Sync Prozess even if the lib is dynamic linked. Always remember the Core JS ES Principle that it is Strict Sync and then returns to the Async stack and again processes fully sync.

@frank-dspeed
frank-dspeed / The Myth of Datacenter Deployment Structures.md
Created April 27, 2022 07:27
The Myth of Datacenter Deployment Structures.

Hyper-Convergence

Traditional Deployments HCI & dHCI Composeable

There are a lot of myth around that and its true that there is some kind of vendor lockin that is always! abstract able! There are in Reality only Moving costs that are per provider depending on Compute + Input Output costs.

InHouse Compute and Inout/Ouput Traffic can be calculated on the Hardware and Electricity Costs. OutHouse Compute and InputUOutput Traffic depends on the Provider Pricing and your Local or Remote Script Execution costs.

@frank-dspeed
frank-dspeed / PACKAGE_AUTHORING_GUIDE.md
Last active April 24, 2022 06:07
Package Authoring Manual for NodeJS made by Frank Lemanschik member of the @NodeJS/PackageMaintainance Group

Package Authoring Guide for Nodejs

In General you should author your extensions to work with CJS and offer a ESM Wrapper for the Exports if they are not already getting interpreted by the CJS-MODULE-Lexer

Why CJS first it is old?

Because the Engine by Default is Sync and the new introduced Module System is Async and can produce easy single file code that is sync and static analyzeable. So if you publish something as ESM only it can not contain nativ code that is bound to the engine. As rule of thumb if you produce something where you need to interact with Nativ Code in Sync better produce CJS without the ESM loader envolved that makes your Module Compatible to NodeJS (Nativ) Electron (Nativ) and other Runtimes that use native code.

When you target mainly browsers and you offer a function that is always async you can go ESM Only.

What is ESM?

@frank-dspeed
frank-dspeed / INSTALL_NGINX.md
Created April 18, 2022 05:47
StealifyOS - Linux Setup Nginx
  1. Install Docker
  2. secudule docker to autostart in systemd by default socket activated.
  3. use --restart=always

your done as docker manages the container and

upgrade and restart (can take some secunds)

docker pull nginx:latest && docker-compose rm -s nginx_container && docker-compose up -d

Electron ESM Support

Electron it self supports the usage of ESM you can load them via a cjs entry point and import(absolutePath)

in the import the createRequire will not work as expected there are dragons because some vars get copyed once only

but that is a none blocker normaly as long as you init your CJS code parts in CJS and keep your ESM Code ESM Only

for example at present there are no NodeJS and Or Electron ESM Modules the import fs from 'fs' is done on best effort base as so all the CJS import magic via dynamic import in ESM

@frank-dspeed
frank-dspeed / 1_.README.md
Last active April 14, 2022 09:37
Example .cjs wrapper for real ESM .mjs code introduction pure modules aka Stealify Lang ECMAScript Module Standard

How to use ESM code in a CJS Project

This examples illustrate how to code a wrapper around 1 or more ESM Modules the wrapper gets written in CJS

exposing only namedExports avoid default export by design to make the shift to ESM more easy

also it exposes only Functions (methods) that do handle the import of the ESM dependencies.

also at the end there is a little introduction