Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update nsfw 2.0.0 to support node.js 14 #3775

Merged
merged 2 commits into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core-kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"inversify": "^5.0.1",
"log-process-errors": "^5.0.3",
"nanomatch": "^1.2.13",
"nsfw": "^1.2.5",
"nsfw": "^2.0.0",
"reflect-metadata": "^0.1.13",
"semver": "^6.3.0",
"type-fest": "^0.14.0"
Expand Down
33 changes: 5 additions & 28 deletions packages/core-kernel/src/services/config/watcher.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
import nsfw from "nsfw";
import nsfw, { ActionType, NSFW } from "nsfw";

import { Application } from "../../contracts/kernel";
import { Identifiers, inject, injectable } from "../../ioc";

/**
* @interface FileEvent
*/
interface FileEvent {
/**
* @type {number}
* @memberof FileEvent
*/
action: number;

/**
* @type {string}
* @memberof FileEvent
*/
directory: string;

/**
* @type {string}
* @memberof FileEvent
*/
file: string;
}

/**
* @export
* @class Watcher
Expand All @@ -44,10 +21,10 @@ export class Watcher {

/**
* @private
* @type {nsfw}
* @type {NSFW}
* @memberof Watcher
*/
private watcher: nsfw;
private watcher!: NSFW;

/**
* @returns {Promise<void>}
Expand All @@ -56,9 +33,9 @@ export class Watcher {
public async boot(): Promise<void> {
const configFiles: string[] = [".env", "delegates.json", "peers.json", "plugins.js", "plugins.json"];

this.watcher = await nsfw(this.app.configPath(), (events: FileEvent[]) => {
this.watcher = await nsfw(this.app.configPath(), (events) => {
for (const event of events) {
if (configFiles.includes(event.file) && event.action === nsfw.actions.MODIFIED) {
if (event.action === ActionType.MODIFIED && configFiles.includes(event.file)) {
this.app.reboot();
}
}
Expand Down
30 changes: 11 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9496,11 +9496,6 @@ lodash.isfunction@^3.0.8, lodash.isfunction@~3.0.8:
resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051"
integrity sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==

lodash.isinteger@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343"
integrity sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=

lodash.ismatch@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37"
Expand All @@ -9511,11 +9506,6 @@ lodash.isnumber@^3.0.3:
resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc"
integrity sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=

lodash.isundefined@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz#23ef3d9535565203a66cefd5b830f848911afb48"
integrity sha1-I+89lTVWUgOmbO/VuDD4SJEa+0g=

lodash.map@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
Expand Down Expand Up @@ -10276,7 +10266,7 @@ mz@^2.4.0, mz@^2.5.0, mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"

nan@^2.0.0, nan@^2.12.1, nan@^2.13.1, nan@^2.13.2:
nan@^2.12.1, nan@^2.13.1, nan@^2.13.2:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
Expand Down Expand Up @@ -10395,6 +10385,11 @@ node-abi@^2.7.0:
dependencies:
semver "^5.4.1"

node-addon-api@*:
version "3.0.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.0.0.tgz#812446a1001a54f71663bed188314bba07e09247"
integrity sha512-sSHCgWfJ+Lui/u+0msF3oyCgvdkhxDbkCS6Q8uiJquzOimkJBvX6hl5aSSA7DR1XbMpdM8r7phjcF63sF4rkKg==

node-addon-api@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.0.tgz#f9afb8d777a91525244b01775ea0ddbe1125483b"
Expand Down Expand Up @@ -10774,15 +10769,12 @@ npm-run-path@^4.0.0:
gauge "~2.7.3"
set-blocking "~2.0.0"

nsfw@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/nsfw/-/nsfw-1.2.5.tgz#febe581af616f7b042f89df133abe62416c4c803"
integrity sha512-m3mwZUKXiCR69PDMLfAmKmiNzy0Oe9LhFE0DYZC5cc1htNj5Hyb1sAgglXhuaDkibFy22AVvPC5cCFB3A6mYIw==
nsfw@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/nsfw/-/nsfw-2.0.0.tgz#b0e431dbccf7ea01fc31d9285325ad31f0aaf5a8"
integrity sha512-MO/+8Gjqnm8YviA0H4XZccz38wXhFNc4w7UCqsvge/cOyoN8tNzDUF257CyJzEUPmcJB0YRtMt9IKLE1eCOu+A==
dependencies:
fs-extra "^7.0.0"
lodash.isinteger "^4.0.4"
lodash.isundefined "^3.0.1"
nan "^2.0.0"
node-addon-api "*"

number-is-nan@^1.0.0:
version "1.0.1"
Expand Down