Node 13

How to use module import in nodejs

Issue #752

Use esm

npm install esm

In our code, import as normal

const fs = require('fs');
// intended to be run after babel, and in ./dist folder
import factory from 'data'
const shell = require('shelljs')

Then use esm to …

How to use relative file module with Create React app

Issue #751

Declare data/package.json to make it into node module

{
    "name": "data",
    "version": "0.1.0",
    "private": true,
    "homepage": ".",
    "main": "main.js"
} …

How to copy folder in nodej

Issue #651

Use shelljs

npm install shelljs
const shell = require('shelljs')
shell.exec(`cp -a source_path/. destination_path`)

The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks.

The …

How to use babel 7 in node project

Issue #650

Install

npm install @babel/core
npm install @babel/cli
npm install @babel/preset-env

Configure .babelrc

{
  "presets": ["@babel/preset-env"]
}

In package.json, transpile using npx babel then node dist/index.js …

How to apply translations to Localizable.strings

Issue #492

Suppose we have a base Localizable.strings

"open" = "Open";
"closed" = "Closed";

After sending that file for translations, we get translated versions.

"open" = "Åpen";
"closed" = …

How to notarize electron app

Issue #430

Use electron builder

npm install electron-builder@latest --save-dev

package.json

{
  "name": …

How to read and write file using fs in node

Issue #419

function write(json) {
    const data = JSON.stringify(json)
    const year = json.date.getFullYear()
    const directory = `collected/${slugify(className)}/${year}`

    fs.mkdirSync(directory, { recursive: true })
    fs.writeFileSync( …

How to get videos from vimeo in node

Issue #418

Code

Path for user users/nsspain/videos Path for showcase https://developer.vimeo.com/api/reference/albums#get_album Path for Channels, Groups and Portfolios

const Vimeo = require('vimeo').Vimeo
const vimeoClient = new Vimeo( …

How to get videos from youtube in node

Issue #417

class Youtube {
    async getVideos(playlistId, pageToken) {
        const options = {
            key: clientKey,
            part: 'id,contentDetails,snippet',
            playlistId: playlistId,
            maxResult: 100, …

How to make collaborative drawing canvas with socketio and node

Issue #399

Client

App.js

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Main from './Main'

class App extends …

How to generate changelog for GitHub releases with rxjs and node

Issue #398

How to

Technical

Dependencies

const Rx = require('rxjs/Rx')
const Fetch = require('node-fetch') …

How to remove Cartography in iOS

Issue #252

Read more https://medium.com/flawless-app-stories/how-to-make-auto-layout-more-convenient-in-ios-df3b42fed37f

Description

This is a script to remove Cartography, and use plain NSLayoutAnchor syntax. Use Constraint.on() from Sugar. It will …

Package node.js application

Issue #57

I like node.js because it has many cool packages. I wish the same goes for macOS. Fortunately, the below solutions provide a way to package node.js modules and use them inside macOS applications. It can be slow, but you save time by using …