This file contains hidden or 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 getData = (id) => { | |
if (!id) { | |
throw new Error('No id found'); | |
} | |
return [1, 2, 3, 4, 5].filter(i => i % id); | |
}; | |
try { | |
const data = getData(2); // [1, 3, 5] |
This file contains hidden or 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": "nextjs-with-google-cloud-run", | |
"version": "0.1.0", | |
"private": true, | |
"scripts": { | |
"dev": "next dev", | |
"build": "next build", | |
"start": "next start -p $PORT" | |
}, | |
"dependencies": { |
This file contains hidden or 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: nextjs-cloud-run | |
on: | |
push: | |
branches: | |
- master | |
- main | |
env: | |
CLOUD_RUN_PROJECT_ID: ${{ secrets.CLOUD_RUN_PROJECT_NAME }} |
This file contains hidden or 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
Dockerfile | |
.dockerignore | |
node_modules | |
npm-debug.log |
This file contains hidden or 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
# base image | |
FROM node:14.15.4-alpine | |
# Create and change to the app directory. | |
WORKDIR /usr/app | |
# Copy application dependency manifests to the container image. | |
# A wildcard is used to ensure copying both package.json AND package-lock.json (when available). | |
# Copying this first prevents re-running npm install on every code change. | |
COPY . . |
This file contains hidden or 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
"Image placeholder": { | |
"prefix": "img#placeholder", | |
"body": [ | |
"${2:https://via.placeholder.com/${1:150}}" | |
], | |
"description": "Image placeholder" | |
} |
This file contains hidden or 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
"Jest It": { | |
"prefix": "jest#it", | |
"body": [ | |
"it('should $1', () => {", | |
" const actual = $2;", | |
" const expected = $3;", | |
" ", | |
" expect(actual).toBe(expected);", | |
"});" | |
], |
This file contains hidden or 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
"Jest Describe": { | |
"prefix": "jest#describe", | |
"body": [ | |
"describe('$1', () => {", | |
" $2", | |
"});", | |
], | |
"description": "Jest Describe block" | |
} |
This file contains hidden or 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
"Jest Describe Full": { | |
"prefix": "jest#describe-full", | |
"body": [ | |
"describe('$1', () => {", | |
" describe('happy paths', () => {", | |
" it('should return the value', () => {", | |
" expect(1).toBeTruthy();", | |
" });", | |
" });", | |
" describe('exception paths', () => {", |
This file contains hidden or 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
"React Component using filename": { | |
"prefix": "react#component-using-filename", | |
"body": [ | |
"export type ${TM_FILENAME_BASE/(.*)/${1:/capitalize}Props/} = {};", | |
"export const ${TM_FILENAME_BASE/(.*)/${1:/capitalize}/} = (props: ${TM_FILENAME_BASE/(.*)/${1:/capitalize}Props/}) => {", | |
" return (", | |
" $2", | |
" );", | |
"};" | |
], |