[rpc-client] use src->lib pattern, i guess i see why people do it.

This commit is contained in:
41666 2019-04-16 08:50:09 -05:00
parent c706f25214
commit e86f7ff68e
No known key found for this signature in database
GPG key ID: BC51D07640DC10AF
10 changed files with 45 additions and 29 deletions

View file

@ -1,3 +1,5 @@
.env .env
.git/ .git/
node_modules/ node_modules/
packages/*/lib/
packages/*/dist/

View file

@ -1,4 +1,4 @@
FROM node:11 AS builder FROM node:11.14 AS builder
WORKDIR /src WORKDIR /src
COPY . /src COPY . /src
# we double yarn here to strip off dev-only packages that are needed at build time. # we double yarn here to strip off dev-only packages that are needed at build time.
@ -6,7 +6,7 @@ RUN yarn --frozen-lockfile &&\
yarn build &&\ yarn build &&\
yarn --prod --frozen-lockfile yarn --prod --frozen-lockfile
FROM mhart/alpine-node:11 FROM node:11.14-alpine
ENV NODE_ENV production ENV NODE_ENV production
WORKDIR /dist WORKDIR /dist
COPY --from=builder /src /dist COPY --from=builder /src /dist

View file

@ -1,4 +1,4 @@
FROM node:11 AS builder FROM node:11.14 AS builder
WORKDIR /src WORKDIR /src
COPY . /src COPY . /src
# we double yarn here to strip off dev-only packages that are needed at build time. # we double yarn here to strip off dev-only packages that are needed at build time.
@ -6,9 +6,9 @@ RUN yarn workspace @roleypoly/bot --frozen-lockfile &&\
yarn workspace @roleypoly/bot build &&\ yarn workspace @roleypoly/bot build &&\
yarn workspace @roleypoly/bot --frozen-lockfile --prod yarn workspace @roleypoly/bot --frozen-lockfile --prod
FROM mhart/alpine-node:11 FROM node:11.14-alpine
ENV NODE_ENV production ENV NODE_ENV production
WORKDIR /dist WORKDIR /dist
COPY --from=builder /src/packages/roleypoly-bot /dist/packages/roleypoly-bot COPY --from=builder /src/packages /dist/packages/
COPY --from=builder /src/node_modules /dist/node_modules COPY --from=builder /src/node_modules /dist/node_modules
CMD node /src/packages/roleypoly-bot/lib/index.js CMD node /dist/packages/roleypoly-bot/lib/index.js

6
build.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '_')
docker build -t "katie/roleypoly:$GIT_BRANCH" .
docker build -f bot.Dockerfile -t "katie/roleypoly:$GIT_BRANCH-bot" .

View file

@ -50,7 +50,7 @@
"enzyme-to-json": "^3.3.5", "enzyme-to-json": "^3.3.5",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-flowtype": "^3.6.1", "eslint-plugin-flowtype": "^3.6.1",
"flow-bin": "^0.96.0", "flow-bin": "^0.97.0",
"flow-mono-cli": "^1.5.0", "flow-mono-cli": "^1.5.0",
"flow-typed": "^2.5.1", "flow-typed": "^2.5.1",
"husky": "^1.3.1", "husky": "^1.3.1",
@ -64,7 +64,7 @@
"react-test-renderer": "^16.8.6", "react-test-renderer": "^16.8.6",
"standard": "12.0.1", "standard": "12.0.1",
"styled-components": "^4.2.0", "styled-components": "^4.2.0",
"stylelint": "^10.0.0", "stylelint": "^10.0.1",
"stylelint-config-standard": "^18.3.0", "stylelint-config-standard": "^18.3.0",
"stylelint-config-styled-components": "^0.1.1", "stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.6.0" "stylelint-processor-styled-components": "^1.6.0"
@ -80,7 +80,8 @@
], ],
"ignore": [ "ignore": [
"flow-typed/*", "flow-typed/*",
"packages/*/lib/*" "packages/*/lib/*",
"packages/*/dist/*"
] ]
} }
} }

View file

@ -3,7 +3,7 @@
"name": "@roleypoly/bot", "name": "@roleypoly/bot",
"version": "2.0.0", "version": "2.0.0",
"scripts": { "scripts": {
"build": "babel --delete-dir-on-start -d lib './*.js*'", "build": "babel --delete-dir-on-start -d lib .",
"dev": "yarn build --watch" "dev": "yarn build --watch"
}, },
"dependencies": { "dependencies": {

View file

@ -1,9 +1,5 @@
{ {
"presets": [ ["@babel/preset-env", { "presets": [ "@babel/preset-env", "@babel/preset-flow" ],
"targets": {
"node": true
}
}], "@babel/preset-flow" ],
"plugins": [ "plugins": [
"@babel/plugin-syntax-dynamic-import", "@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-class-properties",

View file

@ -1 +0,0 @@
/*.js

View file

@ -3,11 +3,13 @@
"name": "@roleypoly/rpc-client", "name": "@roleypoly/rpc-client",
"version": "2.0.0", "version": "2.0.0",
"scripts": { "scripts": {
"build": "babel -d . src", "build": "babel -d ./lib ./src",
"dev": "yarn build --watch" "dev": "yarn build --watch",
"postinstall": "test -d lib || npm run build"
}, },
"types": "src/", "types": "src/",
"main": "index.js", "main": "lib/index.js",
"files": ["lib"],
"dependencies": { "dependencies": {
"async-retry": "^1.2.3", "async-retry": "^1.2.3",
"superagent": "^5.0.2" "superagent": "^5.0.2"

View file

@ -5266,10 +5266,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916"
integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==
flow-bin@^0.96.0: flow-bin@^0.97.0:
version "0.96.0" version "0.97.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.96.0.tgz#3b0379d97304dc1879ae6db627cd2d6819998661" resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.97.0.tgz#036ffcfc27503367a9d906ec9d843a0aa6f6bb83"
integrity sha512-OSxERs0EdhVxEVCst/HmlT/RcnXsQQIRqcfK9J9wC8/93JQj+xQz4RtlsmYe1PSRYaozuDLyPS5pIA81Zwzaww== integrity sha512-jXjD05gkatLuC4+e28frH1hZoRwr1iASP6oJr61Q64+kR4kmzaS+AdFBhYgoYS5kpoe4UzwDebWK8ETQFNh00w==
flow-mono-cli@^1.5.0: flow-mono-cli@^1.5.0:
version "1.5.0" version "1.5.0"
@ -5504,6 +5504,11 @@ get-stdin@^6.0.0:
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==
get-stdin@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6"
integrity sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==
get-stream@^3.0.0: get-stream@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
@ -10250,6 +10255,11 @@ resolve-from@^4.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
resolve-from@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
resolve-url@^0.2.1: resolve-url@^0.2.1:
version "0.2.1" version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
@ -11157,10 +11167,10 @@ stylelint-processor-styled-components@^1.6.0:
"@babel/traverse" "^7.0.0" "@babel/traverse" "^7.0.0"
postcss "^7.0.0" postcss "^7.0.0"
stylelint@^10.0.0: stylelint@^10.0.1:
version "10.0.0" version "10.0.1"
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-10.0.0.tgz#5e7ad496d1a66671c068df327429133e2baf3264" resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-10.0.1.tgz#f85cd9755e905d826023d67df62b32716fa6dfb4"
integrity sha512-0WeIef88OPPLwbIDpHiHx56YJEPRuTuxkDwcqpFW626nGzykBBxbPk4z4Hbqb/mYPJ9AcEDZoOcPD8t4TcckZw== integrity sha512-NbpD9BvQRmPe7QfaLB2OqhhDr5g6SAn43AAH2XLyqtQ9ZcioQECgadkIbormfhzxLhccAQWBZbVNiZz1oqEf8g==
dependencies: dependencies:
autoprefixer "^9.5.1" autoprefixer "^9.5.1"
balanced-match "^1.0.0" balanced-match "^1.0.0"
@ -11169,7 +11179,7 @@ stylelint@^10.0.0:
debug "^4.1.1" debug "^4.1.1"
execall "^1.0.0" execall "^1.0.0"
file-entry-cache "^5.0.1" file-entry-cache "^5.0.1"
get-stdin "^6.0.0" get-stdin "^7.0.0"
global-modules "^2.0.0" global-modules "^2.0.0"
globby "^9.2.0" globby "^9.2.0"
globjoin "^0.1.4" globjoin "^0.1.4"
@ -11200,7 +11210,7 @@ stylelint@^10.0.0:
postcss-selector-parser "^3.1.0" postcss-selector-parser "^3.1.0"
postcss-syntax "^0.36.2" postcss-syntax "^0.36.2"
postcss-value-parser "^3.3.1" postcss-value-parser "^3.3.1"
resolve-from "^4.0.0" resolve-from "^5.0.0"
signal-exit "^3.0.2" signal-exit "^3.0.2"
slash "^2.0.0" slash "^2.0.0"
specificity "^0.4.1" specificity "^0.4.1"