Skip to content

Commit 6e25dd4

Browse files
committed
^ cleans
1 parent 78ffe92 commit 6e25dd4

78 files changed

Lines changed: 1222 additions & 2641 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.layers.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
},
77
"templates": {
88
"default": "./templates/SSRApp",
9-
"SSRApp": "./templates/SSRApp",
10-
"StaticApp": "./templates/StaticApp",
11-
"RSApp": "./templates/RSApp"
9+
"SSRApp": "./templates/SSRApp"
1210
}
1311
},
1412
"dev": {

etc/cli/start.js

Lines changed: 61 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -29,91 +29,82 @@
2929
const program = require('commander'),
3030
express = require("express"),
3131
server = express(),
32-
fkill = require('fkill'),
32+
fkill = require('fkill'),
3333
http = require('http').Server(server),
3434
exec = require('child_process').exec,
3535
argz = process.argv.slice(2),
3636
Profile = require('../utils/Profile');
3737

3838
let profileId = process.env.__LPACK_PROFILE__ || "default";
3939

40-
if ( argz[0] && /^\:.*$/.test(argz[0]) )
41-
profileId = argz.shift().replace(/^\:(.*)$/, '$1');
40+
if ( argz[ 0 ] && /^\:.*$/.test(argz[ 0 ]) )
41+
profileId = argz.shift().replace(/^\:(.*)$/, '$1');
4242

4343
program
44-
.option('-l, --local', 'Limit Build control web api to localhost')
45-
.option('-p, --port [port=9090]', 'Build control')
46-
.parse(process.argv);
44+
.option('-l, --local', 'Limit Build control web api to localhost')
45+
.option('-p, --port [port=9090]', 'Build control')
46+
.parse(process.argv);
4747

48-
let port = program.port || 9090,
48+
let port = program.port === true ? 9090 : program.port,
4949
pDir = program.source || process.cwd();
5050

5151
let profile = new Profile(profileId);
5252

5353
profile.start();
5454
profile.onComplete(e => process.exit());
55-
56-
57-
server.use(express.json()); // to support JSON-encoded bodies
58-
server.use(express.urlencoded()); // to support URL-encoded bodies
59-
60-
server.use(
61-
"/status",
62-
( req, res ) => {
63-
res.header("Access-Control-Allow-Origin", "*");
64-
res.json({ status: profile.getStatus() })
65-
}
66-
);
67-
68-
server.use(
69-
"/restart",
70-
( req, res ) => {
71-
res.header("Access-Control-Allow-Origin", "*");
72-
profile.start();
73-
74-
res.json({ success: true })
75-
}
76-
);
77-
server.use(
78-
"/forceKill8080",
79-
( req, res ) => {
80-
res.header("Access-Control-Allow-Origin", "*");
81-
fkill(":8080", { tree: true, force: true, silent: true })
82-
83-
res.json({ success: true })
84-
}
85-
);
86-
87-
server.use(
88-
"/switch",
89-
( req, res ) => {
90-
res.header("Access-Control-Allow-Origin", "*");
91-
profileId = req.query.to || "prod";
92-
profile.stop().then(
93-
e => {
94-
profile = new Profile(profileId);
95-
profile.start();
96-
res.json({ success: true, profileId })
97-
}
98-
);
99-
100-
101-
}
102-
);
103-
104-
server.use(
105-
"/kill",
106-
( req, res ) => {
107-
res.header("Access-Control-Allow-Origin", "*");
108-
res.json({ success: true });
109-
110-
profile.stop().then(e => process.exit());
111-
}
112-
);
113-
114-
let server_instance = http.listen(parseInt(port), function () {
115-
console.info('Build manager running on ', server_instance.address(), server_instance.address().port)
116-
});
117-
11855
process.on('SIGINT', e => profile.stop()); // catch ctrl-c
11956
process.on('SIGTERM', e => profile.stop()); // catch kill
57+
58+
if ( port ) {
59+
server.use(express.json()); // to support JSON-encoded bodies
60+
server.use(express.urlencoded()); // to support URL-encoded bodies
61+
62+
server.use(
63+
"/status",
64+
( req, res ) => {
65+
res.header("Access-Control-Allow-Origin", "*");
66+
res.json({ status: profile.getStatus() })
67+
}
68+
);
69+
70+
server.use(
71+
"/restart",
72+
( req, res ) => {
73+
res.header("Access-Control-Allow-Origin", "*");
74+
profile.start();
75+
76+
res.json({ success: true })
77+
}
78+
);
79+
80+
server.use(
81+
"/switch",
82+
( req, res ) => {
83+
res.header("Access-Control-Allow-Origin", "*");
84+
profileId = req.query.to || "prod";
85+
profile.stop().then(
86+
e => {
87+
profile = new Profile(profileId);
88+
profile.start();
89+
res.json({ success: true, profileId })
90+
}
91+
);
92+
93+
94+
}
95+
);
96+
97+
server.use(
98+
"/kill",
99+
( req, res ) => {
100+
res.header("Access-Control-Allow-Origin", "*");
101+
res.json({ success: true });
102+
103+
profile.stop().then(e => process.exit());
104+
}
105+
);
106+
107+
let server_instance = http.listen(parseInt(port), function () {
108+
console.info('Build manager running on ', server_instance.address(), server_instance.address().port)
109+
});
110+
}

etc/utils/Profile.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
/*
2-
*
3-
* Copyright (C) 2019 Nathanael Braun
4-
*
5-
* This program is free software: you can redistribute it and/or modify
6-
* it under the terms of the GNU Affero General Public License as published by
7-
* the Free Software Foundation, either version 3 of the License, or
8-
* (at your option) any later version.
9-
*
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU Affero General Public License for more details.
14-
*
15-
* You should have received a copy of the GNU Affero General Public License
16-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
*/
181

192
const lpack = require('layer-pack'),
203
fs = require('fs'),

0 commit comments

Comments
 (0)