Archived
1
0

Delete all the things

This commit is contained in:
Asher
2019-07-02 14:29:41 -05:00
parent f25a614333
commit 310bfe509e
242 changed files with 0 additions and 31959 deletions

View File

@ -1 +0,0 @@
// This is for ignoring CSS and images when running tests with Jest.

View File

@ -1,51 +0,0 @@
import { exec, execSync } from "child_process";
import { existsSync, readdirSync } from "fs";
import * as os from "os";
import { join, resolve } from "path";
import { logger, field } from "../packages/logger/src/logger";
/**
* Install dependencies for a single package.
*/
const doInstall = (pkg: string, path: string): Promise<void> => {
logger.info(`Installing "${pkg}" dependencies...`);
return new Promise((resolve): void => {
exec("yarn --network-concurrency 1", {
cwd: path,
maxBuffer: 1024 * 1024 * 10,
}, (error, stdout, stderr) => {
if (error) {
logger.error(
`Failed to install "${pkg}" dependencies`,
field("error", error),
field("stdout", stdout),
field("stderr", stderr),
);
process.exit(1);
}
logger.info(`Successfully grabbed \"${pkg}\" dependencies!`);
resolve();
});
});
};
/**
* Install dependencies for all packages.
*/
const handlePackages = async (dir: string): Promise<void> => {
const dirs = readdirSync(dir);
for (let i = 0; i < dirs.length; i++) {
const pkg = dirs[i];
const pkgDir = join(dir, pkg);
const pkgJsonPath = join(pkgDir, "package.json");
if (existsSync(pkgJsonPath)) {
const ip = await doInstall(pkg, pkgDir);
}
}
};
handlePackages(resolve(__dirname, "..", "packages")).then(() => {
return handlePackages(resolve(__dirname, "..", "packages", "app"));
});

View File

@ -1,35 +0,0 @@
const fs = require("fs");
const util = require("util");
// This isn't properly promisified in Jest.
Object.defineProperty(fs.read, util.promisify.custom, {
configurable: true,
value: (...args) => {
return new Promise((resolve, reject) => {
args.push((error, bytesRead, buffer) => {
if (error) {
reject(error);
} else {
resolve({ bytesRead, buffer });
}
});
fs.read(...args);
});
},
});
global.requestAnimationFrame = (cb) => {
setTimeout(cb, 0);
};
// lchmod might not be available. Jest runs graceful-fs which makes this a no-op
// when it doesn't exist but that doesn't seem to always run when running
// multiple tests (or maybe it gets undone after a test).
if (!fs.lchmod) {
fs.lchmod = function (path, mode, cb) {
if (cb) {
process.nextTick(cb);
}
};
fs.lchmodSync = function () {};
}

View File

@ -1,90 +0,0 @@
const webpack = require("webpack");
const path = require("path");
const merge = require("webpack-merge");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const PreloadWebpackPlugin = require("preload-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const WebpackPwaManifest = require("webpack-pwa-manifest");
const { GenerateSW } = require("workbox-webpack-plugin");
const root = path.join(__dirname, "..");
const prod = process.env.NODE_ENV === "production" || process.env.CI === "true";
const cachePattern = /\.(?:png|jpg|jpeg|svg|css|js|ttf|woff|eot|woff2|wasm)$/;
module.exports = (options = {}) => merge(
require("./webpack.general.config")(options), {
devtool: prod ? "none" : "cheap-module-eval-source-map",
mode: prod ? "production" : "development",
entry: prod ? options.entry : [
"webpack-hot-middleware/client?reload=true&quiet=true",
options.entry,
],
module: {
rules: [{
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: /\.(png|ttf|woff|eot|woff2)$/,
use: [{
loader: "file-loader",
options: {
name: "[path][name].[ext]",
},
}],
}, {
test: /\.svg$/,
loader: 'url-loader'
}],
},
plugins: [
new MiniCssExtractPlugin({
chunkFilename: `${options.name || "client"}.[name].[hash:6].css`,
filename: `${options.name || "client"}.[name].[hash:6].css`
}),
new HtmlWebpackPlugin({
template: options.template
}),
new PreloadWebpackPlugin({
rel: "preload",
as: "script"
}),
new WebpackPwaManifest({
name: "Coder",
short_name: "Coder",
description: "Run VS Code on a remote server",
background_color: "#e5e5e5",
crossorigin: "use-credentials",
icons: [{
src: path.join(root, "packages/web/assets/logo.png"),
sizes: [96, 128, 192, 256, 384],
}],
})
].concat(prod ? [
new GenerateSW({
importWorkboxFrom: "local",
include: [cachePattern],
runtimeCaching: [{
urlPattern: cachePattern,
handler: "StaleWhileRevalidate",
options: {
cacheName: "code-server",
expiration: {
maxAgeSeconds: 86400,
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
]}),
] : [new webpack.HotModuleReplacementPlugin()]),
target: "web"
});

View File

@ -1,109 +0,0 @@
const path = require("path");
const os = require("os");
const environment = process.env.NODE_ENV || "development";
const HappyPack = require("happypack");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
const root = path.join(__dirname, "..");
module.exports = (options = {}) => ({
context: root,
devtool: "none",
externals: {
fsevents: "fsevents",
},
output: {
path: path.join(options.dirname || __dirname, "out"),
chunkFilename: `${options.name || "general"}.[name].[hash:6].js`,
filename: `${options.name || "general"}.[name].[hash:6].js`
},
module: {
rules: [{
loader: "string-replace-loader",
test: /\.(j|t)s/,
options: {
multiple: [{
// These will be handled by file-loader. Must be a fully formed URI.
// The !! prefix causes it to ignore other loaders.
search: "require\\.toUrl\\(",
replace: `${
options.node
? "'file://'"
: "location.protocol + '//' + location.host + location.pathname.replace(/\\/$/,'')"
} + '/' + require('!!file-loader?name=[path][name].[ext]!' + `,
flags: "g",
}, {
search: "require\\.__\\$__nodeRequire",
replace: "require",
flags: "g",
}, {
search: "\\.attributes\\[([^\\]]+)\\] = ([^;]+)",
replace: ".setAttribute($1, $2)",
flags: "g",
}],
},
}, {
test: /\.node$/,
use: "node-loader",
}, {
use: [{
loader: "happypack/loader?id=ts",
}],
test: /(^.?|\.[^d]|[^.]d|[^.][^d])\.tsx?$/,
}, {
test: /\.wasm$/,
type: "javascript/auto",
}],
},
resolve: {
alias: {
"@coder": path.join(root, "packages"),
},
extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".css"],
mainFiles: [
"index",
"src/index",
],
},
resolveLoader: {
modules: [
path.join(root, "node_modules"),
],
},
plugins: [
new HappyPack({
id: "ts",
threads: Math.max(os.cpus().length - 1, 1),
loaders: [{
path: "cache-loader",
query: {
cacheDirectory: path.join(__dirname, "..", ".cache"),
},
}, {
path: "ts-loader",
query: {
happyPackMode: true,
compilerOptions: options.typescriptCompilerOptions,
},
}],
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": `"${environment}"`,
"process.env.VERSION": `"${process.env.VERSION || ""}"`,
}),
],
optimization: {
minimizer: [
new TerserPlugin({
cache: path.join(__dirname, "..", ".cache", "terser"),
parallel: true,
}),
],
},
stats: {
all: false, // Fallback for options not defined.
errors: true,
warnings: true,
},
});

View File

@ -1,15 +0,0 @@
const merge = require("webpack-merge");
module.exports = (options = {}) => merge(
require("./webpack.general.config")({
...options,
node: true,
}), {
devtool: "none",
mode: "production",
target: "node",
externals: {
spdlog: "commonjs spdlog",
"node-pty": "commonjs node-pty",
}
});