Skip to content

Commit

Permalink
feat: Monorepo turbo part 1 (pancakeswap#3360)
Browse files Browse the repository at this point in the history
### What changes
Only add uikit and eslint into packages. 
Use tsconfig path to map uikit, consume it by src.
FE code as workspace root now. Can be changed follow by pancakeswap#3359 later

### Note
Turbo doesn't do anything at this moment.
Keep Lerna only use for packages version and changelog
  • Loading branch information
0xjojoex authored Mar 1, 2022
1 parent 54866ae commit a5d2bdc
Show file tree
Hide file tree
Showing 516 changed files with 35,115 additions and 348 deletions.
8 changes: 1 addition & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{
"settings": {
"import/resolver": {
"node": {
"paths": ["./src"]
}
}
},
"env": {
"es6": true,
"browser": true,
Expand All @@ -14,6 +7,7 @@
"plugins": ["lodash"],
"extends": ["@pancakeswap/eslint-config-pancake", "plugin:react/jsx-runtime", "plugin:@next/next/recommended"],
"rules": {
"import/no-unresolved": 0,
"no-console": ["warn", { "allow": ["info", "warn", "error", "debug"] }],
"no-plusplus": 0,
"prefer-destructuring": ["warn", { "object": true, "array": false }],
Expand Down
15 changes: 10 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js

Expand All @@ -12,12 +12,14 @@ cypress/screenshots
cypress/fixtures/example.json

# next.js
/.next/
/out/
.next/
out/
.idea/

# production
/build
build
dist
storybook-static

# misc
.DS_Store
Expand All @@ -35,8 +37,11 @@ yarn-debug.log*
yarn-error.log*
debug.log*

src/config/abi/types
**/config/abi/types


# Sentry
.sentryclirc

# turbo
.turbo
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ const createJestConfig = nextJest({ dir: './' })

// Any custom config you want to pass to Jest
const customJestConfig = {
testPathIgnorePatterns: ['<rootDir>/cypress/', '<rootDir>/src/config/__tests__/'],
testPathIgnorePatterns: ['<rootDir>/cypress/', '<rootDir>/src/config/__tests__/', '<rootDir>/packages'],
moduleNameMapper: {
'^@pancakeswap/uikit': '<rootDir>/packages/uikit/src',
},
moduleDirectories: ['node_modules', 'src'],
testTimeout: 20000,
}
Expand Down
13 changes: 13 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"packages": ["packages/*"],
"version": "independent",
"npmClient": "yarn",
"workspaces": true,
"ignoreChanges": ["**/__tests__/**", "**/*.md", "**/.storybook/**"],
"command": {
"version": {
"conventionalCommits": true,
"message": "chore(release): Publish"
}
}
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "pancake-frontend",
"version": "0.1.0",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"analyze": "ANALYZE=true yarn build",
"dev": "next dev",
Expand Down Expand Up @@ -45,7 +48,6 @@
"@ethersproject/units": "^5.5.0",
"@next/bundle-analyzer": "^12.0.7",
"@pancakeswap/sdk": "^2.4.0",
"@pancakeswap/uikit": "^0.63.1",
"@reduxjs/toolkit": "^1.5.0",
"@sentry/nextjs": "^6.17.9",
"@snapshot-labs/snapshot.js": "^0.3.25",
Expand Down Expand Up @@ -91,7 +93,6 @@
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@next/eslint-plugin-next": "^12.0.10",
"@pancakeswap/eslint-config-pancake": "^1.1.0",
"@testing-library/react-hooks": "^7.0.2",
"@typechain/ethers-v5": "^8.0.5",
"@types/canvas-confetti": "^1.4.2",
Expand All @@ -114,11 +115,13 @@
"eslint-plugin-lodash": "^7.4.0",
"husky": "^7.0.0",
"jest": "^27.4.5",
"lerna": "^4.0.0",
"prettier": "^2.3.0",
"serve": "^12.0.0",
"source-map-explorer": "^2.5.2",
"start-server-and-test": "^1.14.0",
"ts-node": "^9.1.1",
"turbo": "^1.1.4",
"typechain": "^6.1.0"
}
}
4 changes: 4 additions & 0 deletions packages/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": true,
"printWidth": 120
}
33 changes: 33 additions & 0 deletions packages/eslint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.2.0](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/compare/@pancakeswap/[email protected]...@pancakeswap/[email protected]) (2021-07-09)


### Features

* Migrate ad-hoc FE rules to eslint-config ([#187](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/issues/187)) ([75baf17](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/commit/75baf175c8316fdfc549bc99e2bc38d65b18c5b6))





# 1.1.0 (2021-05-07)


### Features

* Add eslint package ([#7](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/issues/7)) ([0e0454e](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/commit/0e0454eb9a63e976934956dc5c66fbef2ce2017a))





## [1.0.1](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/compare/@pancakeswap-libs/[email protected]...@pancakeswap-libs/[email protected]) (2021-03-19)


### Features

* Add eslint package ([#7](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/issues/7)) ([0e0454e](https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake/commit/0e0454eb9a63e976934956dc5c66fbef2ce2017a))
15 changes: 15 additions & 0 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# eslint-config-pancake

Pancake Eslint config with:

- Airbnb config
- Typescript
- Prettier

## Usage

```
npx install-peerdeps --dev @pancakeswap/eslint-config-pancake
```

Add `"extends": "@pancakeswap/eslint-config-pancake"` to your eslint config file.
58 changes: 58 additions & 0 deletions packages/eslint-config/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2017,
ecmaFeatures: {
jsx: true,
},
},
env: {
es6: true,
browser: true,
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".ts", ".jsx", ".tsx"],
},
},
"import/extensions": [".js", ".ts", ".jsx", ".tsx"],
},
extends: [
"airbnb",
"airbnb/hooks",
"prettier",
"prettier/react",
"prettier/@typescript-eslint",
"plugin:@typescript-eslint/recommended",
],
rules: {
// Typescript
"@typescript-eslint/no-unused-vars": "warn",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["warn"],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
"no-plusplus": 0,
"prefer-destructuring": ["warn", { object: true, array: false }],
"no-underscore-dangle": 0,
// React
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
"react/prop-types": 0,
"react/jsx-props-no-spreading": 0,
"react/no-multi-comp": 0,
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
mjs: "never",
jsx: "never",
ts: "never",
tsx: "never",
},
],
},
};
30 changes: 30 additions & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@pancakeswap/eslint-config-pancake",
"version": "1.2.0",
"description": "Eslint config for PancakeSwap",
"main": "lib/index.js",
"files": [
"lib"
],
"repository": "https://github.com/pancakeswap/pancake-toolkit/tree/master/packages/eslint-config-pancake",
"license": "MIT",
"author": "RabbitDoge",
"private": false,
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.0.0"
},
"peerDependencies": {
"eslint": "^7.2.0",
"prettier": "^2.1.2"
},
"publishConfig": {
"access": "public"
}
}
14 changes: 14 additions & 0 deletions packages/uikit/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
{
name: "@storybook/addon-essentials",
options: {
backgrounds: false,
},
},
"@storybook/addon-links",
"@storybook/addon-a11y",
"themeprovider-storybook/register",
],
};
1 change: 1 addition & 0 deletions packages/uikit/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link href="https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;600&display=swap" rel="stylesheet">
33 changes: 33 additions & 0 deletions packages/uikit/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { withThemesProvider } from "themeprovider-storybook";
import light from "../src/theme/light";
import dark from "../src/theme/dark";
import ResetCSS from "../src/ResetCSS";
import { ModalProvider } from "../src/widgets/Modal";

const globalDecorator = (StoryFn) => (
<ModalProvider>
<ResetCSS />
<StoryFn />
</ModalProvider>
);

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
layout: "fullscreen",
};

const themes = [
{
name: "Light",
backgroundColor: light.colors.background,
...light,
},
{
name: "Dark",
backgroundColor: dark.colors.background,
...dark,
},
];

export const decorators = [globalDecorator, withThemesProvider(themes)];
Loading

0 comments on commit a5d2bdc

Please sign in to comment.