fix(ssh): modernize filesystem handling and package exports for NodeNext compatibility
This commit is contained in:
@@ -12,11 +12,10 @@ export class SshConfig {
|
||||
* stores a config file
|
||||
*/
|
||||
store(dirPathArg: string) {
|
||||
let done = plugins.smartpromise.defer();
|
||||
plugins.fs.ensureDirSync(dirPathArg);
|
||||
let configArray: configObject[] = [];
|
||||
let configString;
|
||||
for (let key in this._sshKeyArray) {
|
||||
let sshKey = this._sshKeyArray[key];
|
||||
for (const sshKey of this._sshKeyArray) {
|
||||
let configString = '';
|
||||
if (sshKey.host) {
|
||||
configString =
|
||||
'Host ' +
|
||||
@@ -38,18 +37,13 @@ export class SshConfig {
|
||||
});
|
||||
}
|
||||
let configFile: string = '';
|
||||
for (let key in configArray) {
|
||||
configFile = configFile + configArray[key].configString + '\n';
|
||||
for (const config of configArray) {
|
||||
configFile = configFile + config.configString + '\n';
|
||||
}
|
||||
plugins.smartfile.memory.toFsSync(configFile, plugins.path.join(dirPathArg, 'config'));
|
||||
return done.promise;
|
||||
plugins.fs.writeFileSync(plugins.path.join(dirPathArg, 'config'), configFile);
|
||||
}
|
||||
read(dirPathArg) {
|
||||
let done = plugins.smartpromise.defer();
|
||||
let configArray: configObject[];
|
||||
plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, 'config'));
|
||||
|
||||
return done.promise;
|
||||
read(dirPathArg: string) {
|
||||
return plugins.fs.readFileSync(plugins.path.join(dirPathArg, 'config'), 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user