Skip to content

Commit a3ff489

Browse files
committed
Clean package.json files, use backend as npm dep in guistarter
1 parent 90e1ca2 commit a3ff489

File tree

12 files changed

+56
-44
lines changed

12 files changed

+56
-44
lines changed

Diff for: package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"private": true,
3-
"main": "main.js",
43
"scripts": {
54
"pub": "lerna publish",
65
"pub:patch": "lerna version patch --yes && lerna publish from-git --yes",
76
"pub:minor": "lerna version minor --yes && lerna publish from-git --yes",
87
"pub:major": "lerna version major --yes && lerna publish from-git --yes",
9-
"prepublish": "node ./scripts/build.js --clean",
8+
"prepublishOnly": "node ./scripts/build.js --clean",
109
"start": "node ./scripts/dev.js",
11-
"build": "node ./scripts/build.js"
10+
"build": "node ./scripts/build.js",
11+
"test": "node ./scripts/build.js"
1212
},
1313
"devDependencies": {
1414
"electron": "^4.1.4",
@@ -18,7 +18,7 @@
1818
},
1919
"workspaces": {
2020
"packages": ["packages/*"],
21-
"nohoist": ["**/guibundler", "**/guibundler/**"]
21+
"nohoist": ["**/guibundler", "**/guibundler/**", "**/guistarter", "**/guistarter/**"]
2222
},
2323
"productName": "DevSession",
2424
"author": {

Diff for: packages/backend/package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "@devsession/backend",
33
"version": "1.3.1",
44
"description": "",
5-
"main": "lib/cli.js",
5+
"main": "lib/index.js",
6+
"typings": "lib/index.d.ts",
67
"publishConfig": {
78
"access": "public"
89
},
@@ -12,23 +13,26 @@
1213
"runserver": "node . -d ../../demodirectory -k adminkey -p 8020",
1314
"start": "nodemon"
1415
},
15-
"author": "",
16+
"author": {
17+
"name": "Lukas Bach",
18+
"url": "lukasbach.com",
19+
"email": "[email protected]"
20+
},
1621
"license": "CC-BY-NC-ND-4.0",
1722
"dependencies": {
1823
"@devsession/common": "^1.2.0",
1924
"chalk": "^2.4.2",
2025
"commander": "^2.20.0",
21-
"common": "^0.2.5",
2226
"cors": "^2.8.5",
2327
"express": "^4.16.4",
2428
"fs-extra": "^7.0.1",
2529
"localtunnel": "^1.9.1",
2630
"ngrok": "^3.1.1",
27-
"node-pty": "^0.8.1",
2831
"opn": "^6.0.0",
2932
"rimraf": "^2.6.3",
3033
"socket.io": "^2.2.0",
3134
"socketio-wildcard": "^2.0.0",
35+
"node-pty": "^0.8.1",
3236
"uuid": "^3.3.2"
3337
},
3438
"devDependencies": {

Diff for: packages/backend/src/cli.ts

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
import commander from "commander";
2-
import {initApp} from "./init";
3-
import {IServerSettings} from "./ServerSettings";
1+
import {initCli} from "./init";
42

5-
commander
6-
.version("0.0.0")
7-
.option("-p, --port [port]", "The port on which to run the server. Defaults to 8020.")
8-
.option("-k, --adminkey [key]", "This key can be used to register a user as an admin. Defaults to a random string.")
9-
.option("-d, --dir [dir]", "The project directory. Defaults to the current directory.")
10-
.option("-v, --verbose", "Log all socket messages for debugging.")
11-
.parse(process.argv);
12-
13-
const settings: Partial<IServerSettings> = {
14-
projectPath: commander.dir,
15-
adminKey: commander.adminkey,
16-
port: commander.port,
17-
verbose: commander.verbose
18-
};
19-
20-
initApp(settings);
3+
// noinspection JSIgnoredPromiseFromCall
4+
initCli();

Diff for: packages/backend/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {initApp, initCli} from "./init";

Diff for: packages/backend/src/init.ts

+21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import chalk from "chalk";
2+
import * as commander from "commander";
23
import cors from "cors";
34
import express from "express";
45
import * as fs from "fs";
@@ -57,3 +58,23 @@ export const initApp = async (settings: Partial<IServerSettings>): Promise<IServ
5758
});
5859
});
5960
};
61+
62+
export const initCli = async () => {
63+
commander
64+
.version("0.0.0")
65+
.option("-p, --port [port]", "The port on which to run the server. Defaults to 8020.")
66+
.option("-k, --adminkey [key]", "This key can be used to register a user as an admin. Defaults to a random string.")
67+
.option("-d, --dir [dir]", "The project directory. Defaults to the current directory.")
68+
.option("-v, --verbose", "Log all socket messages for debugging.")
69+
.parse(process.argv);
70+
71+
const settings: Partial<IServerSettings> = {
72+
projectPath: commander.dir,
73+
adminKey: commander.adminkey,
74+
port: commander.port,
75+
verbose: commander.verbose
76+
};
77+
78+
// noinspection JSIgnoredPromiseFromCall
79+
initApp(settings);
80+
};

Diff for: packages/backend/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"sourceMap": true,
99
"outDir": "lib",
1010
"baseUrl": ".",
11+
"declaration": true,
1112
"paths": {
1213
"*": [
1314
"node_modules/*"

Diff for: packages/cli/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env node
2-
require('@devsession/backend');
2+
require('@devsession/backend').initCli();

Diff for: packages/cli/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"version": "1.3.1",
44
"description": "CLI-tool for the collaborative coding tool DevSession.",
55
"main": "index.js",
6-
"author": "Lukas Bach",
6+
"author": {
7+
"name": "Lukas Bach",
8+
"url": "lukasbach.com",
9+
"email": "[email protected]"
10+
},
711
"license": "CC-BY-NC-ND-4.0",
812
"private": false,
913
"dependencies": {

Diff for: packages/common/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
"start": "yarn build",
1010
"prepublish": "yarn build"
1111
},
12-
"author": "",
12+
"author": {
13+
"name": "Lukas Bach",
14+
"url": "lukasbach.com",
15+
"email": "[email protected]"
16+
},
1317
"license": "ISC",
1418
"description": "",
1519
"devDependencies": {

Diff for: packages/frontend/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"publishConfig": {
55
"access": "public"
66
},
7+
"author": {
8+
"name": "Lukas Bach",
9+
"url": "lukasbach.com",
10+
"email": "[email protected]"
11+
},
712
"dependencies": {
813
"@blueprintjs/select": "^3.7.0",
914
"@devsession/common": "^1.2.0",

Diff for: packages/guistarter/src/runserver.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import * as path from "path";
2-
31
export const runserver = async (settings: object): Promise<object> => {
4-
const appPath = eval(`require('electron').remote.app`).getAppPath();
5-
console.log(appPath, path.join(appPath, 'backend', 'init.js'));
6-
const initApp = eval(`require('${path.join(appPath, '..', '..', 'backend', 'init.js')}').initApp`);
7-
8-
const completeSettings = initApp(settings);
9-
10-
return completeSettings;
2+
// Use eval to force webpack to not include dependency
3+
return eval(`require('@devsession/backend')`).initApp(settings);
114
};

Diff for: yarn.lock

-5
Original file line numberDiff line numberDiff line change
@@ -2930,11 +2930,6 @@ common-tags@^1.4.0:
29302930
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937"
29312931
integrity sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==
29322932

2933-
common@^0.2.5:
2934-
version "0.2.5"
2935-
resolved "https://registry.yarnpkg.com/common/-/common-0.2.5.tgz#3c7182f678bd1e3681cd5cc348c759fe8dd22394"
2936-
integrity sha1-PHGC9ni9HjaBzVzDSMdZ/o3SI5Q=
2937-
29382933
commondir@^1.0.1:
29392934
version "1.0.1"
29402935
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"

0 commit comments

Comments
 (0)