Skip to content

Commit 16fb5cf

Browse files
committed
release: v0.2.1
1 parent ed7f580 commit 16fb5cf

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

Diff for: README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,20 @@ Package the Legacy Script Engine plugin:
2626
npx lses pack
2727
```
2828

29-
Deploy the Legacy Script Engine plugin package to the local Levilamina server:
29+
Deploy the Legacy Script Engine plugin package to the local LeviLamina server:
3030

3131
```bash
3232
npx lses deploy <path>
3333
```
3434

3535
| Argument | Description | Type |
3636
| -------- | --------------------------------------------- | ------ |
37-
| `<path>` | Specific Levilamina server working directory. | String |
37+
| `<path>` | Specific LeviLamina server working directory. | String |
38+
39+
## ❗ Important
40+
41+
The `main` configuration entry file in package.json should be relative to the project's working directory, <font color="red">not the directory of the Legacy Script Engine plugin package.</font>
42+
43+
For example, in a TypeScript project where index.ts is defined as the entry point in source code and the TypeScript compiler is configured via tsconfig.json to emit to the build directory named dist, you should set the `main` field in package.json to `dist/index.js`.
44+
45+
This ensures that the `entry` field in the manifest.json generated by `npx lses manifest` can be correctly identified and located by LeviLamina.

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "legacy-script-engine-scaffold",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "A utility for assisting in the development of Legacy Script Engine plugins.",
55
"bugs": "https://github.com/leoweyr/LSEScaffold/issues",
66
"bin": {
@@ -13,7 +13,7 @@
1313
"clean": "tsc --build --clean",
1414
"compile": "tsc",
1515
"build": "npm run clean && npm run compile",
16-
"install": "npm run build && npm link",
16+
"local-deploy": "npm run build && npm link",
1717
"package": "npm run build && npm pack",
1818
"deploy": "npm run package && npm publish"
1919
},

Diff for: src/nodejs/NodeJsConfigurationMainError.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { CliLoggableError } from "../cli/CliLoggableError";
2+
3+
4+
export class NodeJsConfigurationMainError extends Error implements CliLoggableError {
5+
private static MESSAGE: string = "The `main` configuration in package.json is incorrect.";
6+
7+
public constructor() {
8+
super(NodeJsConfigurationMainError.MESSAGE);
9+
}
10+
11+
public getMessage(): string {
12+
return NodeJsConfigurationMainError.MESSAGE;
13+
}
14+
15+
public getSuggestion(): Array<string> {
16+
const suggestion: Array<string> = new Array<string>();
17+
18+
suggestion.push("Ensure the `main` field is set to be relative to the project's working directory.");
19+
20+
return suggestion;
21+
}
22+
}

Diff for: src/packager/Manifest.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Project } from "../project/Project";
55
import { NodeJsConfiguration } from "../nodejs/NodeJsConfiguration";
66
import { ManifestFileNotFoundError } from "./ManifestFileNotFoundError";
77
import { ManifestConfigurationMissingError } from "./ManifestConfigurationMissingError";
8+
import { NodeJsConfigurationMainError } from "../nodejs/NodeJsConfigurationMainError";
89

910

1011
export class Manifest {
@@ -37,13 +38,18 @@ export class Manifest {
3738
const nodeJsConfiguration: NodeJsConfiguration = this.project.getNodeJsConfiguration();
3839
const name: string = nodeJsConfiguration.getName();
3940
const version: string = nodeJsConfiguration.getVersion();
40-
const entry: string = nodeJsConfiguration.getMainEntry();
41+
const absoluteEntry: string = Path.join(this.project.getPath(), nodeJsConfiguration.getMainEntry());
42+
const relativeEntry: string = absoluteEntry.split(`${this.project.getBuiltPath()}\\`).join("");
43+
44+
if (relativeEntry === absoluteEntry) {
45+
throw new NodeJsConfigurationMainError();
46+
}
4147

4248
const manifest = {
4349
"name": name,
4450
"version": version,
4551
"type": "lse-nodejs",
46-
"entry": entry,
52+
"entry": relativeEntry,
4753
"dependencies": [{"name": "legacy-script-engine-nodejs"}]
4854
};
4955

Diff for: src/project/TypeScriptProject.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class TypeScriptProject implements Project {
6464
}
6565

6666
public getBuiltPath(): string {
67-
return this.typeScriptConfiguration.getEmittedDirectory();
67+
return Path.join(this.typeScriptConfiguration.getEmittedDirectory());
6868
}
6969

7070
public getNodeJsConfiguration(): NodeJsConfiguration {

0 commit comments

Comments
 (0)