Skip to content

Commit

Permalink
Merge pull request #11 from elite-se/feature/optimize-build-process
Browse files Browse the repository at this point in the history
Feature/optimize build process
  • Loading branch information
DominikHorn authored Feb 27, 2020
2 parents 5892eba + 11fe2dd commit 37f5c2b
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 59 deletions.
9 changes: 0 additions & 9 deletions development.configuration.ts

This file was deleted.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"packages/*"
],
"scripts": {
"clean": "lerna run clean --stream && rm -rfv node_modules tsconfig.tsbuildinfo",
"clean": "lerna run clean --stream && rm -rfv tsconfig.tsbuildinfo",
"postinstall": "patch-package",
"lint": "eslint './packages/*/src/**/*.{ts,d.ts}' --max-warnings 0",
"lint:fix": "eslint './packages/*/src/**/*.{ts,d.ts}' --fix",
"build": "tsc -b && lerna run webpack:build --stream",
"build": "lerna run webpack:build --stream",
"frontend:start": "lerna run frontend:start --stream",
"frontend:watch": "lerna run frontend:watch --stream",
"watch": "tsc -b -w"
Expand All @@ -37,7 +37,6 @@
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-hot-loader": "^4.12.18",
"source-map-loader": "^0.2.4",
"style-loader": "^1.0.1",
"ts-loader": "^6.2.1",
"typescript": "^3.7.2",
Expand All @@ -47,4 +46,4 @@
},
"resolutions": {},
"dependencies": {}
}
}
3 changes: 1 addition & 2 deletions packages/configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"publishConfig": {
"access": "public"
},
"types": "dist/index.d.ts",
"main": "dist/index.js",
"main": "src/index.ts",
"scripts": {
"clean": "rm -rf dist/ node_modules/ tsconfig.tsbuildinfo"
},
Expand Down
1 change: 0 additions & 1 deletion packages/configuration/src/development.configuration.ts

This file was deleted.

9 changes: 9 additions & 0 deletions packages/configuration/src/development.configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Configuration } from 'elite-types';

const configuration: Configuration = {
featureMap: {
'under-construction-message': true,
},
};

export default configuration;
1 change: 0 additions & 1 deletion packages/configuration/src/production.configuration.ts

This file was deleted.

9 changes: 9 additions & 0 deletions packages/configuration/src/production.configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Configuration } from 'elite-types';

const configuration: Configuration = {
featureMap: {
'under-construction-message': false,
},
};

export default configuration;
3 changes: 1 addition & 2 deletions packages/feature-flags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"publishConfig": {
"access": "public"
},
"types": "dist/index.d.ts",
"main": "dist/index.js",
"main": "src/index.ts",
"scripts": {
"clean": "rm -rf dist/ node_modules/ tsconfig.tsbuildinfo"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ module.exports = {
entry: {
app: ['react-hot-loader/patch', './src/index.tsx'],
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: require.resolve('ts-loader'),
options: {
projectReferences: true,
},
},
exclude: /node_modules/,
},
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"access": "public"
},
"scripts": {
"frontend:watch": "webpack-dev-server --mode development --color --hot --progress",
"frontend:start": "webpack-dev-server --mode production --color --progress",
"webpack:build": "webpack --mode production",
"frontend:watch": "webpack-dev-server --mode development --color --hot --progress --config development.webpack.config.js",
"frontend:start": "webpack-dev-server --mode production --color --hot --progress --config development.webpack.config.js",
"webpack:build": "webpack --mode production --config production.webpack.config.js",
"clean": "rm -rf dist/ node_modules/ tsconfig.tsbuildinfo"
},
"devDependencies": {
Expand Down
72 changes: 72 additions & 0 deletions packages/frontend/production.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: {
app: ['./src/index.tsx'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: require.resolve('ts-loader'),
options: {
projectReferences: true,
},
},
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.html$/,
use: [
{
loader: 'html-loader',
options: { minimize: true },
},
],
},
{
test: /\.(png|svg|jpg|gif|pdf)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
],
},
resolve: {
modules: ['node_modules'],
extensions: ['.ts', '.tsx', '.js', '.jsx'],
symlinks: true,
},
output: {
publicPath: '/',
filename: 'frontend.bundle.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
inject: 'body',
}),
],
node: {
module: 'empty',
dgram: 'empty',
dns: 'mock',
fs: 'empty',
http2: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
};
9 changes: 3 additions & 6 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
"publishConfig": {
"access": "public"
},
"types": "dist/index.d.ts",
"main": "dist/index.js",
"main": "src/index.ts",
"scripts": {
"clean": "rm -rf dist/ node_modules/ tsconfig.tsbuildinfo"
},
"devDependencies": {
},
"dependencies": {
}
"devDependencies": {},
"dependencies": {}
}
9 changes: 0 additions & 9 deletions production.configuration.ts

This file was deleted.

17 changes: 5 additions & 12 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,15 @@
"moduleResolution": "node",
"strict": true,
"importHelpers": true,
"sourceMap": true,
"declarationMap": true,
"sourceMap": false,
"declarationMap": false,
"declaration": true,
"composite": true,
"allowSyntheticDefaultImports": true,
"jsx": "react",
"lib": [
"esnext",
"dom"
],
"lib": ["esnext", "dom"],
"resolveJsonModule": true,
"esModuleInterop": true
},
"exclude": [
"./node_modules",
"./packages/*/node_modules",
"./packages/*/dist"
]
}
"exclude": ["./node_modules", "./packages/*/node_modules", "./packages/*/dist"]
}
10 changes: 1 addition & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ async-limiter@~1.0.0:
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==

async@^2.5.0, async@^2.6.2:
async@^2.6.2:
version "2.6.3"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff"
integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==
Expand Down Expand Up @@ -7568,14 +7568,6 @@ source-list-map@^2.0.0:
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==

source-map-loader@^0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-0.2.4.tgz#c18b0dc6e23bf66f6792437557c569a11e072271"
integrity sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==
dependencies:
async "^2.5.0"
loader-utils "^1.1.0"

source-map-resolve@^0.5.0:
version "0.5.3"
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a"
Expand Down

0 comments on commit 37f5c2b

Please sign in to comment.