Skip to content

Instantly share code, notes, and snippets.

View dankochetov's full-sized avatar
🚀

Dan Kochetov dankochetov

🚀
View GitHub Profile
@dankochetov
dankochetov / .xo-config.js
Created August 9, 2022 10:18
.xo-config.js
module.exports = {
prettier: true,
plugins: ['eslint-comments'],
rules: {
'import/extensions': 'off',
'unicorn/prefer-module': 'off',
'unicorn/filename-case': 'off',
'node/prefer-global/process': 'off',
'@typescript-eslint/naming-convention': 'off',
'import/order': 'off',
{
"typescript": {
"useTabs": true,
"quoteStyle": "preferSingle",
"quoteProps": "asNeeded",
"arrowFunction.useParentheses": "force",
"jsx.quoteStyle": "preferSingle"
},
"json": {},
"markdown": {},
@dankochetov
dankochetov / env.ts
Last active January 20, 2022 10:35
getEnvVar and getEnvFlag type-safe functions
type EnvVarName =
| 'FOO'
| 'BAR';
type EnvFlagName =
| 'IS_FOO'
| 'IS_BAR';
export function getEnvVar<T extends string = EnvVarName | EnvFlagName>(
name: T,
env:
browser: true
es6: true
extends:
- plugin:react/recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- airbnb-typescript
- prettier
@dankochetov
dankochetov / lifecycle-cheat-sheet.md
Created June 5, 2020 10:43 — forked from HyperBrain/lifecycle-cheat-sheet.md
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@dankochetov
dankochetov / build.sh
Last active April 16, 2020 08:54
CI script for frontend
#!/usr/bin/env bash
# Enable commands logging
PS4="> "
set -x
set -e
if ! [[ -x "$(command -v pip3)" ]]; then
apt-get update && apt-get install -y python3-pip
@dankochetov
dankochetov / bitbucket-pipelines.yml
Last active February 5, 2020 11:30
Deploy static website to S3 using BitBucket pipelines (see build.sh)
image: node:10.17.0
pipelines:
branches:
develop:
- step:
deployment: development
script:
- ./scripts/build.sh
master:
@dankochetov
dankochetov / buildspec.yml
Last active October 28, 2019 15:28
Deploy static website to S3 using CodeBuild
version: 0.2
run-as: root
phases:
pre_build:
commands:
- npm install
build:
commands: