How to use module import in nodejs
Issue #752
Use esm
1 | npm install esm |
In our code, import as normal
1 | const fs = require('fs'); |
Then use esm
to convert
1 | { |
Issue #752
Use esm
1 | npm install esm |
In our code, import as normal
1 | const fs = require('fs'); |
Then use esm
to convert
1 | { |
Issue #751
Declare data/package.json
to make it into node module
1 | { |
Then in landing/package.json
, use file
1 | { |
Issue #651
Use shelljs
1 | npm install shelljs |
1 | const shell = require('shelljs') |
The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks.
The . at end of the source path is a specific cp syntax that allow to copy all files and folders, included hidden ones.
Updated at 2020-05-07 04:10:05
Issue #650
Install
1 | npm install @babel/core |
Configure .babelrc
1 | { |
In package.json
, transpile using npx babel
then node dist/index.js
1 | "start": "cp ../landing/src/apps/factory.js copied/factory.js && npx babel index.js --out-file dist/index.js && npx babel copied/factory.js --out-file dist/factory.js && node dist/index.js" |
Issue #492
Suppose we have a base Localizable.strings
1 | "open" = "Open"; |
After sending that file for translations, we get translated versions.
1 | "open" = "Åpen"; |
Searching and copy pasting these to our Localizable.strings is tedious and time consuming. We can write a script to apply that.
Remember that we need to be aware of smart and dump quotes
1 | .replace(/\"/g, '') |
1 | const fs = require('fs') |
Issue #430
1 | npm install electron-builder@latest --save-dev |
package.json
1 | { |
entitlements.plist
1 |
|
afterSignHook.js
1 | const fs = require('fs'); |
Generate password for Apple Id because of 2FA
1 | export appleId=onmyway133@gmail.com |
1 | spctl --assess --verbose Icon\ Generator.app |
dist
folder for distribution, for example dist/mac/Icon Generator
, I’ve renamed babel generated code to babel
directoryIt is because of afterSignHook. Ignore in .babelrc
not work
1 | { |
Should use babel 7 with babel.config.js
1 | npm install --save @babel/runtime |
https://httptoolkit.tech/blog/notarizing-electron-apps-with-electron-forge/
Issue #419
1 | function write(json) { |
1 | async function readAll() { |
Issue #418
Path for user users/nsspain/videos
Path for showcase https://developer.vimeo.com/api/reference/albums#get_album
Path for Channels, Groups and Portfolios
1 | const Vimeo = require('vimeo').Vimeo |
Response look like
1 | { |
Issue #417
1 | class Youtube { |
Response look like
1 | { |
To handle pagination
1 | async getVideosLoop(playlistId, nextPageToken, items, count) { |
To get playlist title, use playlists.list
Issue #399
App.js
1 | import React, { Component } from 'react'; |
Main.js
1 | // @flow |
Use express
and socket.io
index.js
1 | // @flow |
Issue #398
Dependencies
1 | const Rx = require('rxjs/Rx') |
Use GraphQL
1 | makeOptions(query, token) { |
Use orderBy
1 | fetchPRsAndIssues(dates) { |
Issue #252
Read more https://medium.com/flawless-app-stories/how-to-make-auto-layout-more-convenient-in-ios-df3b42fed37f
This is a script to remove Cartography, and use plain NSLayoutAnchor syntax.
Use Constraint.on() from Sugar.
It will change all .swift files recursively under provided folder.
1 | Constraint.on( |
Install tool if needed
1 | brew install yarn |
How to use
1 | yarn install |
1 |
|
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 existing node.js
modules. Let’s give it a try.