Skip to content

Commit ba23102

Browse files
committed
feat: merged v3 to master
1 parent e112d2d commit ba23102

File tree

545 files changed

+31070
-14272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

545 files changed

+31070
-14272
lines changed

.babelrc

Lines changed: 0 additions & 21 deletions
This file was deleted.

.eslintignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**/node_modules/**
2+
**/build/**
3+
**/dist/**
4+
.eslintrc.js
5+
tailwind.config.js
6+
jest-preprocess.js
7+
setupFilesAfterEnv.js
8+
jest.config.js
9+
tsdx.config.js
10+
tsdx.config.base.js
11+
12+
types/**
13+
# enable linter later
14+
docs/**
15+
example/**
16+
coverage

.eslintrc

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"extends": ["airbnb-typescript", "prettier"],
3+
"plugins": ["simple-import-sort", "import", "prettier"],
4+
"env": {
5+
"jest": true,
6+
"browser": true
7+
},
8+
"overrides": [
9+
{
10+
"files": [
11+
"packages/components/src/**/**/*.ts",
12+
"packages/components/src/**/**/*.tsx",
13+
"packages/hooks/src/**/**/*.ts",
14+
"packages/hooks/src/**/**/*.tsx",
15+
"packages/search-ui/src/**/**/*.ts",
16+
"packages/search-ui/src/**/**/*.tsx",
17+
"packages/utils/src/**/**/*.ts",
18+
"packages/utils/src/**/**/*.tsx",
19+
"packages/styles/src/**/**/*.ts",
20+
"packages/styles/src/**/**/*.tsx"
21+
],
22+
"rules": {
23+
// Prettier setup
24+
"prettier/prettier": "error",
25+
26+
// Fix up spacing between declarations
27+
"padding-line-between-statements": [
28+
"error",
29+
{
30+
"blankLine": "never",
31+
"prev": ["singleline-const", "singleline-let", "singleline-var"],
32+
"next": ["singleline-const", "singleline-let", "singleline-var"]
33+
}
34+
],
35+
36+
// Sort imports
37+
"sort-imports": "off",
38+
"import/order": "off",
39+
"simple-import-sort/imports": "error",
40+
"simple-import-sort/exports": "error",
41+
42+
// Named or default is fine
43+
"import/prefer-default-export": "off",
44+
45+
// TODO: We should fix up the paths so we can re-enable this rule
46+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
47+
"import/no-extraneous-dependencies": "off",
48+
49+
// Not required with TS
50+
"react/prop-types": "off",
51+
"react/require-default-props": "off",
52+
53+
// Useful feature
54+
"react/jsx-props-no-spreading": "off",
55+
56+
"react/react-in-jsx-scope": "off",
57+
58+
// Fix TypeScript extension issues
59+
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js#L139
60+
// https://stackoverflow.com/questions/59265981/typescript-eslint-missing-file-extension-ts-import-extensions
61+
"import/extensions": [
62+
"error",
63+
"ignorePackages",
64+
{
65+
"js": "never",
66+
"mjs": "never",
67+
"jsx": "never",
68+
"ts": "never",
69+
"tsx": "never"
70+
}
71+
],
72+
73+
// Let prettier take care of it
74+
"@typescript-eslint/indent": "off",
75+
76+
// This one is annoying
77+
"@typescript-eslint/explicit-function-return-type": "off",
78+
79+
// Dangling commas make merge/diffs easier
80+
"@typescript-eslint/comma-dangle": "off"
81+
}
82+
}
83+
],
84+
"settings": {
85+
"react": {
86+
"pragma": "h",
87+
"version": "detect"
88+
}
89+
},
90+
"parserOptions": {
91+
"sourceType": "module",
92+
"ecmaFeatures": {
93+
"jsx": true
94+
},
95+
"project": "./tsconfig.json"
96+
}
97+
}

.gcloudignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 9 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,13 @@
1-
2-
# Created by https://www.gitignore.io/api/node
3-
4-
### Node ###
5-
# Logs
6-
logs
71
*.log
8-
npm-debug.log*
9-
yarn-debug.log*
10-
yarn-error.log*
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
2+
.DS_Store
3+
node_modules
4+
dist
225
coverage
236

24-
# nyc test coverage
25-
.nyc_output
26-
27-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
28-
.grunt
29-
30-
# Bower dependency directory (https://bower.io/)
31-
bower_components
32-
33-
# node-waf configuration
34-
.lock-wscript
35-
36-
# Compiled binary addons (http://nodejs.org/api/addons.html)
37-
build/Release
38-
39-
# Dependency directories
40-
node_modules/
41-
jspm_packages/
42-
43-
# Typescript v1 declaration files
44-
typings/
45-
46-
# Optional npm cache directory
47-
.npm
48-
49-
# Optional eslint cache
50-
.eslintcache
51-
52-
# Optional REPL history
53-
.node_repl_history
54-
55-
# Output of 'npm pack'
56-
*.tgz
57-
58-
# Yarn Integrity file
59-
.yarn-integrity
60-
61-
# dotenv environment variables file
62-
.env
63-
64-
# built files
65-
lib/
66-
dist/
67-
.docz/
68-
69-
# dev
70-
dev/
71-
72-
# cache files
73-
.rpt2_cache/
7+
node_modules
8+
package-lock.json
9+
yarn.lock
10+
!/yarn.lock
7411

75-
# End of https://www.gitignore.io/api/node
12+
.yalc
13+
yalc.lock

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.9
1+
12.16.1

.prettierignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
build/
2+
dist/
3+
coverage/
4+
__snapshots__/
5+
node_modules/
6+
storybook-static/
7+
package-lock.json
8+
yarn.lock
9+
package.json
10+
.cache/
11+
# next.js
12+
.next/
13+
out/

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"useTabs": false,
3+
"tabWidth": 2,
4+
"printWidth": 120,
5+
"singleQuote": true,
6+
"trailingComma": "all"
7+
}

.prettierrc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: node_js
2-
node_js:
3-
- "10"
4-
before_install:
5-
- curl -o- -L https://yarnpkg.com/install.sh | bash
6-
- export PATH="$HOME/.yarn/bin:$PATH"
2+
node_js: node
3+
cache: yarn
4+
jobs:
5+
include:
6+
- stage: Test
7+
script: yarn test:ci && yarn build

.vscode/extensions.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"esbenp.prettier-vscode",
7+
"wayou.vscode-todo-highlight",
8+
"wix.vscode-import-cost",
9+
"pflannery.vscode-versionlens",
10+
"heybourn.headwind",
11+
"bradlc.vscode-tailwindcss",
12+
"jpoissonnier.vscode-styled-components"
13+
]
14+
}

AnalyticsTesting.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,79 @@
22

33
We recommend that you use an [example](./example) or external app when developing and testing changes to this library.
44

5-
## Setup
5+
You can install all the dependencies in the root directory. Since the monorepo uses Lerna and Yarn Workspaces, npm CLI is not supported (only yarn).
66

7-
You can use linking to see new library changes as you're developing them.
7+
```sh
8+
yarn install
9+
```
10+
11+
This will install all dependencies in each project, build them, and symlink them via Lerna
12+
13+
## Development workflow
814

9-
In the library repo root:
15+
In one terminal, run tsdx watch in parallel:
1016

11-
```shell
12-
$ yarn # fetches the dependencies
13-
$ yarn build # produces a built version of the package
14-
$ cd dist # move to the dist directory (now containing the built package)
15-
$ yarn link # link the package
16-
$ cd .. # go back to the repo root
17-
$ yarn build:watch # rebuild on changes
17+
```sh
18+
yarn start
1819
```
1920

20-
Now in an example dir:
21+
This builds each package to `<packages>/<package>/dist` and runs the project in watch mode so any edits you save inside `<packages>/<package>/src` cause a rebuild to `<packages>/<package>/dist`. The results will stream to to the terminal.
2122

22-
```shell
23-
$ yarn # fetch the dependencies
24-
$ yarn link sajari-react # use the version of sajari-react in the repo
25-
$ yarn start # build/start your app...
23+
### Using the example/playground
24+
25+
You can play with local packages in the Parcel-powered example/playground.
26+
27+
```sh
28+
cd example
29+
yarn install # or yarn install
30+
yarn start
2631
```
2732

33+
This will start the example/playground on `localhost:1234`. If you have lerna running watch in parallel mode in one terminal, and then you run parcel, your playground will hot reload when you make changes to any imported module whose source is inside of `packages/*/src/*`. Note that to accomplish this, each package's `start` command passes TDSX the `--noClean` flag. This prevents Parcel from exploding between rebuilds because of File Not Found errors.
34+
35+
Important Safety Tip: When adding/altering packages in the playground, use `alias` object in package.json. This will tell Parcel to resolve them to the filesystem instead of trying to install the package from NPM. It also fixes duplicate React errors you may run into.
36+
37+
#### Yalc
38+
39+
[Yalc](https://github.com/whitecolor/yalc) is an alternative to `yarn/npm link` (and Parcel aliasing) that many developers find useful because it more closely mimics how NPM works. It works kind of like a local package registry via filesystem and symlinking magic.
40+
41+
To do this, install yalc globally.
42+
43+
Using NPM:
44+
45+
```sh
46+
npm i yalc -g
47+
```
48+
49+
Using Yarn:
50+
51+
```sh
52+
yarn global add yalc
53+
```
54+
55+
Then in each package's `start` command add a [`yalc publish`](https://github.com/whitecolor/yalc#publish) or `yalc push` as an TSDX `--onSuccess` hook.
56+
57+
```diff
58+
"scripts": {
59+
- "start": "tsdx watch --verbose --noClean",
60+
+ "start": "tsdx watch --verbose --noClean --onSuccess yalc publish",
61+
"build": "tsdx build --tsconfig tsconfig.build.json",
62+
"test": "tsdx test",
63+
"lint": "tsdx lint",
64+
"prepublish": "npm run build"
65+
},
66+
```
67+
68+
In your example directory, now add each package via yalc
69+
70+
```sh
71+
yalc add <package>
72+
# or
73+
yalc link <package>
74+
```
75+
76+
There's definitely room for improvement with this workflow, so please contribute if you come up with something better.
77+
2878
## Release
2979

30-
1. Update [package.json](package.json) with the new version number
31-
1. Create a release commit with a message of the form `pkg: release <version>` and push to GitHub
32-
1. Create a tag with the new version number and push to GitHub
33-
1. Run `npm publish . --tag latest --access public`
80+
1. Run `yarn release` which will trigger lerna to bump the appropriate package versions and build changelogs based on commits.

0 commit comments

Comments
 (0)