Skip to content

Commit ba948d4

Browse files
committed
Refactoring - migrate to NestJS
1 parent b8ead8b commit ba948d4

Some content is hidden

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

68 files changed

+13290
-5026
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; top-most EditorConfig file
2+
root = true
3+
4+
; Unix-style newlines
5+
[*]
6+
end_of_line = LF
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
indent_style = space
10+
indent_size = 2
11+

.gitignore

Lines changed: 42 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,57 @@
1-
.idea
2-
persist/
3-
old/
4-
test/
5-
config.json
6-
.vscode/
7-
.bak
1+
# compiled output
2+
/dist
3+
/node_modules
4+
/build
85

96
# Logs
107
logs
118
*.log
129
npm-debug.log*
10+
pnpm-debug.log*
1311
yarn-debug.log*
1412
yarn-error.log*
13+
lerna-debug.log*
14+
15+
# OS
16+
.DS_Store
17+
18+
# Tests
19+
/coverage
20+
/.nyc_output
21+
22+
# IDEs and editors
23+
/.idea
24+
.project
25+
.classpath
26+
.c9/
27+
*.launch
28+
.settings/
29+
*.sublime-workspace
30+
31+
# IDE - VSCode
32+
.vscode/*
33+
!.vscode/settings.json
34+
!.vscode/tasks.json
35+
!.vscode/launch.json
36+
!.vscode/extensions.json
37+
38+
# dotenv environment variable files
39+
.env
40+
.env.development.local
41+
.env.test.local
42+
.env.production.local
43+
.env.local
44+
45+
# temp directory
46+
.temp
47+
.tmp
1548

1649
# Runtime data
1750
pids
1851
*.pid
1952
*.seed
2053
*.pid.lock
2154

22-
# Directory for instrumented libs generated by jscoverage/JSCover
23-
lib-cov
24-
25-
# Coverage directory used by tools like istanbul
26-
coverage
27-
28-
# nyc test coverage
29-
.nyc_output
30-
31-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
32-
.grunt
33-
34-
# Bower dependency directory (https://bower.io/)
35-
bower_components
36-
37-
# node-waf configuration
38-
.lock-wscript
39-
40-
# Compiled binary addons (https://nodejs.org/api/addons.html)
41-
build/Release
42-
43-
# Dependency directories
44-
node_modules/
45-
jspm_packages/
46-
47-
# TypeScript v1 declaration files
48-
typings/
49-
50-
# Optional npm cache directory
51-
.npm
52-
53-
# Optional eslint cache
54-
.eslintcache
55-
56-
# Optional REPL history
57-
.node_repl_history
58-
59-
# Output of 'npm pack'
60-
*.tgz
61-
62-
# Yarn Integrity file
63-
.yarn-integrity
64-
65-
# dotenv environment variables file
66-
.env
67-
68-
# next.js build output
69-
.next
70-
71-
# vuepress build output
72-
.vuepress/dist
73-
74-
# Serverless directories
75-
.serverless
55+
# Diagnostic reports (https://nodejs.org/api/report.html)
56+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
7657
devices.json

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

Dockerfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ ARG BUILD_TIME
1313
ARG BUILD_VERSION
1414
ARG BUILD_REVISION
1515

16-
#RUN sed -i -e "s#__DEV_DIRTY__#${BUILD_VERSION}-${BUILD_REVISION}#g" src/main.js
16+
RUN sed -i -e "s#__DEV_DIRTY__#${BUILD_VERSION}-${BUILD_REVISION}#g" src/main.ts
1717

18-
CMD ["node", "--enable-source-maps", "/app/src/tuya-mqtt.js"]
18+
RUN npm run build
1919

2020

21-
#FROM gcr.io/distroless/nodejs22-debian12
22-
#
23-
#COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh
24-
#COPY --from=busybox:1.35.0-uclibc /bin/tar /bin/tar
25-
#
26-
#COPY --from=build-env /app/dist /app
27-
#COPY --from=build-env /app/node_modules /app/node_modules
28-
#
29-
#ENTRYPOINT []
30-
#
21+
FROM gcr.io/distroless/nodejs22-debian12
22+
23+
COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh
24+
COPY --from=busybox:1.35.0-uclibc /bin/tar /bin/tar
25+
26+
COPY --from=build-env /app/dist /app
27+
COPY --from=build-env /app/node_modules /app/node_modules
28+
29+
ENTRYPOINT []
30+
CMD ["node", "--enable-source-maps", "/app/main.js"]
3131

3232

config.json.sample

Lines changed: 0 additions & 7 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// @ts-check
2+
import eslint from '@eslint/js';
3+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import globals from 'globals';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default tseslint.config(
8+
{
9+
ignores: ['eslint.config.mjs'],
10+
},
11+
eslint.configs.recommended,
12+
...tseslint.configs.recommendedTypeChecked,
13+
eslintPluginPrettierRecommended,
14+
{
15+
languageOptions: {
16+
globals: {
17+
...globals.node,
18+
...globals.jest,
19+
},
20+
sourceType: 'commonjs',
21+
parserOptions: {
22+
projectService: true,
23+
tsconfigRootDir: import.meta.dirname,
24+
},
25+
},
26+
},
27+
{
28+
rules: {
29+
'@typescript-eslint/no-explicit-any': 'off',
30+
'@typescript-eslint/no-floating-promises': 'warn',
31+
'@typescript-eslint/no-unsafe-argument': 'warn',
32+
"prettier/prettier": ["error", { endOfLine: "auto" }],
33+
},
34+
},
35+
);

nest-cli.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/nest-cli",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src",
5+
"compilerOptions": {
6+
"deleteOutDir": true
7+
}
8+
}

0 commit comments

Comments
 (0)