- Install NPM dependencies.
yarn install
- Start development server.
yarn start
(Optional): Before 1. and 2.
REACT_APP_API_KEY=your-api-key
REACT_APP_API_HOST=<api-provider>.com
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
indent_size = 2 | |
indent_style = space | |
insert_final_newline = true | |
trim_trailing_whitespace = true | |
[*.md] | |
trim_trailing_whitespace = false |
{ | |
"arrowParens": "avoid", | |
"bracketSpacing": true, | |
"semi": false, | |
"singleQuote": true, | |
"tabWidth": 2, | |
"trailingComma": "all", | |
"useTabs": false, | |
"proseWrap": "always", | |
"printWidth": 80, | |
"overrides": [ | |
{ | |
"files": "*.md", | |
"options": { | |
"printWidth": 120 | |
} | |
} | |
] | |
} |
const getEnv = (name: string): string => { | |
const value = process.env[name]; | |
if (!value) { | |
throw new Error(`Missing: process.env['${name}'].`); | |
} | |
return value; | |
}; | |
const isNumber = (envVar: string) => { | |
const value = Number(envVar); | |
if (isNaN(value)) { | |
throw new Error(`Provided ENV var "${envVar}" is not a number.`); | |
} | |
return value; | |
}; | |
const isBool = (envVar: string) => { | |
if (envVar !== "true" && envVar !== "false") { | |
throw new Error(`Provided ENV var "${envVar}" is not "true" or "false"`); | |
} | |
return Boolean(envVar); | |
}; | |
const config = { | |
string: getEnv("REACT_APP_STRING"), | |
number: isNumber(getEnv("REACT_APP_NUMBER")), | |
boolean: isBool(getEnv("REACT_APP_BOOLEAN")) | |
}; | |
export default config; |
const fs = require("fs"); | |
const https = require("https"); | |
const url = | |
"https://gist.githubusercontent.com/sitek94/b206d93209dbca994c26761e179ef6f5/raw/.prettierrc.json"; | |
https | |
.get(url, (res) => { | |
console.log("Fetching Prettier config..."); | |
let chunks = []; | |
res.on("data", (chunk) => { | |
chunks.push(chunk); | |
}); | |
res.on("end", () => { | |
console.log("Prettier config fetched!"); | |
const json = Buffer.concat(chunks).toString(); | |
console.log("Writing Prettier config..."); | |
fs.writeFileSync(".prettierrc", json); | |
console.log("Prettier config created!"); | |
}); | |
}) | |
.on("error", (err) => { | |
console.log("Error: ", err.message); | |
}); |
{ | |
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"" | |
} |