Create initial server layout (#11)

* Create initial server layout

* Adjust command name to entry

* Add @oclif/config as dependency

* Implement build process for outputting single binary

* Add init message

* Remove unused import, add tsconfig.json to .gitignore

* Accidently pushed wacky change to output host FS files

* Add options to createApp
This commit is contained in:
Kyle Carberry
2019-01-15 12:36:09 -06:00
parent 2ff34bc5e2
commit 05899b5edf
25 changed files with 4646 additions and 222 deletions

View File

@@ -1,71 +1,22 @@
const path = require("path");
const environment = process.env.NODE_ENV || "development";
const isCi = typeof process.env.CI !== "undefined";
const minify = isCi;
const compatibility = isCi;
const HappyPack = require("happypack");
const webpack = require("webpack");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const WriteFilePlugin = require("write-file-webpack-plugin");
const PreloadWebpackPlugin = require("preload-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const root = __dirname;
const fills = path.join(root, "packages", "ide", "src", "fill");
const vscodeFills = path.join(root, "packages", "vscode", "src", "fill");
module.exports = {
context: root,
const merge = require("webpack-merge");
module.exports = merge({
devtool: "eval",
entry: "./packages/web/src/index.ts",
mode: isCi ? "production" : "development",
output: {
chunkFilename: "[name]-[hash:6].bundle.js",
path: path.join(root, "dist"),
filename: "[hash:6].bundle.js",
},
module: {
rules: [{
test: /\.(js)/,
exclude: /test/,
}, {
test: /\.(node|txt|d\.ts|test.ts|perf.data.js|jxs)/,
use: [{
loader: "ignore-loader",
}],
}, {
use: [{
loader: "happypack/loader?id=ts",
}],
test: /(^.?|\.[^d]|[^.]d|[^.][^d])\.tsx?$/,
}, {
exclude: /test/,
test: /\.s?css$/,
// This is required otherwise it'll fail to resolve CSS in common.
include: root,
use: [{
loader: MiniCssExtractPlugin.loader,
}, {
loader: "css-loader",
}, {
loader: "sass-loader",
}],
}, {
test: /\.(svg|png|ttf|woff|eot)$/,
use: [{
loader: "file-loader",
}],
}, {
test: /\.wasm$/,
type: "javascript/auto",
}],
noParse: /\.test\.(j|t)sx?/,
},
resolve: {
alias: {
"native-keymap": path.join(vscodeFills, "native-keymap.ts"),
@@ -91,76 +42,25 @@ module.exports = {
"electron": path.join(fills, "electron.ts"),
"@coder": path.join(root, "packages"),
"vs": path.join(root, "lib", "vscode", "src", "vs"),
},
extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".css"],
mainFiles: [
"index",
"src/index",
],
},
resolveLoader: {
alias: {
"vs/css": path.join(vscodeFills, "css.js"),
},
modules: [
path.join(root, "node_modules"),
],
},
devServer: {
hot: true,
port: 3000,
disableHostCheck: true,
stats: {
all: false, // Fallback for options not defined.
errors: true,
warnings: true,
},
},
plugins: [
new HtmlWebpackPlugin({
template: "packages/web/src/index.html",
}),
new HappyPack({
id: "ts",
threads: 2,
loaders: [{
path: "ts-loader",
query: {
happyPackMode: true,
},
}],
}),
// new BundleAnalyzerPlugin(),
new WriteFilePlugin({
exitOnErrors: false,
}),
new PreloadWebpackPlugin({
rel: "preload",
as: "script",
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": `"${environment}"`,
new WriteFilePlugin({
exitOnErrors: false,
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css",
}),
// minify ? new UglifyJsPlugin({
// cache: true,
// parallel: true,
// sourceMap: false,
// }) : undefined,
// new ForkTsCheckerWebpackPlugin({
// checkSyntacticErrors: true,
// tsconfig: path.join(root, "./src/tsconfig.json"),
// }),
],
target: "web",
stats: {
all: false, // Fallback for options not defined.
errors: true,
warnings: true,
},
};
}, require("./scripts/webpack.general.config.js"));