Merge pull request #2 from RyanHx/push-on-conn
Push all files on connection
This commit is contained in:
commit
5520fa3430
3 changed files with 18 additions and 3 deletions
|
@ -34,6 +34,7 @@ Here's an example of it's contents:
|
||||||
"definitionFile": {
|
"definitionFile": {
|
||||||
"update": false,
|
"update": false,
|
||||||
"location": "NetScriptDefinitions.d.ts"
|
"location": "NetScriptDefinitions.d.ts"
|
||||||
}
|
},
|
||||||
|
"pushAllOnConnection": false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -52,6 +52,12 @@ export let config = convict({
|
||||||
env: 'BB_LOCATION_DEF',
|
env: 'BB_LOCATION_DEF',
|
||||||
default: "./NetScriptDefinitions.d.ts"
|
default: "./NetScriptDefinitions.d.ts"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
pushAllOnConnection: {
|
||||||
|
doc: 'Push all files when initial connection is made.',
|
||||||
|
format: 'Boolean',
|
||||||
|
env: 'BB_CON_PUSH',
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
12
src/index.js
12
src/index.js
|
@ -23,8 +23,16 @@ export async function start() {
|
||||||
signal.emit(EventType.MessageSend, requestDefinitionFile());
|
signal.emit(EventType.MessageSend, requestDefinitionFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload missing files to the game.
|
if (config.get("pushAllOnConnection")) {
|
||||||
signal.emit(EventType.MessageSend, requestFilenames());
|
const extensions = config.get("allowedFiletypes");
|
||||||
|
for (const path of watch.paths.keys()) {
|
||||||
|
if (extensions.some(extension => path.endsWith(extension)))
|
||||||
|
signal.emit(EventType.MessageSend, fileChangeEventToMsg({ path: path }))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Upload missing files to the game.
|
||||||
|
signal.emit(EventType.MessageSend, requestFilenames());
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add a handler for changed files.
|
// Add a handler for changed files.
|
||||||
|
|
Loading…
Add table
Reference in a new issue