@cenk1cenk2/oclif-common 6.0.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { ListrTaskWrapper, splat, ListrContext } from 'listr2';
10
10
  import { Logger, LeveledLogMethod } from 'winston';
11
11
  import { ModuleRef } from '@nestjs/core';
12
12
  import fs from 'fs-extra';
13
+ export { default as fs } from 'fs-extra';
13
14
  import op from 'object-path-immutable';
14
15
  import { ClassTransformOptions } from 'class-transformer';
15
16
  import { ValidatorOptions } from 'class-validator';
@@ -155,7 +156,7 @@ declare class ParserModule {
155
156
 
156
157
  declare class FileSystemService {
157
158
  private readonly logger;
158
- readonly fs: typeof fs;
159
+ readonly extra: typeof fs;
159
160
  constructor(logger: LoggerService);
160
161
  exists(path: string): boolean;
161
162
  stats(path: string): fs.Stats;
package/dist/index.js CHANGED
@@ -589,16 +589,16 @@ var _a7;
589
589
  var FileSystemService = (_a7 = class {
590
590
  constructor(logger) {
591
591
  __publicField(this, "logger");
592
- __publicField(this, "fs");
592
+ __publicField(this, "extra");
593
593
  this.logger = logger;
594
- this.fs = fs;
594
+ this.extra = fs;
595
595
  this.logger.setup(this.constructor.name);
596
596
  }
597
597
  exists(path) {
598
- return this.fs.existsSync(path);
598
+ return this.extra.existsSync(path);
599
599
  }
600
600
  stats(path) {
601
- return this.fs.statSync(path, {
601
+ return this.extra.statSync(path, {
602
602
  throwIfNoEntry: true
603
603
  });
604
604
  }
@@ -610,7 +610,7 @@ var FileSystemService = (_a7 = class {
610
610
  }
611
611
  async read(file) {
612
612
  try {
613
- const raw = await this.fs.readFile(file, "utf-8");
613
+ const raw = await this.extra.readFile(file, "utf-8");
614
614
  return raw;
615
615
  } catch (e) {
616
616
  throw new Error(`Error while reading file from "${file}": ${e.message}`);
@@ -618,7 +618,7 @@ var FileSystemService = (_a7 = class {
618
618
  }
619
619
  readSync(file) {
620
620
  try {
621
- const raw = this.fs.readFileSync(file, "utf-8");
621
+ const raw = this.extra.readFileSync(file, "utf-8");
622
622
  return raw;
623
623
  } catch (e) {
624
624
  throw new Error(`Error while reading file from "${file}": ${e.message}`);
@@ -626,7 +626,7 @@ var FileSystemService = (_a7 = class {
626
626
  }
627
627
  async write(file, data, options = {}) {
628
628
  try {
629
- await this.fs.writeFile(file, data, typeof options === "object" ? {
629
+ await this.extra.writeFile(file, data, typeof options === "object" ? {
630
630
  encoding: "utf-8",
631
631
  ...options
632
632
  } : options);
@@ -636,7 +636,7 @@ var FileSystemService = (_a7 = class {
636
636
  }
637
637
  writeSync(file, data, options = {}) {
638
638
  try {
639
- this.fs.writeFileSync(file, data, typeof options === "object" ? {
639
+ this.extra.writeFileSync(file, data, typeof options === "object" ? {
640
640
  encoding: "utf-8",
641
641
  ...options
642
642
  } : options);
@@ -646,70 +646,70 @@ var FileSystemService = (_a7 = class {
646
646
  }
647
647
  async append(file, data, options) {
648
648
  try {
649
- await this.fs.appendFile(file, data, options);
649
+ await this.extra.appendFile(file, data, options);
650
650
  } catch (e) {
651
651
  throw new Error(`Error while appending to file "${file}": ${e.message}`);
652
652
  }
653
653
  }
654
654
  appendSync(file, data) {
655
655
  try {
656
- this.fs.appendFileSync(file, data);
656
+ this.extra.appendFileSync(file, data);
657
657
  } catch (e) {
658
658
  throw new Error(`Error while appending to file "${file}": ${e.message}`);
659
659
  }
660
660
  }
661
661
  async remove(file, options) {
662
662
  try {
663
- await this.fs.rm(file, options);
663
+ await this.extra.rm(file, options);
664
664
  } catch (e) {
665
665
  throw new Error(`Error while deleting the file "${file}": ${e.message}`);
666
666
  }
667
667
  }
668
668
  removeSync(file, options) {
669
669
  try {
670
- this.fs.rmSync(file, options);
670
+ this.extra.rmSync(file, options);
671
671
  } catch (e) {
672
672
  throw new Error(`Error while deleting the file "${file}": ${e.message}`);
673
673
  }
674
674
  }
675
675
  async emptyDir(directory) {
676
676
  try {
677
- await this.fs.emptyDir(directory);
677
+ await this.extra.emptyDir(directory);
678
678
  } catch (e) {
679
679
  throw new Error(`Error while emptying the directory "${directory}": ${e.message}`);
680
680
  }
681
681
  }
682
682
  emptyDirSync(directory) {
683
683
  try {
684
- this.fs.emptyDirSync(directory);
684
+ this.extra.emptyDirSync(directory);
685
685
  } catch (e) {
686
686
  throw new Error(`Error while emptying the directory "${directory}": ${e.message}`);
687
687
  }
688
688
  }
689
689
  async removeDir(directory) {
690
690
  try {
691
- await this.fs.rmdir(directory);
691
+ await this.extra.rmdir(directory);
692
692
  } catch (e) {
693
693
  throw new Error(`Error while removing the directory "${directory}": ${e.message}`);
694
694
  }
695
695
  }
696
696
  removeDirSync(directory) {
697
697
  try {
698
- this.fs.rmdirSync(directory);
698
+ this.extra.rmdirSync(directory);
699
699
  } catch (e) {
700
700
  throw new Error(`Error while removing the directory "${directory}": ${e.message}`);
701
701
  }
702
702
  }
703
703
  async mkdir(directory) {
704
704
  try {
705
- await this.fs.mkdirp(directory);
705
+ await this.extra.mkdirp(directory);
706
706
  } catch (e) {
707
707
  throw new Error(`Error while creating the directory "${directory}": ${e.message}`);
708
708
  }
709
709
  }
710
710
  mkdirSync(directory) {
711
711
  try {
712
- this.fs.mkdirpSync(directory);
712
+ this.extra.mkdirpSync(directory);
713
713
  } catch (e) {
714
714
  throw new Error(`Error while creating the directory "${directory}": ${e.message}`);
715
715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "type": "module",