@cenk1cenk2/oclif-common 3.7.0 → 3.7.2
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 +4 -2
- package/dist/index.js +45 -35
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -254,6 +254,8 @@ declare class FileSystemService {
|
|
|
254
254
|
removeSync(file: string, options?: fs.RmOptions): void;
|
|
255
255
|
emptyDir(directory: string): Promise<void>;
|
|
256
256
|
emptyDirSync(directory: string): void;
|
|
257
|
+
removeDir(directory: string): Promise<void>;
|
|
258
|
+
removeDirSync(directory: string): void;
|
|
257
259
|
mkdir(directory: string): Promise<void>;
|
|
258
260
|
mkdirSync(directory: string): void;
|
|
259
261
|
}
|
|
@@ -332,7 +334,7 @@ declare class Command<Ctx extends ListrContext = ListrContext, Flags extends Rec
|
|
|
332
334
|
* Deconstruct the class if you dont want to extend finally or catch.
|
|
333
335
|
*/
|
|
334
336
|
shouldRunAfter(_ctx?: Ctx): void | Promise<void>;
|
|
335
|
-
run
|
|
337
|
+
run(): Promise<any>;
|
|
336
338
|
_run<T>(): Promise<T | undefined>;
|
|
337
339
|
exit(code?: number): void;
|
|
338
340
|
/** Run all tasks from task manager. */
|
|
@@ -382,7 +384,7 @@ declare class ConfigCommand<CommandChoices extends string = string, LockFile = a
|
|
|
382
384
|
annotation(text: string, annotation: string): void;
|
|
383
385
|
flush(ms?: number): Promise<void>;
|
|
384
386
|
};
|
|
385
|
-
run
|
|
387
|
+
run(): Promise<any>;
|
|
386
388
|
setup(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
|
|
387
389
|
protected table(...options: Parameters<typeof CliUx.ux.table>): void;
|
|
388
390
|
protected select(): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -535,14 +535,28 @@ var FileSystemService = class {
|
|
|
535
535
|
try {
|
|
536
536
|
await import_fs_extra.default.emptyDir(directory);
|
|
537
537
|
} catch (e) {
|
|
538
|
-
throw new Error(`Error while
|
|
538
|
+
throw new Error(`Error while emptying the directory "${directory}": ${e.message}`);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
emptyDirSync(directory) {
|
|
542
542
|
try {
|
|
543
543
|
import_fs_extra.default.emptyDirSync(directory);
|
|
544
544
|
} catch (e) {
|
|
545
|
-
throw new Error(`Error while
|
|
545
|
+
throw new Error(`Error while emptying the directory "${directory}": ${e.message}`);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
async removeDir(directory) {
|
|
549
|
+
try {
|
|
550
|
+
await import_fs_extra.default.rmdir(directory);
|
|
551
|
+
} catch (e) {
|
|
552
|
+
throw new Error(`Error while removing the directory "${directory}": ${e.message}`);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
removeDirSync(directory) {
|
|
556
|
+
try {
|
|
557
|
+
import_fs_extra.default.rmdirSync(directory);
|
|
558
|
+
} catch (e) {
|
|
559
|
+
throw new Error(`Error while removing the directory "${directory}": ${e.message}`);
|
|
546
560
|
}
|
|
547
561
|
}
|
|
548
562
|
async mkdir(directory) {
|
|
@@ -842,30 +856,28 @@ var LockerService = class {
|
|
|
842
856
|
}
|
|
843
857
|
async lock(...data) {
|
|
844
858
|
let lock = await this.tryRead() ?? {};
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
parsed = merge(d.merge, import_object_path_immutable2.default.get(lock, path) || Array.isArray(d.data) ? [] : {}, d.data);
|
|
857
|
-
} else {
|
|
858
|
-
this.logger.warn('"%s" path with type "%s" is not mergeable.', path, typeof d.data);
|
|
859
|
-
parsed = d.data;
|
|
860
|
-
}
|
|
861
|
-
lock = import_object_path_immutable2.default.set(lock, path, parsed);
|
|
862
|
-
this.logger.verbose("Merge lock: %s -> %o", path, parsed);
|
|
859
|
+
data.forEach((d) => {
|
|
860
|
+
if (d?.enabled === false) {
|
|
861
|
+
return;
|
|
862
|
+
} else if (!d?.data || Array.isArray(d?.data) && d.data.length === 0 || typeof d?.data === "object" && Object.keys(d.data).length === 0) {
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
const path = this.buildPath(d);
|
|
866
|
+
if (d?.merge) {
|
|
867
|
+
let parsed;
|
|
868
|
+
if (typeof d.data === "object") {
|
|
869
|
+
parsed = merge(d.merge, import_object_path_immutable2.default.get(lock, path) || Array.isArray(d.data) ? [] : {}, d.data);
|
|
863
870
|
} else {
|
|
864
|
-
|
|
865
|
-
|
|
871
|
+
this.logger.warn('"%s" path with type "%s" is not mergeable.', path, typeof d.data);
|
|
872
|
+
parsed = d.data;
|
|
866
873
|
}
|
|
867
|
-
|
|
868
|
-
|
|
874
|
+
lock = import_object_path_immutable2.default.set(lock, path, parsed);
|
|
875
|
+
this.logger.verbose("Merge lock: %s -> %o", path, parsed);
|
|
876
|
+
} else {
|
|
877
|
+
lock = import_object_path_immutable2.default.set(lock, path, d.data);
|
|
878
|
+
this.logger.verbose("Override lock: %s -> %o", path, d.data);
|
|
879
|
+
}
|
|
880
|
+
});
|
|
869
881
|
await this.write(lock);
|
|
870
882
|
}
|
|
871
883
|
async unlock(...data) {
|
|
@@ -875,16 +887,14 @@ var LockerService = class {
|
|
|
875
887
|
return;
|
|
876
888
|
}
|
|
877
889
|
if (data.length > 0) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
})
|
|
887
|
-
);
|
|
890
|
+
data.forEach((d) => {
|
|
891
|
+
if (d?.enabled === false) {
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
const path = this.buildPath(d);
|
|
895
|
+
lock = import_object_path_immutable2.default.del(lock, path);
|
|
896
|
+
this.logger.verbose("Unlocked: %s", path);
|
|
897
|
+
});
|
|
888
898
|
} else {
|
|
889
899
|
lock = import_object_path_immutable2.default.del(lock, this.root);
|
|
890
900
|
this.logger.verbose("Unlocked module: %s", this.root);
|
|
@@ -1040,7 +1050,7 @@ var Command = class extends import_core3.Command {
|
|
|
1040
1050
|
this.args = {};
|
|
1041
1051
|
}
|
|
1042
1052
|
static get globalFlags() {
|
|
1043
|
-
return { CLI_FLAGS, ...this._globalFlags };
|
|
1053
|
+
return { ...CLI_FLAGS, ...this._globalFlags };
|
|
1044
1054
|
}
|
|
1045
1055
|
static set globalFlags(flags) {
|
|
1046
1056
|
this._globalFlags = Object.assign({}, this.globalFlags, flags);
|