Skip to content

Commit 086b831

Browse files
authored
Added ability to save individual configs (#3)
1 parent 63e907e commit 086b831

File tree

113 files changed

+5768
-1614
lines changed

Some content is hidden

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

113 files changed

+5768
-1614
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
dist
3+
build
34
.env*
45
*.cache

.vscode/launch.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"preLaunchTask": "build-iot",
2020
"outFiles": [
2121
"${workspaceFolder}/iot/dist/**/*.js"
22-
]
22+
],
23+
"internalConsoleOptions": "openOnSessionStart"
2324
},
2425
{
2526
"type": "node",
@@ -36,7 +37,9 @@
3637
"preLaunchTask": "build-server",
3738
"outFiles": [
3839
"${workspaceFolder}/server/dist/**/*.js"
39-
]
40+
],
41+
"internalConsoleOptions": "openOnSessionStart",
42+
"outputCapture": "std" //to capture winston console logs
4043
}
4144
]
4245
}

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"googleusercontent",
1111
"heatramp",
1212
"icdocd",
13+
"joshkrak",
1314
"jwtid",
15+
"multiline",
1416
"netled",
1517
"parameterless",
1618
"prestart",
@@ -19,7 +21,8 @@
1921
"rpio",
2022
"ttsc",
2123
"ttypescript",
22-
"typecheck"
24+
"typecheck",
25+
"vetur"
2326
],
2427
"typescript.tsdk": "node_modules\\typescript\\lib",
2528
"html.format.wrapAttributes": "aligned-multiple",

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:14-slim
2+
COPY package*.json /
3+
COPY dist/ /dist/
4+
COPY node_modules/ /node_modules/
5+
EXPOSE 3001
6+
CMD ["node", "."]

build-publish.mjs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
2+
import { execSync } from 'child_process';
3+
import * as fs from 'fs';
4+
import ncp from 'ncp';
5+
6+
if (fs.existsSync('./build')) {
7+
console.log('Removing existing build folder')
8+
fs.rmSync('./build', { recursive: true, force: true });
9+
}
10+
11+
console.log('Creating build folder');
12+
fs.mkdirSync('./build');
13+
14+
//*
15+
16+
console.log('Building core');
17+
execSync('npm run --prefix ./core build', { stdio: 'inherit' });
18+
19+
console.log('Building server')
20+
execSync('npm run --prefix ./server build', { stdio: 'inherit' });
21+
22+
console.log('Building web');
23+
execSync('npm run --prefix ./web build', { stdio: 'inherit' });
24+
25+
//*/
26+
27+
console.log('Copy server to build');
28+
console.log('-- dist');
29+
await new Promise((res, rej) => {
30+
ncp('./server/dist', './build/dist', e => {
31+
if (e) {
32+
rej();
33+
} else {
34+
res();
35+
}
36+
});
37+
});
38+
39+
console.log('-- package.json');
40+
await new Promise((res, rej) => {
41+
ncp('./server/package.json', './build/package.json', e => {
42+
if (e) {
43+
rej();
44+
} else {
45+
res();
46+
}
47+
});
48+
});
49+
50+
console.log('-- package-lock.json');
51+
await new Promise((res, rej) => {
52+
ncp('./server/package-lock.json', './build/package-lock.json', e => {
53+
if (e) {
54+
rej();
55+
} else {
56+
res();
57+
}
58+
});
59+
});
60+
61+
console.log('-- node_module');
62+
await new Promise((res, rej) => {
63+
ncp('./server/node_modules', './build/node_modules', { dereference: true /* Because of core */ }, e => {
64+
if (e) {
65+
console.error('Error copying node_modules', e);
66+
rej();
67+
} else {
68+
res();
69+
}
70+
});
71+
});
72+
73+
//We can't yet enable this because it re-symlinks core and then for some reason, removes all the dependencies
74+
// console.log('Pruning node_modules')
75+
// execSync('npm prune --prefix ./build --production', { stdio: 'inherit' });
76+
77+
console.log('Copy web to build');
78+
await new Promise((res, rej) => {
79+
ncp('./web/dist', './build/dist/.web', e => {
80+
if (e) {
81+
rej();
82+
} else {
83+
res();
84+
}
85+
});
86+
});
87+
88+
console.log('Copy Dockerfile');
89+
await new Promise((res, rej) => {
90+
ncp('./Dockerfile', './build/Dockerfile', e => {
91+
if (e) {
92+
rej();
93+
} else {
94+
res();
95+
}
96+
});
97+
});
98+
99+
console.log('Building docker image');
100+
await execSync('docker build -t joshkrak/netled .', { cwd: './build', stdio: 'inherit' });
101+
102+
console.log('Publishing docker image');
103+
await execSync('docker push joshkrak/netled', { stdio: 'inherit' });

core/.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cSpell.words": [
3+
"LEDs",
4+
"netled"
5+
]
6+
}

0 commit comments

Comments
 (0)