Skip to content

Commit 7c49a0d

Browse files
committed
Initial work
- Add Initial circle config - Update configs, add webpack for umd bundles - Update build and publish process
1 parent 9bf81af commit 7c49a0d

20 files changed

+5739
-6
lines changed

.browserslistrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Browsers that we support
2+
3+
> 1%
4+
not dead

.circleci/config.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
version: 2.1
2+
3+
# COMMANDS ------------------------------------------------
4+
commands:
5+
# Command that builds, compiles and bundles the app
6+
build_app:
7+
parameters:
8+
store_bundle:
9+
type: boolean
10+
default: true
11+
steps:
12+
- run:
13+
name: Build App
14+
command: yarn build
15+
16+
- when:
17+
condition:
18+
equal: [true, << parameters.store_bundle >>]
19+
steps:
20+
- store_artifacts:
21+
name: Store Bundled Files
22+
path: dist
23+
24+
publish_app:
25+
steps:
26+
- run:
27+
name: Authenticate with registry
28+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/project/.npmrc
29+
30+
- run:
31+
name: Publish package
32+
command: npm publish
33+
34+
# Command that runs all checks (lint/typechecks/prettier/jest) and stores results
35+
run_checks:
36+
steps:
37+
- run:
38+
name: Run ESLint
39+
command: yarn lint
40+
41+
- run:
42+
name: Run TS Type Checking
43+
command: yarn check-types
44+
45+
- run:
46+
name: Run Prettier
47+
command: yarn prettier
48+
49+
- run:
50+
name: Run Jest and Collect Coverage
51+
command: yarn test:ci
52+
53+
- store_test_results:
54+
path: coverage
55+
56+
- store_artifacts:
57+
name: Store Code Coverage Results
58+
path: coverage
59+
60+
# Command that checks out the code, installs dependencies and caches source/deps
61+
setup:
62+
parameters:
63+
git_cache_version:
64+
type: string
65+
default: v1
66+
yarn_cache_version:
67+
type: string
68+
default: v1
69+
steps:
70+
- restore_cache:
71+
keys:
72+
- source-<< parameters.git_cache_version >>-{{ .Branch }}-{{ .Revision }}
73+
- source-<< parameters.git_cache_version >>-{{ .Branch }}-
74+
- source-<< parameters.git_cache_version >>-
75+
76+
- checkout
77+
78+
- save_cache:
79+
key: source-<< parameters.git_cache_version >>-{{ .Branch }}-{{ .Revision }}
80+
paths:
81+
- '.git'
82+
83+
- run:
84+
name: Get Node Version
85+
command: node --version
86+
87+
- run:
88+
name: Get Yarn Version
89+
command: yarn --version
90+
91+
- restore_cache:
92+
name: Restore yarn package cache
93+
keys:
94+
# when lock file changes, use increasingly general patterns to restore cache
95+
- yarn-packages-<< parameters.yarn_cache_version >>-{{ .Branch }}-{{ checksum "yarn.lock" }}
96+
- yarn-packages-<< parameters.yarn_cache_version >>-{{ .Branch }}-
97+
- yarn-packages-<< parameters.yarn_cache_version >>-
98+
99+
- run:
100+
name: Yarn Install
101+
command: yarn install --production=false --frozen-lockfile
102+
103+
- save_cache:
104+
name: Save yarn package cache
105+
key: yarn-packages-<< parameters.yarn_cache_version >>-{{ .Branch }}-{{ checksum "yarn.lock" }}
106+
paths:
107+
- ~/.cache/yarn
108+
109+
# EXECUTORS -----------------------------------------------
110+
executors:
111+
default:
112+
docker:
113+
- image: cimg/node:14.16.1-browsers
114+
environment:
115+
NODE_ENV: production
116+
NODE_OPTIONS: --max_old_space_size=8192
117+
resource_class: medium
118+
119+
# JOBS ----------------------------------------------------
120+
jobs:
121+
branch_build:
122+
executor: default
123+
steps:
124+
- setup
125+
- run_checks
126+
- build_app:
127+
store_bundle: false
128+
129+
main_build:
130+
executor: default
131+
steps:
132+
- setup
133+
- run_checks
134+
- build_app
135+
- publish_app
136+
137+
# WORKFLOWS -----------------------------------------------
138+
workflows:
139+
version: 2
140+
build:
141+
jobs:
142+
- branch_build:
143+
filters:
144+
branches:
145+
ignore: main
146+
147+
build_and_publish:
148+
jobs:
149+
- main_build:
150+
filters:
151+
branches:
152+
only: main

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 120
11+
trim_trailing_whitespace = true

.eslintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
coverage/**
2+
dist/**
3+
node_modules/**
4+
5+
.eslintrc.js
6+
babel.config.json
7+
jest.config.js
8+
tsconfig.json
9+
webpack.config.js

.eslintrc.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
env: { browser: true, es6: true, jest: true, node: true },
3+
extends: [
4+
'eslint:recommended',
5+
'plugin:react/recommended',
6+
'plugin:@typescript-eslint/eslint-recommended',
7+
'plugin:@typescript-eslint/recommended',
8+
'plugin:prettier/recommended',
9+
],
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: { ecmaFeatures: { jsx: true }, ecmaVersion: 2020, project: ['tsconfig.json'], sourceType: 'module' },
12+
plugins: ['@typescript-eslint', 'react-hooks', 'react', 'prettier'],
13+
rules: {
14+
'@typescript-eslint/no-empty-function': 'off',
15+
'@typescript-eslint/no-explicit-any': 'off',
16+
'@typescript-eslint/no-var-requires': 'off',
17+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
18+
'max-len': ['warn', { code: 120, ignorePattern: '//', ignoreStrings: true }],
19+
'new-cap': ['warn', { properties: false }],
20+
'no-unused-vars': 'off',
21+
'react/jsx-filename-extension': ['warn', { extensions: ['.jsx', '.tsx'] }],
22+
'react/jsx-uses-react': 'off',
23+
'react/no-unescaped-entities': 'off',
24+
'react/prop-types': 'off',
25+
'react/react-in-jsx-scope': 'off',
26+
'react-hooks/rules-of-hooks': 'error',
27+
'react-hooks/exhaustive-deps': 'warn',
28+
},
29+
settings: { react: { version: 'detect' } },
30+
};

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.DS_Store
22
.vscode
33
*.tsbuildinfo
4+
coverage
5+
dist
46
node_modules
57
Thumbs.db

.npmignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.*
2+
3+
babel.config.json
4+
jest.config.js
5+
tsconfig.*
6+
webpack.config.js
7+
8+
coverage
9+
node_modules
10+
src

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=http://registry.npmjs.org/
2+
package-lock=false

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/**
2+
dist/**
3+
node_modules/**

.prettierrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"arrowParens": "avoid",
3+
"printWidth": 120,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "all",
7+
"overrides": [
8+
{
9+
"files": ["*.yml", "*.yaml"],
10+
"options": {
11+
"tabWidth": 2
12+
}
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)