Read app path from applications file#13
Open
JekRock wants to merge 4 commits intometatech-university:mainfrom
Open
Read app path from applications file#13JekRock wants to merge 4 commits intometatech-university:mainfrom
JekRock wants to merge 4 commits intometatech-university:mainfrom
Conversation
Change ECMAScript version in eslint config to pass linting. ECMAScript 2020 doesn't include private class fields that this project is using
tshemsedinov
requested changes
Mar 1, 2023
.eslintrc.json
Outdated
| "extends": "eslint:recommended", | ||
| "parserOptions": { | ||
| "ecmaVersion": 2020 | ||
| "ecmaVersion": 2022 |
Contributor
There was a problem hiding this comment.
Suggested change
| "ecmaVersion": 2022 | |
| "ecmaVersion": "latest" |
main.js
Outdated
Comment on lines
+3
to
+4
| const { resolve } = require('node:path'); | ||
| const { readFile } = require('node:fs/promises'); |
Contributor
There was a problem hiding this comment.
It's better to have compound identifiers like path.resolve in codebase below
main.js
Outdated
Comment on lines
+17
to
+21
| const appsFile = await readFile(resolve(appFilePath), { | ||
| encoding: 'utf8', | ||
| }); | ||
|
|
||
| return appsFile.split('\n').filter((path) => path.trim() !== ''); |
Contributor
There was a problem hiding this comment.
Suggested change
| const appsFile = await readFile(resolve(appFilePath), { | |
| encoding: 'utf8', | |
| }); | |
| return appsFile.split('\n').filter((path) => path.trim() !== ''); | |
| const appsFile = path.resolve('.applications') | |
| const apps = await readFile(appsFile, 'utf8'); | |
| return apps.split('[\r\n\s]+').filter((s) => s.length !== 0); |
main.js
Outdated
| const { loadApplication } = require('./src/loader.js'); | ||
|
|
||
| const APPLICATION_PATH = path.join(process.cwd(), '../NodeJS-Application'); | ||
| const APPLICATIONS_FILE_PATH = '.applications'; |
Contributor
There was a problem hiding this comment.
We need no constant, string content is easy to understand
main.js
Outdated
| }; | ||
|
|
||
| (async () => { | ||
| const streamForLogger = new StreamForLogger(LOG_FOLDER_PATH); |
Contributor
There was a problem hiding this comment.
Suggested change
| const streamForLogger = new StreamForLogger(LOG_FOLDER_PATH); | |
| const stream = new StreamForLogger(LOG_FOLDER_PATH); |
Comment on lines
+26
to
+28
| const server = fastify({ | ||
| logger: { level: 'info', stream: streamForLogger }, | ||
| }); |
Contributor
There was a problem hiding this comment.
Suggested change
| const server = fastify({ | |
| logger: { level: 'info', stream: streamForLogger }, | |
| }); | |
| const server = fastify({ logger: { level: 'info', stream } }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #9