Skip to content

Commit

Permalink
fix: node config fatal tip message
Browse files Browse the repository at this point in the history
  • Loading branch information
kaivean committed Oct 29, 2022
1 parent a8ed692 commit 793fbc1
Show file tree
Hide file tree
Showing 16 changed files with 2,758 additions and 2,321 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ npm run dev
```sh
npm i lerna -g

lerna bootstrap
lerna bootstrap --registry https://registry.npmmirror.com
lerna link

# global link
cd packages/cli
npm link
```
Expand All @@ -63,6 +64,11 @@ npm link
```sh
# watch @hoth/cli
lerna exec "tsc --build -w tsconfig.json" --scope @hoth/cli
lerna exec "tsc --build -w tsconfig.json" --scope @hoth/decorators
lerna exec "tsc --build -w tsconfig.json" --scope @hoth/app-autoload
lerna exec "tsc --build -w tsconfig.json" --scope @hoth/logger

lerna add config-enhanced --scope @hoth/app-autoload --registry https://registry.npmmirror.com

# debug for "hoth start"
cd example/hoth-quickstart
Expand Down
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module.exports = {
extends: [
"@commitlint/config-conventional",
],
rules: {
'body-max-line-length': [0, 'always'] // Make sure there is never a max-line-length by disabling the rule
},
};
2 changes: 2 additions & 0 deletions packages/app-autoload/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tsconfig.json
src
2 changes: 1 addition & 1 deletion packages/app-autoload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@hoth/logger": "^1.1.7",
"@hoth/molecule": "^1.1.2",
"@hoth/utils": "^1.1.4",
"config": "^3.3.3",
"config-enhanced": "^3.3.7",
"fastify-plugin": "^3.0.0",
"fastify-warmup": "0.1.1",
"resolve-from": "^5.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/app-autoload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
process.env.SUPPRESS_NO_CONFIG_WARNING = 'y';
process.env.ALLOW_CONFIG_MUTATIONS = 'false';

import Config from 'config';
import Config from 'config-enhanced';
import {resolve, join, isAbsolute} from 'path';
import {existsSync, readdirSync} from 'fs';
import {FastifyInstance, FastifyPluginAsync} from 'fastify';
Expand Down Expand Up @@ -183,6 +183,7 @@ export async function getApps(opts: AppAutoload): Promise<AppConfig[]> {
const dirPath = resolve(appRoot, dir.name);
if (dir.isDirectory() && existsSync(join(dirPath, 'app.js'))) {
const configs = await loadConfig(dirPath);

let appPrefix = prefix;
if (configs.pluginConfig && configs.pluginConfig['@hoth/app-autoload']) {
appPrefix = configs.pluginConfig['@hoth/app-autoload'].prefix || appPrefix;
Expand Down
2 changes: 1 addition & 1 deletion packages/app-autoload/src/module.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare module 'config';
declare module 'config-enhanced';
declare module '@hoth/molecule';
1 change: 1 addition & 0 deletions packages/cli/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
2 changes: 1 addition & 1 deletion packages/cli/hoth-template/templates/normal/nodemon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"watch": ["*.ts", "*.tpl"],
"ignore": ["*.test.ts", "node_modules/*", "*.d.ts"],
"ignore": ["*.test.ts", "node_modules/*", "*.d.ts", "dist"],
"ext": "ts,js,tpl",
"exec": "npm run build && NODE_ENV=development hoth start --app-dir='dist' --app-name='__appName__' --app-prefix='/__appName__'",
"legacyWatch": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"watch": ["*.ts", "*.html", "*.san"],
"ignore": ["*.test.ts", "node_modules/*", "*.d.ts"],
"ignore": ["*.test.ts", "node_modules/*", "*.d.ts", "dist"],
"ext": "ts,js,tpl",
"exec": "npm run build && NODE_ENV=development hoth start --app-dir='dist' --app-name='__appName__' --app-prefix='/__appName__'",
"legacyWatch": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"watch": ["*.ts", "*.html", "*.vue"],
"ignore": ["*.test.ts", "node_modules/*", "*.d.ts"],
"ignore": ["*.test.ts", "node_modules/*", "*.d.ts", "dist"],
"ext": "ts,js,tpl",
"exec": "npm run build && NODE_ENV=development hoth start --app-dir='dist' --app-name='__appName__' --app-prefix='/__appName__'",
"legacyWatch": true
Expand Down
1 change: 1 addition & 0 deletions packages/decorators/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
1 change: 1 addition & 0 deletions packages/logger/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
4 changes: 3 additions & 1 deletion packages/logger/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# [@hoth/logger-v1.5.0](https://github.com/searchfe/hoth/compare/@hoth/logger-v1.4.0...@hoth/logger-v1.5.0) (2022-10-10)



### Features

# [@hoth/logger-v1.5.0](https://github.com/searchfe/hoth/compare/@hoth/logger-v1.4.0...@hoth/logger-v1.5.0) (2022-10-10)

* product取值优化 ([b857005](https://github.com/searchfe/hoth/commit/b85700587d7f208e06698ce88e7069e770729be4))

# [@hoth/logger-v1.4.0](https://github.com/searchfe/hoth/compare/@hoth/logger-v1.3.0...@hoth/logger-v1.4.0) (2022-03-29)
Expand Down
1 change: 1 addition & 0 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"homepage": "https://github.com/cxtom/hoth#readme",
"dependencies": {
"chalk": "4.1.2",
"file-stream-rotator": "^0.5.7",
"flatstr": "^1.0.12",
"lodash": "^4.17.21",
Expand Down
9 changes: 8 additions & 1 deletion packages/logger/src/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @author cxtom
*/

import chalk from 'chalk';
import format from './format';
import {defaultLevels} from './constants';

Expand Down Expand Up @@ -56,7 +57,13 @@ export default function (streamsArray) {

/* istanbul ignore else */
if (isDevelopment) {
console.log(data);
const arr = info.result.split(':');
arr[0] = (['FATAL', 'ERROR'].includes(arr[0]))
? chalk.red(arr[0]) : (arr[0] === 'WARN')
? chalk.yellow(arr[0]) : chalk.green(arr[0]);

// with \n
process.stdout.write(arr.join(':'));
}

stream.write(info.result);
Expand Down
Loading

0 comments on commit 793fbc1

Please sign in to comment.