Skip to content

Commit

Permalink
chore: remove business (#358)
Browse files Browse the repository at this point in the history
* chore: remove business

* ci: remove business

* chore: remove useless file
  • Loading branch information
orzyyyy committed Dec 11, 2019
1 parent bdbbb2a commit 3159c6d
Show file tree
Hide file tree
Showing 30 changed files with 11 additions and 5,908 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,6 @@ jobs:

needs: setup

site-business:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@master

- name: restore cache from package-lock.json
uses: actions/cache@v1
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v1
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: build
run: npm run build:business

needs: setup

case:
runs-on: ubuntu-latest

Expand Down
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/bin/index.js",
"env": { "BUILD_ENV": "toy" }
"program": "${workspaceFolder}/bin/index.js"
}
]
}
1 change: 0 additions & 1 deletion ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
autorestart: true,
watch: ['bin', 'dist'],
max_memory_restart: '512M',
env: { BUILD_ENV: 'toy' },
out_file: 'server/log/app-out.log',
error_file: 'server/log/app-error.log',
},
Expand Down
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
"scripts": {
"build": "rimraf dist && cross-env BUILD_ENV=netlify nino koei",
"build:analyse": "rimraf dist && cross-env BUILD_ENV=analyse nino koei",
"build:business": "rimraf dist && cross-env BUILD_ENV=business nino koei",
"build:gh-pages": "rimraf dist && cross-env BUILD_ENV=gh-pages nino koei",
"clean": "rimraf node_modules package-lock.json bin dist",
"codecov": "nino test --codecov",
"compile:server": "npm run pre:server && tsc -p server",
"d": "npm run compile:server -- --watch",
"deploy": "npm-run-all clean build:gh-pages pub",
"dev": "rimraf dist && cross-env BUILD_ENV=dev nino koei -w -d",
"dev:business": "rimraf dist && cross-env BUILD_ENV=business-dev nino koei -w -d",
"go": "pm2 start",
"lint": "nino eslint",
"lint-staged": "lint-staged",
Expand All @@ -39,11 +37,9 @@
"server": "npm-run-all compile:server run:server",
"sort": "npx sort-package-json",
"start": "npm-run-all --parallel server dev",
"start:business": "npm-run-all --parallel server dev:business",
"stop": "pm2 stop memo-server",
"test": "nino test",
"tsc": "tsc",
"update-sql": "node scripts/copy-resource && npm run restart"
"tsc": "tsc"
},
"pre-commit": [
"lint-staged"
Expand All @@ -56,9 +52,6 @@
]
},
"devDependencies": {
"@material-ui/core": "^4.6.0",
"@material-ui/icons": "^4.5.1",
"@material-ui/lab": "^4.0.0-alpha.30",
"@testing-library/react-hooks": "^3.2.1",
"@types/blueimp-md5": "^2.7.0",
"@types/enzyme": "^3.10.3",
Expand All @@ -69,7 +62,6 @@
"@types/koa-router": "^7.0.42",
"@types/koa-static": "^4.0.1",
"@types/marked": "^0.7.0",
"@types/mysql": "^2.15.7",
"@types/prettier": "^1.19.0",
"@types/puppeteer-core": "^2.0.0",
"@types/react": "^16.9.14",
Expand Down Expand Up @@ -98,7 +90,6 @@
"marked": "^0.7.0",
"mini-xmind": "^1.4.2",
"mockdate": "^2.0.5",
"mysql": "^2.17.1",
"nino-cli": "^1.3.6",
"node-fetch": "^2.6.0",
"npm-run-all": "^4.1.5",
Expand Down
43 changes: 0 additions & 43 deletions scripts/build-business-dev.js

This file was deleted.

33 changes: 0 additions & 33 deletions scripts/build-business.js

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ const getEntry = () => {
'markdown-editor': handleWithPrefix('src/router/MarkdownEditorDataController.tsx'),
'mapping-detail': handleWithPrefix('src/router/MappingDetailDataController.tsx'),
'mapping-editor': handleWithPrefix('src/router/MappingDetailDataController.tsx'),
'stock-shipment': handleWithPrefix('src/router/StockAndShipmentDataController.tsx'),
ninoninoni: handleWithPrefix('src'),
};
const result = {
netlify: common,
analyse: common,
'gh-pages': common,
dev: common,
business: { 'stock-shipment': handleWithPrefix('src/router/StockAndShipmentDataController.tsx') },
'business-dev': { 'stock-shipment': handleWithPrefix('src/router/StockAndShipmentDataController.tsx') },
};
return result[buildEnv];
};
Expand All @@ -38,17 +35,6 @@ const getHtmlPluginProps = customedHtmlWebpackProps => {
const commonHtmlWebpackProps = {
template: handleWithPrefix('src/index.html'),
};
const HtmlWebpackPropsForBusiness = new HtmlWebpackPlugin({
...commonHtmlWebpackProps,
...customedHtmlWebpackProps,
filename: 'stock-shipment/index.html',
chunks: ['stock-shipment'],
title: `${author}'s business`,
description: `${author}'s business`,
});
if (buildEnv === 'business' || buildEnv === 'business-dev') {
return [HtmlWebpackPropsForBusiness];
}

const mainPageProps = [
new HtmlWebpackPlugin({
Expand All @@ -60,10 +46,6 @@ const getHtmlPluginProps = customedHtmlWebpackProps => {
description: `${author}'s ${name}`,
}),
];
// Build `stock-shipment` only in dev and business
if (buildEnv === 'dev') {
mainPageProps.push(HtmlWebpackPropsForBusiness);
}
const detailPageProps = [];
const editorPageProps = [];

Expand Down
86 changes: 0 additions & 86 deletions server/controller/ToyController.ts

This file was deleted.

29 changes: 0 additions & 29 deletions server/controller/__tests__/ToyController.test.ts

This file was deleted.

9 changes: 6 additions & 3 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { createServer } from 'http';
import IO from 'socket.io';
import path from 'path';
import DecoratorRouter from './middleware/DecoratorRouter';
import CheckSqlTomlResource from './middleware/CheckSqlTomlResource';
import { info } from './utils/log';
import { getTargetResource } from './utils/resource';
const config = getTargetResource('server');

const app = new Koa();
const server = createServer(app.callback());
Expand All @@ -21,8 +23,9 @@ io.on('connection', socket => {
app.use(BodyParser());
app.use(DecoratorRouter(path.join(__dirname, 'controller')));
app.use(KoaStatic(joinWithRootPath('dist')));
app.use(CheckSqlTomlResource(path.join(__dirname, 'resource/sql')));

server.listen(9099);
const port = config.server.port;
server.listen(port);
info(`listen at ${port}.`);

export { server };
Loading

0 comments on commit 3159c6d

Please sign in to comment.