Use yarn workspace

This commit is contained in:
Sung Won Cho 2019-11-23 13:11:07 +08:00
commit f3211625ab
20 changed files with 12863 additions and 34964 deletions

View file

@ -41,18 +41,14 @@
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*_test.ts"]}],
"lines-between-class-members": 0,
"react/jsx-fragments": 0,
"jsx-a11y/label-has-associated-control": 0
"jsx-a11y/label-has-associated-control": 0,
"no-empty": 0
},
"plugins": [
"react", "react-hooks", "import", "prettier", "@typescript-eslint"
],
"settings": {
"import/parser": "babel-eslint",
"import/resolve": {
"moduleDirectory": ["node_modules", "src"]
}
},
"globals": {
// web
"__DEVELOPMENT__": true,
"__PRODUCTION__": true,
"__DISABLE_SSR__": true,
@ -63,9 +59,15 @@
"__STRIPE_PUBLIC_KEY__": true,
"__ROOT_URL__": true,
"__CDN_URL__": true,
"__VERSION__": true,
"socket": true,
"webpackIsomorphicTools": true,
"StripeCheckout": true
"StripeCheckout": true,
// browser
"browser": true,
"chrome": true,
__WEB_URL__: true,
__API_ENDPOINT__: true,
__VERSION__: true
}
}

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
/vendor
/build
/node_modules
.vagrant
*.log

View file

@ -6,6 +6,7 @@ go:
env:
- NODE_VERSION=10.15.0
YARN_VERSION=1.19.1-1
before_install:
- sudo apt-get update
@ -14,12 +15,20 @@ before_install:
- sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
- sudo service postgresql restart 11
before_script:
# install yarn
- sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update -qq
- sudo apt-get install -y -qq yarn="$YARN_VERSION"
- nvm install "$NODE_VERSION"
- nvm use "$NODE_VERSION"
- node --version
- psql -c "CREATE DATABASE dnote_test;" -U postgres
cache:
yarn: true
install:
- make install

View file

@ -1,5 +1,5 @@
PACKR2 := $(shell command -v packr2 2> /dev/null)
NPM := $(shell command -v npm 2> /dev/null)
YARN := $(shell command -v yarn 2> /dev/null)
HUB := $(shell command -v hub 2> /dev/null)
currentDir = $(shell pwd)
@ -22,27 +22,23 @@ endif
.PHONY: install-go
install-js:
ifndef NPM
$(error npm is not installed)
ifndef YARN
$(error yarn is not installed)
endif
@echo "==> installing js dependencies"
ifeq ($(CI), true)
@(cd ${currentDir}/web && npm install --unsafe-perm=true)
@(cd ${currentDir}/browser && npm install --unsafe-perm=true)
@(cd ${currentDir}/jslib && npm install --unsafe-perm=true)
@(cd ${currentDir} && yarn --unsafe-perm=true)
else
@(cd ${currentDir}/web && npm install)
@(cd ${currentDir}/browser && npm install)
@(cd ${currentDir}/jslib && npm install)
@(cd ${currentDir} && yarn)
endif
.PHONY: install-js
lint:
@(cd ${currentDir}/web && npm run lint)
@(cd ${currentDir}/jslib && npm run lint)
@(cd ${currentDir}/browser && npm run lint)
@(cd ${currentDir}/web && yarn lint)
@(cd ${currentDir}/jslib && yarn lint)
@(cd ${currentDir}/browser && yarn lint)
.PHONY: lint
## test
@ -63,9 +59,9 @@ test-web:
@echo "==> running web test"
ifeq ($(WATCH), true)
@(cd ${currentDir}/web && npm run test:watch)
@(cd ${currentDir}/web && yarn test:watch)
else
@(cd ${currentDir}/web && npm run test)
@(cd ${currentDir}/web && yarn test)
endif
.PHONY: test-web
@ -73,9 +69,9 @@ test-jslib:
@echo "==> running jslib test"
ifeq ($(WATCH), true)
@(cd ${currentDir}/jslib && npm run test:watch)
@(cd ${currentDir}/jslib && yarn test:watch)
else
@(cd ${currentDir}/jslib && npm run test)
@(cd ${currentDir}/jslib && yarn test)
endif
.PHONY: test-jslib

View file

@ -1,63 +0,0 @@
{ "extends": ["eslint-config-airbnb", "prettier"],
"env": {
"browser": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"rules": {
"camelcase": 0,
"strict": 0,
"react/no-multi-comp": 0,
"import/default": 0,
"import/no-duplicates": 0,
"import/named": 0,
"import/namespace": 0,
"import/no-unresolved": 0,
"import/no-named-as-default": 2,
"import/prefer-default-export": 0,
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
"indent": [2, 2, {"SwitchCase": 1}],
"no-console": 0,
"no-alert": 0,
"arrow-body-style": 0,
"react/prop-types": 0,
"react/jsx-filename-extension": 0,
"react/prefer-stateless-function": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/tabindex-no-positive": 0,
"no-mixed-operators": 0,
"no-plusplus": 0,
"no-underscore-dangle": 0,
"prettier/prettier": "error",
"jsx-a11y/no-autofocus": 0,
"jsx-a11y/label-has-for": 0,
"prefer-destructuring": 0,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/jsx-wrap-multilines": ["error", {"declaration": false, "assignment": false}],
"react/jsx-one-expression-per-line": 0,
"@typescript-eslint/no-unused-vars": 1,
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*_test.ts"]}],
"lines-between-class-members": 0,
"react/jsx-fragments": 0,
"jsx-a11y/label-has-associated-control": 0,
"no-empty": 0
},
"plugins": [
"react", "react-hooks", "import", "prettier", "@typescript-eslint"
],
"settings": {
"import/parser": "babel-eslint",
"import/resolve": {
"moduleDirectory": ["node_modules", "src"]
}
},
"globals": {
"browser": true,
"chrome": true,
__WEB_URL__: true,
__API_ENDPOINT__: true,
__VERSION__: true
}
}

View file

@ -4,7 +4,7 @@ Use the following commands to set up, build, and release.
## Set up
* `npm install` to install dependencies.
* Run `npm install-js` from the monorepo root.
## Developing locally

View file

@ -8,7 +8,7 @@ All releases are tagged and pushed to [the GitHub repository](https://github.com
To reproduce the obfuscated code for Firefox, please follow the steps below.
1. Run `npm install` to install dependencies
1. From the monorepo project root, run `make install-js` to install dependencies
2. Run `./scripts/build_prod.sh` to build for Firefox and Chrome.
The obfuscated code will be under `/dist/firefox` and `/dist/chrome`.

11621
browser/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -30,19 +30,8 @@
"@babel/preset-env": "^7.7.4",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.3",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"babel-eslint": "^10.0.3",
"concurrently": "^5.0.0",
"del": "^5.0.0",
"eslint": "^6.7.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.2.0",
"gulp": "^4.0.0",
"gulp-if": "^3.0.0",
"gulp-imagemin": "^6.1.1",

View file

@ -4,11 +4,11 @@
set -eux
# clean
npm run clean
yarn clean
# chrome
npm run build:chrome
npm run package:chrome
yarn build:chrome
yarn package:chrome
# firefox
npm run build:firefox
npm run package:firefox
yarn build:firefox
yarn package:firefox

View file

@ -1,46 +0,0 @@
{ "extends": ["prettier"],
"env": {
"browser": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"camelcase": 0,
"strict": 0,
"import/default": 0,
"import/no-duplicates": 0,
"import/named": 0,
"import/namespace": 0,
"import/no-unresolved": 0,
"import/no-named-as-default": 2,
"import/prefer-default-export": 0,
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
"indent": [2, 2, {"SwitchCase": 1}],
"no-console": 0,
"no-alert": 0,
"arrow-body-style": 0,
"no-mixed-operators": 0,
"no-plusplus": 0,
"no-underscore-dangle": 0,
"prettier/prettier": "error",
"prefer-destructuring": 0,
"@typescript-eslint/no-unused-vars": 1,
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*_test.ts"]}],
"lines-between-class-members": 0,
},
"plugins": [
"import", "prettier", "@typescript-eslint"
],
"settings": {
"import/resolve": {
"moduleDirectory": ["node_modules", "src"]
}
},
"globals": {
}
}

5857
jslib/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -21,12 +21,6 @@
},
"devDependencies": {
"@types/jest": "^24.0.23",
"@typescript-eslint/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^2.8.0",
"eslint": "^6.7.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.1",
"jest": "^24.9.0",
"prettier": "^1.19.1",
"ts-jest": "^24.1.0",

1055
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

21
package.json Normal file
View file

@ -0,0 +1,21 @@
{
"private": true,
"workspaces": [
"jslib",
"web",
"browser"
],
"devDependencies": {
"eslint": "^6.7.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^2.8.0",
"babel-eslint": "^10.0.3"
}
}

View file

@ -56,9 +56,9 @@ agpl="/* Copyright (C) 2019 Monomax Software Pty Ltd
*/"
dir=$(dirname "${BASH_SOURCE[0]}")
pkgPath="$dir/pkg"
serverPath="$dir/pkg/server"
browserPath="$dir/browser"
pkgPath="$dir/../pkg"
serverPath="$dir/../pkg/server"
browserPath="$dir/../browser"
gplFiles=$(find "$pkgPath" "$browserPath" -type f \( -name "*.go" -o -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.scss" -o -name "*.css" \) ! -path "**/vendor/*" ! -path "**/node_modules/*" ! -path "$serverPath/*")

View file

@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -eux
YARN_VERSION=1.19.1-1
sudo apt-get update
sudo apt-get install -y htop git wget build-essential inotify-tools
@ -9,3 +11,8 @@ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-ke
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get -y update
sudo apt-get install -y google-chrome-stable
# Install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install -y yarn="$YARN_VERSION"

17313
web/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -22,21 +22,10 @@
"@types/jest": "^24.0.23",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.4",
"@typescript-eslint/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^2.8.0",
"autoprefixer": "^9.7.2",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"cssnano": "^4.1.10",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.3.0",
"fibers": "^4.0.2",
"file-loader": "^4.3.0",
"jest": "^24.9.0",

11736
yarn.lock Normal file

File diff suppressed because it is too large Load diff