Merge pull request #373 from Hornwitser/alpha-5

Alpha 5 preparations
This commit is contained in:
Hornwitser authored and GitHub committed 2021-03-23 21:18:11 +01:00
commit 166416339a
4 files changed
+60 -6

No files matched your search

+35
View File
@@ -22,6 +22,7 @@ Though we have some conventions and workflows that we kindly ask you to follow.
- [Indenting](#indenting)
- [Line Length](#line-length)
- [Markdown](#markdown)
- [Pushing releases to npm](#pushing-releases-to-npm)
## Workflow
@@ -235,3 +236,37 @@ And there's two spaces before the next heading.
Headings use the `# heading` format.
```
## Pushing releases to npm
The releases are done by creating a new release tag with lerna and then uploading that with lerna.
You will need commit access to the repository as well publish access to the @clusterio org on npm to do this.
1. To do a release switch to the master branch and make sure it's up to date with the repository before proceeding.
```sh
git switch master
git pull --ff-only upstream master
```
Check and make sure there are no untracked files with `git status`, otherwise they will be auto commited!
2. Run a lerna version to create and tag a new version.
This will push a commit to the master branch.
```sh
npx lerna version prerelease --git-remote upstream --no-granular-pathspec
```
3. Run a full build in every package to update the dist/ files.
```sh
npx lerna run build
```
4. Publish the packages with lerna.
```sh
npx lerna publish from-package
```
+11
View File
@@ -16,6 +16,16 @@ class CommandError extends Error { }
*/
class RequestError extends Error { }
/**
* Thrown when a permission check fails.
*
* Is a subclass of RequestError to prevent logging stack traces when
* requests fail due to permission denied.
*
* @static
*/
class PermissionError extends RequestError { }
/**
* Signal for messages that fail validation
* @static
@@ -66,6 +76,7 @@ class PluginError extends Error {
module.exports = {
CommandError,
RequestError,
PermissionError,
InvalidMessage,
SessionLost,
AuthenticationFailed,
+8 -4
View File
@@ -543,14 +543,18 @@ class FactorioServer extends events.EventEmitter {
this._gameReady = false;
if (options.stripPaths) {
let chars = new Set(this.writePath("temp"));
let chars = new Set(path.resolve(this.writePath("temp")));
chars.delete(":"); // Having a colon could lead to matching the line number
chars = [...chars].join("");
let tempPath = `${path.resolve(this.writePath("temp", "currently-playing"))}${path.sep}`;
let writePath = `${path.resolve(this.writePath())}${path.sep}`;
this._stripRegExp = new RegExp(
`(${escapeRegExp(this.writePath("temp", "currently-playing", path.sep))})|` +
`(${escapeRegExp(this.writePath(path.sep))})|` +
`(\\.\\.\\.[${escapeRegExp(chars)}]*?currently-playing\\${path.sep})`,
// The script printer formats paths using / on both windows and linux.
// But the save path is printed with \ on windows and / on linux.
`(${escapeRegExp(tempPath.replace(/\\/g, "/"))})|` +
`(${escapeRegExp(writePath)})|` +
`(\\.\\.\\.[${escapeRegExp(chars)}/]*?currently-playing/)`,
"g"
);
}
+6 -2
View File
@@ -9,6 +9,9 @@
"use strict";
const jwt = require("jsonwebtoken");
const libErrors = require("./errors");
/**
* Represents a permission that can be granted
* @static
@@ -254,7 +257,8 @@ class User {
* "Permission denied" error is thrown.
*
* @param {string} permission - The permission to check for.
* @throws {Error} if the user does noh have the given permission.
* @throws {Error} If the given permission does not exist.
* @throws {module:lib/errors.PermissionError} if the user does noh have the given permission.
*/
checkPermission(permission) {
if (!permissions.has(permission)) {
@@ -267,7 +271,7 @@ class User {
}
}
throw new Error("Permission denied");
throw new libErrors.PermissionError("Permission denied");
}
notifyJoin(instance_id) {