Merge pull request #584 from Hornwitser/build-rework

Build rework
This commit is contained in:
Hornwitser authored and GitHub committed 2024-02-11 22:14:35 +01:00
commit 97e615fc21
92 files changed
+355 -269

No files matched your search

+1 -1
View File
@@ -391,7 +391,7 @@ module.exports = {
"node/process-exit-as-throw": "error",
"node/shebang": ["error", {
"convertPath": {
"*.ts": ["^(.+)\\.ts$", "dist/$1.js"],
"*.ts": ["^(.+)\\.ts$", "dist/node/$1.js"],
},
}],
},
+1
View File
@@ -0,0 +1 @@
auto-install-peers=false
+3
View File
@@ -81,6 +81,9 @@ Note that to use `clusterioctl` you will have to create a control config first:
Once you've set up the cluster you can use `node packages/controller run` to run the controller and `node packages/host run` to run the host which connects to the controller.
When editing TypeScript files ran by Node.js you need to run `pnpm build` to compile the files to JavaScript before restarting the controller/host/ctl for changes take effect.
To have TypeScript watch for changes and rebuild immediadly you may run `pnpm watch` instead.
For web development on the controller there are also the following flags:
`--dev` - Recompile the `web_ui` package on the fly providing live reloading of it.
+1 -1
View File
@@ -78,7 +78,7 @@ import { BaseInstancePlugin } from "@clusterio/host";
Previously the info of a plugin would be loaded by requiring `./plugin_dir/info`, this has been changed to require `./plugin_dir` which in turn means that `info.js` is no longer the default entrypoint.
To solve this you can either add `"main": "info.js",` to package.json or rename `info.js` to `index.js` (the rest of this guide assumes the entrypoint was renamed to `index.js`).
The motivation behind this change was to allow TypeScript to output its build to a sub-folder of the plugin, if you're using TypeScript you'll likely have the entrypoint be located in `dist/index.js` instead.
The motivation behind this change was to allow TypeScript to output its build to a sub-folder of the plugin, if you're using TypeScript you'll likely have the entrypoint be located in `dist/node/index.js` instead.
The expected place where the declaration of a plugin is exported has also changed from `module.exports` to `module.exports.plugin`:
+2
View File
@@ -3,6 +3,7 @@
"private": true,
"scripts": {
"build": "tsc --build",
"watch": "tsc --build --watch",
"test": "pnpm run build && mocha --check-leaks -R spec --recursive test \"plugins/*/test/**\"",
"fast-test": "FAST_TEST=y pnpm test",
"cover": "nyc pnpm test",
@@ -27,6 +28,7 @@
"@clusterio/ctl": "workspace:*",
"@clusterio/host": "workspace:*",
"@clusterio/lib": "workspace:*",
"@swc/core": "^1.4.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.45.0",
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+3 -2
View File
@@ -4,13 +4,13 @@
"author": "Hornwitser",
"license": "MIT",
"version": "2.0.0-alpha.16",
"main": "dist/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"clusteriocontroller": "./dist/controller.js"
"clusteriocontroller": "./dist/node/controller.js"
},
"keywords": [
"factorio"
@@ -36,6 +36,7 @@
},
"devDependencies": {
"@clusterio/web_ui": "^2.0.0-alpha.16",
"@swc/core": "^1.4.0",
"@types/busboy": "^1.5.0",
"@types/compression": "^1.7.2",
"@types/express": "^4.17.17",
+4 -4
View File
@@ -274,7 +274,7 @@ export default class Controller {
Controller.addAppRoutes(this.app, this.pluginInfos);
if (!args.dev) {
let manifestPath = path.join(__dirname, "..", "web", "manifest.json");
let manifestPath = path.join(__dirname, "..", "..", "web", "manifest.json");
let manifest = await Controller.loadJsonObject(manifestPath);
if (!manifest["main.js"]) {
@@ -333,7 +333,7 @@ export default class Controller {
if (args.dev) {
// eslint-disable-next-line node/no-missing-require
webpackConfigs.push(require("../../webpack.config")({})); // Path outside of build
webpackConfigs.push(require("../../../webpack.config")({})); // Path outside of build
}
if (args.devPlugin) {
let devPlugins = new Map();
@@ -737,7 +737,7 @@ export default class Controller {
// Set folder to serve static content from (the website)
const staticOptions = { immutable: true, maxAge: 1000 * 86400 * 365 };
app.use("/static",
express.static(path.join(__dirname, "..", "..", "dist", "web", "static"), staticOptions)
express.static(path.join(__dirname, "..", "..", "web", "static"), staticOptions)
);
app.use("/static", express.static("static", staticOptions)); // Used for data export files
@@ -1226,7 +1226,7 @@ export default class Controller {
mainBundle = stats.toJson().assetsByChunkName["main"];
}
fs.readFile(path.join(__dirname, "..", "..", "web", "index.html"), "utf8").then((content) => {
fs.readFile(path.join(__dirname, "..", "..", "..", "web", "index.html"), "utf8").then((content) => {
res.type("text/html");
res.send(content
.replace(/__CLUSTER_NAME__/g, res.app.locals.controller.config.get("controller.name"))
+12
View File
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../lib/tsconfig.browser.json" },
{ "path": "../web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "package.json" ],
"compilerOptions": {
"rootDir": "..",
"outDir": "dist/browser",
}
}
+3 -6
View File
@@ -1,10 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["index.ts", "controller.ts", "package.json", "src/**/*.ts"],
"compilerOptions": {
"outDir": "dist",
},
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../lib/tsconfig.node.json" },
],
"include": ["index.ts", "controller.ts", "package.json", "src/**/*.ts"],
"compilerOptions": {
"outDir": "dist/node",
},
}
-12
View File
@@ -1,12 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../lib/tsconfig.web.json" },
{ "path": "../web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "package.json" ],
"compilerOptions": {
"rootDir": "..",
"outDir": "dist/web/build",
}
}
+2 -2
View File
@@ -4,13 +4,13 @@
"author": "Hornwitser",
"license": "MIT",
"version": "2.0.0-alpha.16",
"main": "dist/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"clusterioctl": "./dist/ctl.js"
"clusterioctl": "./dist/node/ctl.js"
},
"keywords": [
"factorio"
+2 -6
View File
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../lib" },
{ "path": "./tsconfig.node.json" },
],
"include": ["index.ts", "package.json", "ctl.ts", "src/**/*.ts"],
"compilerOptions": {
"outDir": "dist",
},
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../lib/tsconfig.node.json" },
],
"include": ["index.ts", "package.json", "ctl.ts", "src/**/*.ts"],
"compilerOptions": {
"outDir": "dist/node",
},
}
+2 -2
View File
@@ -4,13 +4,13 @@
"author": "Hornwitser",
"license": "MIT",
"version": "2.0.0-alpha.16",
"main": "dist/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"clusteriohost": "./dist/host.js"
"clusteriohost": "./dist/node/host.js"
},
"keywords": [
"factorio"
+1 -1
View File
@@ -800,7 +800,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
// Find stand alone modules to load
// XXX for now only the included clusterio module is loaded
let modulesDirectory = path.join(__dirname, "..", "..", "modules");
let modulesDirectory = path.join(__dirname, "..", "..", "..", "modules");
for (let entry of await fs.readdir(modulesDirectory, { withFileTypes: true })) {
if (entry.isDirectory()) {
if (modules.has(entry.name)) {
+2 -2
View File
@@ -5,7 +5,7 @@ import Jimp from "jimp";
import JSZip from "jszip";
import * as lib from "@clusterio/lib";
import * as libBuildMod from "@clusterio/lib/dist/build_mod";
import * as libBuildMod from "@clusterio/lib/dist/node/build_mod";
import type { FactorioServer } from "./server";
interface Prototype {
@@ -62,7 +62,7 @@ async function generateExportMod(server: FactorioServer) {
clean: false,
build: true,
pack: true,
sourceDir: path.join(__dirname, "..", "..", "lua", "export"),
sourceDir: path.join(__dirname, "..", "..", "..", "lua", "export"),
outputDir: server.writePath("mods"),
bumpPatch: false,
factorioVersion: server.version.replace(/\.\d+$/, ""),
+2 -6
View File
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../lib" },
{ "path": "./tsconfig.node.json" },
],
"include": ["index.ts", "host.ts", "package.json", "src/**/*.ts", "src/**/*.js"],
"compilerOptions": {
"outDir": "dist",
},
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../lib/tsconfig.node.json" },
],
"include": ["index.ts", "host.ts", "package.json", "src/**/*.ts", "src/**/*.js"],
"compilerOptions": {
"outDir": "dist/node",
},
}
+1 -1
View File
@@ -1 +1 @@
dist/web/build
dist/browser
+1 -1
View File
@@ -8,7 +8,7 @@
"prepare": "tsc --build && pnpm run compile_validator",
"compile_validator": "node scripts/compile_validator.js"
},
"main": "dist/index.js",
"main": "dist/node/index.js",
"browser": "browser.ts",
"keywords": [
"factorio"
+3 -3
View File
@@ -7,9 +7,9 @@ const standaloneCode = require("ajv/dist/standalone").default;
/* eslint-disable node/no-sync */
// Provide an empty file for message_core to load
fs.outputFileSync(path.join(__dirname, "../dist/src/data/message_validate.js"), "");
fs.outputFileSync(path.join(__dirname, "../dist/node/src/data/message_validate.js"), "");
const { Message } = require("../dist/src/data/messages_core");
const { Message } = require("../dist/node/src/data/messages_core");
const ajv = new Ajv({
allowUnionTypes: true,
@@ -28,5 +28,5 @@ function write(output) {
`// generated by scripts/compile_validator.js\n// @ts-nocheck\n/* eslint-disable */\n${moduleCode}`
);
}
write("../dist/src/data/message_validate.js");
write("../dist/node/src/data/message_validate.js");
write("../src/data/message_validate.js");
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.web.json",
"extends": "../../tsconfig.browser.json",
"include": [
"browser.ts",
"package.json",
@@ -25,6 +25,6 @@
],
"compilerOptions": {
"rootDir": ".",
"outDir": "dist/web/build",
"outDir": "dist/browser",
}
}
+5 -6
View File
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"include": ["index.ts", "browser.ts", "build_mod.js", "src/**/*.ts", "src/**/*.js"],
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
},
"files": [],
"references": [
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.node.json",
"include": ["index.ts", "browser.ts", "build_mod.js", "src/**/*.ts", "src/**/*.js"],
"compilerOptions": {
"outDir": "dist/node",
"allowJs": true,
},
}
+3 -5
View File
@@ -5,7 +5,7 @@
"license": "MIT",
"version": "2.0.0-alpha.16",
"browser": "src/index.ts",
"main": "dist/src/index.js",
"main": "dist/browser/src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
@@ -17,12 +17,10 @@
},
"dependencies": {
"@ant-design/icons": "^5.1.4",
"@babel/core": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@clusterio/lib": "^2.0.0-alpha.16",
"@swc/core": "^1.4.0",
"antd": "^5.13.0",
"assert": "^2.0.0",
"babel-loader": "^9.1.3",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"clean-webpack-plugin": "^4.0.0",
@@ -39,8 +37,8 @@
"react-router-dom": "^6.14.2",
"stream-browserify": "^3.0.0",
"style-loader": "^3.3.3",
"swc-loader": "^0.2.6",
"terser-webpack-plugin": "^5.3.9",
"ts-loader": "^9.4.4",
"typescript": "^5.1.6",
"util": "^0.12.5",
"webpack": "^5.88.2",
@@ -1,10 +1,10 @@
{
"extends": "../../tsconfig.web.json",
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../lib/tsconfig.web.json" },
{ "path": "../lib/tsconfig.browser.json" },
],
"include": [ "src/**/*.tsx", "src/**/*.ts", "package.json", "global.d.ts" ],
"compilerOptions": {
"outDir": "dist",
"outDir": "dist/browser",
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.browser.json" },
],
}
+30 -15
View File
@@ -65,32 +65,47 @@ module.exports = (env = {}) => ({
},
],
},
{
test: /\.js$/,
resolve: {
// XXX Required due to bug in babel-runtime
// see: https://github.com/babel/babel/issues/12058
fullySpecified: false,
},
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: require.resolve("ts-loader"),
loader: require.resolve("swc-loader"),
options: {
configFile: "tsconfig.web.json",
projectReferences: true,
sourceMaps: true,
jsc: {
parser: {
syntax: "typescript",
tsx: true,
},
target: "es2022",
transform: {
react: {
runtime: "automatic",
},
},
},
},
},
},
{
test: /\.jsx$/,
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: require.resolve("babel-loader"),
loader: require.resolve("swc-loader"),
options: {
presets: [require.resolve("@babel/preset-react")],
sourceMaps: true,
jsc: {
parser: {
syntax: "ecmascript",
jsx: true,
},
target: "es2022",
transform: {
react: {
runtime: "automatic",
},
},
},
},
},
},
@@ -123,10 +138,10 @@ module.exports = (env = {}) => ({
moduleIds: "deterministic",
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
terserOptions: {
compress: {
keep_classnames: true,
passes: 2,
},
mangle: {
keep_classnames: true,
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+2 -2
View File
@@ -6,8 +6,8 @@ export const plugin: lib.PluginDeclaration = {
name: "global_chat",
title: "Global Chat",
description: "Forwards chat between instances.",
instanceEntrypoint: "dist/plugin/instance",
ctlEntrypoint: "dist/plugin/control",
instanceEntrypoint: "dist/node/instance",
ctlEntrypoint: "dist/node/control",
messages: [
ChatEvent,
+1 -1
View File
@@ -6,7 +6,7 @@
"homepage": "https://github.com/clusterio/clusterio#readme",
"license": "MIT",
"repository": "clusterio/clusterio",
"main": "dist/plugin/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
+3 -3
View File
@@ -4,9 +4,9 @@ const lib = require("@clusterio/lib");
const mock = require("../../../test/mock");
const lines = require("../../../test/lib/factorio/lines");
const instance = require("../dist/plugin/instance");
const info = require("../dist/plugin/index").plugin;
const { ChatEvent } = require("../dist/plugin/messages");
const instance = require("../dist/node/instance");
const info = require("../dist/node/index").plugin;
const { ChatEvent } = require("../dist/node/messages");
describe("global_chat plugin", function() {
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../../packages/lib/tsconfig.browser.json" },
{ "path": "../../packages/web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/browser",
}
}
+3 -7
View File
@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../../packages/lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/plugin",
},
}
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../../packages/lib/tsconfig.node.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/node",
},
}
-11
View File
@@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../../packages/lib/tsconfig.web.json" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+2 -2
View File
@@ -22,7 +22,7 @@ export const plugin: lib.PluginDeclaration = {
title: "Inventory sync",
description: "Synchronizes players inventories between instances",
instanceEntrypoint: "dist/plugin/instance",
instanceEntrypoint: "dist/node/instance",
instanceConfigFields: {
"inventory_sync.rcon_chunk_size": {
title: "Rcon inventory chunk size",
@@ -33,7 +33,7 @@ export const plugin: lib.PluginDeclaration = {
},
},
controllerEntrypoint: "dist/plugin/controller",
controllerEntrypoint: "dist/node/controller",
controllerConfigFields: {
"inventory_sync.player_lock_timeout": {
title: "Player Lock Timeout",
+1 -1
View File
@@ -6,7 +6,7 @@
"homepage": "https://github.com/clusterio/factorioClusterio#readme",
"license": "MIT",
"repository": "clusterio/factorioClusterio",
"main": "dist/plugin/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../../packages/lib/tsconfig.browser.json" },
{ "path": "../../packages/web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/browser",
}
}
+3 -7
View File
@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../../packages/lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/plugin",
},
}
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../../packages/lib/tsconfig.node.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/node",
},
}
-11
View File
@@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../../packages/lib/tsconfig.web.json" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+2 -2
View File
@@ -15,8 +15,8 @@ export const plugin: lib.PluginDeclaration = {
name: "player_auth",
title: "Player Auth",
description: "Provides authentication to the cluster via logging into a Factorio server.",
controllerEntrypoint: "dist/plugin/controller",
instanceEntrypoint: "dist/plugin/instance",
controllerEntrypoint: "dist/node/controller",
instanceEntrypoint: "dist/node/instance",
webEntrypoint: "./web",
controllerConfigFields: {
"player_auth.code_length": {
+1 -1
View File
@@ -6,7 +6,7 @@
"homepage": "https://github.com/clusterio/clusterio#readme",
"license": "MIT",
"repository": "clusterio/clusterio",
"main": "dist/plugin/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
+4 -4
View File
@@ -5,10 +5,10 @@ const jwt = require("jsonwebtoken");
const mock = require("../../../test/mock");
const controller = require("../dist/plugin/controller");
const instance = require("../dist/plugin/instance");
const info = require("../dist/plugin/index").plugin;
const { FetchPlayerCodeRequest, SetVerifyCodeRequest } = require("../dist/plugin/messages");
const controller = require("../dist/node/controller");
const instance = require("../dist/node/instance");
const info = require("../dist/node/index").plugin;
const { FetchPlayerCodeRequest, SetVerifyCodeRequest } = require("../dist/node/messages");
const lib = require("@clusterio/lib");
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../../packages/lib/tsconfig.browser.json" },
{ "path": "../../packages/web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/browser",
}
}
+3 -7
View File
@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../../packages/lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/plugin",
},
}
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../../packages/lib/tsconfig.node.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/node",
},
}
-11
View File
@@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../../packages/lib/tsconfig.web.json" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+2 -2
View File
@@ -6,8 +6,8 @@ export const plugin: lib.PluginDeclaration = {
name: "research_sync",
title: "Research Sync",
description: "Synchronises technology research progress between instances.",
instanceEntrypoint: "dist/plugin/instance",
controllerEntrypoint: "dist/plugin/controller",
instanceEntrypoint: "dist/node/instance",
controllerEntrypoint: "dist/node/controller",
messages: [
messages.ContributionEvent,
+1 -1
View File
@@ -6,7 +6,7 @@
"homepage": "https://github.com/clusterio/clusterio#readme",
"license": "MIT",
"repository": "clusterio/clusterio",
"main": "dist/plugin/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
+2 -2
View File
@@ -2,5 +2,5 @@
// required here in order to track coverage for them.
"use strict";
require("../dist/plugin/instance");
require("../dist/plugin/controller");
require("../dist/node/instance");
require("../dist/node/controller");
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../../packages/lib/tsconfig.browser.json" },
{ "path": "../../packages/web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/browser",
}
}
+3 -7
View File
@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../../packages/lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/plugin",
},
}
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../../packages/lib/tsconfig.node.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/node",
},
}
-11
View File
@@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../../packages/lib/tsconfig.web.json" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+1 -1
View File
@@ -12,7 +12,7 @@ export const plugin: lib.PluginDeclaration = {
description:
"Provides in-game item/fluid production, builds, kills, and pollution "+
"statistics to the cluster's Prometheus endpoint.",
instanceEntrypoint: "dist/plugin/instance",
instanceEntrypoint: "dist/node/instance",
instanceConfigFields: {
"statistics_exporter.command_timeout": {
title: "Command Timeout",
+1 -1
View File
@@ -6,7 +6,7 @@
"homepage": "https://github.com/clusterio/clusterio#readme",
"license": "MIT",
"repository": "clusterio/clusterio",
"main": "dist/plugin/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
+2 -2
View File
@@ -2,8 +2,8 @@
const assert = require("assert").strict;
const mock = require("../../../test/mock");
const instance = require("../dist/plugin/instance");
const info = require("../dist/plugin/index").plugin;
const instance = require("../dist/node/instance");
const info = require("../dist/node/index").plugin;
describe("statistics_exporter plugin", function() {
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../../packages/lib/tsconfig.browser.json" },
{ "path": "../../packages/web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/browser",
}
}
+3 -7
View File
@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../../packages/lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/plugin",
},
}
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../../packages/lib/tsconfig.node.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/node",
},
}
@@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../../packages/lib/tsconfig.web.json" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
webpack.config.js
dist/web/build
dist/browser
+2 -2
View File
@@ -22,7 +22,7 @@ export const plugin: lib.PluginDeclaration = {
name: "subspace_storage",
title: "Subspace Storage",
description: "Provides shared storage across instances for the Subspace Storage mod",
instanceEntrypoint: "dist/plugin/instance",
instanceEntrypoint: "dist/node/instance",
instanceConfigFields: {
"subspace_storage.log_item_transfers": {
title: "Log Item Transfers",
@@ -32,7 +32,7 @@ export const plugin: lib.PluginDeclaration = {
},
},
controllerEntrypoint: "dist/plugin/controller",
controllerEntrypoint: "dist/node/controller",
controllerConfigFields: {
"subspace_storage.division_method": {
title: "Division Method",
+1 -1
View File
@@ -6,7 +6,7 @@
"homepage": "https://github.com/clusterio/clusterio#readme",
"license": "MIT",
"repository": "clusterio/clusterio",
"main": "dist/plugin/index.js",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
+4 -4
View File
@@ -2,7 +2,7 @@
// required here in order to track coverage for them.
"use strict";
require("../dist/plugin/instance");
require("../dist/plugin/controller");
require("../dist/plugin/dole");
require("../dist/plugin/dole_nn_base");
require("../dist/node/instance");
require("../dist/node/controller");
require("../dist/node/dole");
require("../dist/node/dole_nn_base");
+1 -1
View File
@@ -1,7 +1,7 @@
"use strict";
const assert = require("assert").strict;
const routes = require("../dist/plugin/routes");
const routes = require("../dist/node/routes");
const { get } = require("../../../test/integration");
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.browser.json",
"references": [
{ "path": "../../packages/lib/tsconfig.browser.json" },
{ "path": "../../packages/web_ui/tsconfig.browser.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/browser",
}
}
+3 -7
View File
@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.node.json",
"files": [],
"references": [
{ "path": "../../packages/lib" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.browser.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/plugin",
},
}
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.node.json",
"references": [
{ "path": "../../packages/lib/tsconfig.node.json" },
],
"include": ["./**/*.ts"],
"exclude": ["test/*", "./dist/*"],
"compilerOptions": {
"outDir": "dist/node",
},
}
@@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.web.json",
"references": [
{ "path": "../../packages/lib/tsconfig.web.json" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ const util = require("util");
const phin = require("phin");
const HttpCloser = require("@clusterio/controller/dist/src/HttpCloser").default;
const HttpCloser = require("@clusterio/controller/dist/node/src/HttpCloser").default;
// Time to wait during async operations to ensure they happened in order.
const tick = 20;
+1 -1
View File
@@ -7,7 +7,7 @@ const http = require("http");
const phin = require("phin");
const { wait } = require("@clusterio/lib");
const routes = require("@clusterio/controller/dist/src/routes");
const routes = require("@clusterio/controller/dist/node/src/routes");
const mock = require("../mock");
+2 -2
View File
@@ -3,8 +3,8 @@ const assert = require("assert").strict;
const path = require("path");
const lib = require("@clusterio/lib");
const Host = require("@clusterio/host/dist/src/Host").default;
const { _discoverInstances } = require("@clusterio/host/dist/src/Host");
const Host = require("@clusterio/host/dist/node/src/Host").default;
const { _discoverInstances } = require("@clusterio/host/dist/node/src/Host");
describe("Host testing", function() {
describe("discoverInstances()", function() {
+1 -1
View File
@@ -4,7 +4,7 @@ const path = require("path");
const lib = require("@clusterio/lib");
const { PlayerStats, wait } = lib;
const Instance = require("@clusterio/host/dist/src/Instance").default;
const Instance = require("@clusterio/host/dist/node/src/Instance").default;
const { MockConnector, MockServer } = require("../mock");
const addr = lib.Address.fromShorthand;
+2 -2
View File
@@ -2,8 +2,8 @@
const assert = require("assert").strict;
const path = require("path");
const { FactorioServer } = require("@clusterio/host/dist/src/server");
const { _exportLocale } = require("@clusterio/host/dist/src/export");
const { FactorioServer } = require("@clusterio/host/dist/node/src/server");
const { _exportLocale } = require("@clusterio/host/dist/node/src/export");
describe("host/src/export", function() {
+1 -1
View File
@@ -5,7 +5,7 @@ const JSZip = require("jszip");
const path = require("path");
const lib = require("@clusterio/lib");
const patch = require("@clusterio/host/dist/src/patch");
const patch = require("@clusterio/host/dist/node/src/patch");
describe("host/patch", function() {
+1 -1
View File
@@ -4,7 +4,7 @@ const events = require("events");
const fs = require("fs-extra");
const path = require("path");
const hostServer = require("@clusterio/host/dist/src/server");
const hostServer = require("@clusterio/host/dist/node/src/server");
const lib = require("@clusterio/lib");
const { wait } = lib;
const { testLines } = require("../lib/factorio/lines");
+2 -2
View File
@@ -2,8 +2,8 @@
const assert = require("assert").strict;
const path = require("path");
const { _exportLocale } = require("@clusterio/host/dist/src/export");
const { FactorioServer } = require("@clusterio/host/dist/src/server");
const { _exportLocale } = require("@clusterio/host/dist/node/src/export");
const { FactorioServer } = require("@clusterio/host/dist/node/src/server");
describe("Integration of lib/factorio/export", function() {
+5 -5
View File
@@ -12,11 +12,11 @@ const lib = require("@clusterio/lib");
const { LineSplitter, ConsoleTransport, logger } = lib;
// Make sure permissions from plugins are loaded
require("../../plugins/global_chat/dist/plugin/index");
require("../../plugins/player_auth/dist/plugin/index");
require("../../plugins/research_sync/dist/plugin/index");
require("../../plugins/statistics_exporter/dist/plugin/index");
require("../../plugins/subspace_storage/dist/plugin/index");
require("../../plugins/global_chat/dist/node/index");
require("../../plugins/player_auth/dist/node/index");
require("../../plugins/research_sync/dist/node/index");
require("../../plugins/statistics_exporter/dist/node/index");
require("../../plugins/subspace_storage/dist/node/index");
const subspaceStorageVersion = "1.99.8";
const subspaceStorageGitHubTag = "1.99.6"; // Tag subspaceStorageVersion was released under on GitHub
+1 -1
View File
@@ -4,7 +4,7 @@ const fs = require("fs-extra");
const JSZip = require("jszip");
const path = require("path");
const { patch, SaveModule } = require("@clusterio/host/dist/src/patch");
const { patch, SaveModule } = require("@clusterio/host/dist/node/src/patch");
const lib = require("@clusterio/lib");
const { slowTest } = require("./index");
+1 -1
View File
@@ -5,7 +5,7 @@ const fs = require("fs-extra");
const path = require("path");
const lib = require("@clusterio/lib");
const { FactorioServer, _getVersion } = require("@clusterio/host/dist/src/server");
const { FactorioServer, _getVersion } = require("@clusterio/host/dist/node/src/server");
const { logger } = lib;
const { slowTest } = require("./index");
+2 -2
View File
@@ -5,8 +5,8 @@ const express = require("express");
const lib = require("@clusterio/lib");
const UserManager = require("@clusterio/controller/dist/src/UserManager").default;
const ControllerUser = require("@clusterio/controller/dist/src/ControllerUser").default;
const UserManager = require("@clusterio/controller/dist/node/src/UserManager").default;
const ControllerUser = require("@clusterio/controller/dist/node/src/ControllerUser").default;
const addr = lib.Address.fromShorthand;
+1 -1
View File
@@ -5,7 +5,7 @@
"module": "es2022",
"moduleResolution": "bundler",
"target": "es2022",
"jsx": "react",
"jsx": "react-jsx",
"noEmitOnError": true,
},
}
+11 -19
View File
@@ -1,24 +1,16 @@
{
"files": [],
"references": [
{ "path": "./packages/lib" },
{ "path": "./packages/lib/tsconfig.web.json" },
{ "path": "./packages/controller" },
{ "path": "./packages/controller/tsconfig.web.json" },
{ "path": "./packages/host" },
{ "path": "./packages/ctl" },
{ "path": "./packages/web_ui/tsconfig.web.json" },
{ "path": "./plugins/global_chat" },
{ "path": "./plugins/global_chat/tsconfig.web.json" },
{ "path": "./plugins/inventory_sync" },
{ "path": "./plugins/inventory_sync/tsconfig.web.json" },
{ "path": "./plugins/player_auth" },
{ "path": "./plugins/player_auth/tsconfig.web.json" },
{ "path": "./plugins/research_sync" },
{ "path": "./plugins/research_sync/tsconfig.web.json" },
{ "path": "./plugins/statistics_exporter" },
{ "path": "./plugins/statistics_exporter/tsconfig.web.json" },
{ "path": "./plugins/subspace_storage" },
{ "path": "./plugins/subspace_storage/tsconfig.web.json" },
{ "path": "./packages/lib/" },
{ "path": "./packages/controller/" },
{ "path": "./packages/host/" },
{ "path": "./packages/ctl/" },
{ "path": "./packages/web_ui/" },
{ "path": "./plugins/global_chat/" },
{ "path": "./plugins/inventory_sync/" },
{ "path": "./plugins/player_auth/" },
{ "path": "./plugins/research_sync/" },
{ "path": "./plugins/statistics_exporter/" },
{ "path": "./plugins/subspace_storage/" },
],
}