@swizzyweb/swerve-manager 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.lock +1 -1
- package/dist/swerve.js +1 -0
- package/dist/utils/getArgs.js +12 -4
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +2 -2
- package/src/swerve.ts +1 -0
- package/src/utils/getArgs.ts +13 -4
- package/src/utils/index.ts +1 -0
- package/test/config/serviceConfig.json +1 -1
package/deno.lock
CHANGED
|
@@ -1212,7 +1212,7 @@
|
|
|
1212
1212
|
"packageJson": {
|
|
1213
1213
|
"dependencies": [
|
|
1214
1214
|
"npm:@swizzyweb/swizzy-common@~0.3.3",
|
|
1215
|
-
"npm:@swizzyweb/swizzy-web-service
|
|
1215
|
+
"npm:@swizzyweb/swizzy-web-service@0.6.2",
|
|
1216
1216
|
"npm:@types/express@^5.0.6",
|
|
1217
1217
|
"npm:@types/node@^22.18.6",
|
|
1218
1218
|
"npm:@typescript-eslint/eslint-plugin@^8.54.0",
|
package/dist/swerve.js
CHANGED
package/dist/utils/getArgs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import process from "node:process";
|
|
2
|
+
import process, { cwd } from "node:process";
|
|
3
3
|
import { SwerveConfigParser } from "../config/config-parser.js";
|
|
4
4
|
import { deepMerge } from "@swizzyweb/swizzy-common";
|
|
5
5
|
import { getPackageJson } from "./getPackageJson.js";
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
6
7
|
function getHelpText() {
|
|
7
8
|
return `Help --
|
|
8
9
|
npm run server <serviceName> <port (optional)>
|
|
@@ -168,9 +169,16 @@ export async function getArgs(args, logger) {
|
|
|
168
169
|
// serviceEntry[1].servicePath ?? serviceEntry[1].packageName;
|
|
169
170
|
if (!servicePath) {
|
|
170
171
|
serviceEntry[1].servicePath = packageName;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
const localPackage = path.join(cwd(), "node_modules", packageName);
|
|
173
|
+
const packageJsonPath = path.join(localPackage, "package.json");
|
|
174
|
+
if (existsSync(path.join(packageJsonPath))) {
|
|
175
|
+
const json = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
176
|
+
const main = json.main;
|
|
177
|
+
serviceEntry[1].servicePath = path.join(localPackage, main);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
serviceEntry[1].servicePath = getPackageJson(packageName).servicePath;
|
|
181
|
+
}
|
|
174
182
|
}
|
|
175
183
|
else {
|
|
176
184
|
const serviceData = getService(servicePath, logger);
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swizzyweb/swerve-manager",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "swizzy-swerve is a bootstrapper for swizzy web services. This package will bootstrap and run independent swizzy web services.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@swizzyweb/swizzy-common": "^0.3.3",
|
|
33
|
-
"@swizzyweb/swizzy-web-service": "
|
|
33
|
+
"@swizzyweb/swizzy-web-service": "0.6.2",
|
|
34
34
|
"express": "^5.2.1"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
package/src/swerve.ts
CHANGED
package/src/utils/getArgs.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
import { ILogger } from "@swizzyweb/swizzy-common";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
4
|
+
import process, { cwd } from "node:process";
|
|
5
5
|
import { IConfig, IService, KeyValue } from "../config/index.js";
|
|
6
6
|
import { SwerveConfigParser } from "../config/config-parser.js";
|
|
7
7
|
import { deepMerge } from "@swizzyweb/swizzy-common";
|
|
8
8
|
import { getPackageJson } from "./getPackageJson.js";
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
10
|
|
|
10
11
|
function getHelpText() {
|
|
11
12
|
return `Help --
|
|
@@ -202,9 +203,17 @@ export async function getArgs(
|
|
|
202
203
|
// serviceEntry[1].servicePath ?? serviceEntry[1].packageName;
|
|
203
204
|
if (!servicePath) {
|
|
204
205
|
serviceEntry[1].servicePath = packageName!;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
const localPackage = path.join(cwd(), "node_modules", packageName);
|
|
207
|
+
const packageJsonPath = path.join(localPackage, "package.json");
|
|
208
|
+
if (existsSync(path.join(packageJsonPath))) {
|
|
209
|
+
const json = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
210
|
+
const main = json.main;
|
|
211
|
+
serviceEntry[1].servicePath = path.join(localPackage, main);
|
|
212
|
+
} else {
|
|
213
|
+
serviceEntry[1].servicePath = getPackageJson(
|
|
214
|
+
packageName!,
|
|
215
|
+
).servicePath;
|
|
216
|
+
}
|
|
208
217
|
} else {
|
|
209
218
|
const serviceData = getService(servicePath, logger);
|
|
210
219
|
serviceEntry[1].packageName = serviceData.packageJson?.name;
|
package/src/utils/index.ts
CHANGED