This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const { SecretManagerServiceClient } = require('@google-cloud/secret-manager'); | |
const secretManager = new SecretManagerServiceClient(); | |
async function getSecret(name) { | |
const [secretVersion] = await secretManager.accessSecretVersion({ | |
name: `${name}/versions/latest`, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DIR=$1 | |
export BUCKET=$2 | |
cd $DIR | |
ls -l ./ | tr -s ' ' | cut -d' ' -f9 | | |
tr ' ' '\n' | | |
xargs -n 1 -I{} gsutil -h "Cache-Control:no-cache, max-age=0" cp {} gs://$BUCKET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
docker run -p 8000:80 \ | |
-e GOOGLE_APPLICATION_CREDENTIALS=/path/to/creds/in/container.json \ | |
-v $GOOGLE_APPLICATION_CREDENTIALS:/path/to/creds/in/container.json \ | |
gcr.io/$PROJECT_ID/$IMAGE_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy to Google Compute Engine | |
on: | |
push: | |
branches: | |
- master | |
env: | |
PROJECT_ID: ${{ secrets.GCE_PROJECT }} | |
GCE_IMAGE: ${{ secrets.GCE_IMAGE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This stage installs modules | |
FROM node:16.2.0 as modules | |
WORKDIR /app | |
COPY package.json package-lock.json ./ | |
RUN npm ci --production | |
# This stage builds TypeScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFileExtension(file: string) { | |
return file.slice((Math.max(0, file.lastIndexOf('.')) || Infinity) + 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomDiscreteNumber(max: number) { | |
return Math.floor(Math.random() * max) + 1 | |
} | |
export function getRandomColor() { | |
// Use HSL model to create pastel colors. | |
// It is easier to do that by randomizing hue while keeping saturation and lightness in reasonable boundaries. | |
const hue = 6 * randomDiscreteNumber(60) | |
const saturation = 80 + 10 * Math.random() | |
const lightness = (60 + 10 * Math.random()) / 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const forceUpdate = useReducer(() => ({}), {})[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks: | |
- init: npm i | |
github: | |
prebuilds: | |
branches: true | |
image: | |
file: .gitpod.Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const esbuild = require('esbuild'); | |
const path = require('path'); | |
const makeAllPackagesExternalPlugin = { | |
name: 'make-all-packages-external', | |
setup(build) { | |
const filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/; // Must not start with "/" or "./" or "../" | |
build.onResolve({ filter }, args => ({ path: args.path, external: true })); |
OlderNewer