Skip to content

Instantly share code, notes, and snippets.

View jonoirwinrsa's full-sized avatar
🐢
Turtle curling

Jonathan Irwin jonoirwinrsa

🐢
Turtle curling
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jonoirwinrsa on github.
  • I am jonoirwin (https://keybase.io/jonoirwin) on keybase.
  • I have a public key whose fingerprint is 6952 65FA 7712 0F56 C2A8 AEB0 4338 B461 ED31 4BE5

To claim this, I am signing this object:

Description: >
Script to create a SSL certificate, S3 bucket and Cloudfront distribution.
###############################################################################
Parameters:
###############################################################################
DomainName:
Type: String
Description: The domain name.
@jonoirwinrsa
jonoirwinrsa / find-all-map-files.js
Last active February 16, 2019 15:23
Upload Create React App sourcemaps to Bugsnag - Step 1
const glob = require('glob');
/**
* Find all of the map files in ./build
*/
function findSourceMaps(callback) {
return glob('build/**/*/*.map', callback);
}
@jonoirwinrsa
jonoirwinrsa / upload-sourcemap-to-bugsnag.js
Last active February 16, 2019 15:42
Upload Create React App sourcemaps to Bugsnag - Step 2
const { upload } = require('bugsnag-sourcemaps');
const appVersion = require('./package.json').version;
/**
* Uploads the source map with accompanying sources
* @param sourceMap - single .map file
* @returns {Promise<string>} - upload to Bugsnag
*/
function uploadSourceMap(sourceMap) {
// Remove .map from the file to get the js filename
@jonoirwinrsa
jonoirwinrsa / delete-source-map-files.js
Last active February 16, 2019 15:21
Upload Create React App sourcemaps to Bugsnag - Step 3
const fs = require('fs');
/**
* Delete the .map files
* We do this to protect our source
* @param files - array of source map files
*/
function deleteFiles(files) {
files.forEach(file => {
const path = `${__dirname}/${file}`;
@jonoirwinrsa
jonoirwinrsa / process-source-maps.js
Created February 16, 2019 15:04
Upload Create React App sourcemaps to Bugsnag - Step 4
/**
* Find, upload and delete Source Maps
*/
function processSourceMaps() {
findSourceMaps((error, files) =>
Promise.all(files.map(uploadSourceMap))
.then(() => {
deleteFiles(files);
notifyRelease(); // Bonus Step
})
@jonoirwinrsa
jonoirwinrsa / notify-bugsnag-of-new-release.js
Created February 16, 2019 15:08
Upload Create React App sourcemaps to Bugsnag - Step 5
const reportBuild = require('bugsnag-build-reporter');
/**
* Notifies Bugsnag of the new release
*/
function notifyRelease() {
reportBuild({
apiKey: process.env.REACT_APP_BUGSNAG_API_KEY,
appVersion,
releaseStage: process.env.REACT_APP_RELEASE_STAGE,
@jonoirwinrsa
jonoirwinrsa / process-bugsnag-sourcemaps.js
Created February 16, 2019 15:18
Upload Create React App sourcemaps to Bugsnag - Complete
const { upload } = require('bugsnag-sourcemaps');
const glob = require('glob');
const fs = require('fs');
const appVersion = require('./package.json').version;
const reportBuild = require('bugsnag-build-reporter');
/**
* Find all of the map files in ./build
*/
function findSourceMaps(callback) {
@jonoirwinrsa
jonoirwinrsa / docker-expo-ci.dockerfile
Created May 14, 2019 08:23
Docker image for expo
FROM node:lts-alpine
# Install Ruby
RUN apk update && apk upgrade && apk --update add \
git \
bash \
curl \
wget \
zip \
unzip \
{
"Version": "2012-10-17",
"Id": "PersonalizeS3BucketAccessPolicy",
"Statement": [
{
"Sid": "PersonalizeS3BucketAccessPolicy",
"Effect": "Allow",
"Principal": {
"Service": "personalize.amazonaws.com"
},