Skip to content

Instantly share code, notes, and snippets.

@arnabkd
Created December 2, 2021 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnabkd/3a944e3ef845529f1c7426bf5eab5ae1 to your computer and use it in GitHub Desktop.
Save arnabkd/3a944e3ef845529f1c7426bf5eab5ae1 to your computer and use it in GitHub Desktop.
# Create react-app with typescript
yarn create react-app react-graphql-ts --template typescript
cd react-graphql-ts
mkdir -p src/graphql
cp ../graphql/*.graphql src/graphql
# Deps
yarn add @material-ui/core \
@material-ui/icons \
@apollo/client \
graphql.macro \
react-router-dom
yarn add -D apollo\
@types/react-router-dom \
prettier
# Config prettier
cat > .prettierrc <<EOL
{
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true
}
EOL
cat > .prettierignore <<EOL
# Ignore artifacts:
build
coverage
src/graphql/generated
# Ignore files that were generated by create-react-app
src/index.tsx
src/serviceWorker.ts
# Ignore all HTML files:
*.html
EOL
# Config editorconfig
cat > .editorconfig <<EOL
# http://editorconfig.org
# A special property that should be specified at the top of the file outside of
# any sections. Set to true to stop .editor config file search on current file
root = true
[*]
# Indentation style
# Possible values - tab, space
indent_style = space
# Indentation size in single-spaced characters
# Possible values - an integer, tab
indent_size = 2
# Line ending file format
# Possible values - lf, crlf, cr
end_of_line = lf
# File character encoding
# Possible values - latin1, utf-8, utf-16be, utf-16le
charset = utf-8
# Denotes whether to trim whitespace at the end of lines
# Possible values - true, false
trim_trailing_whitespace = true
# Denotes whether file should end with a newline
# Possible values - true, false
insert_final_newline = true
EOL
cat > apollo.config.js <<EOL
module.exports = {
client: {
service: {
name: 'people',
url: 'http://localhost:8080/graphql'
}
}
};
EOL
yarn apollo client:download-schema
yarn prettier --write .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment