@villedemontreal/general-utils 5.17.0 → 5.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@villedemontreal/general-utils",
3
- "version": "5.17.0",
3
+ "version": "5.17.2",
4
4
  "description": "General utilities library",
5
5
  "main": "dist/src/index.js",
6
6
  "engines": {
@@ -38,36 +38,35 @@
38
38
  "author": "Ville de Montréal",
39
39
  "license": "MIT",
40
40
  "dependencies": {
41
- "@types/app-root-path": "1.2.4",
42
- "@types/lodash": "4.14.184",
43
- "@types/luxon": "2.3.2",
44
- "@types/rimraf": "3.0.2",
41
+ "@types/app-root-path": "1.2.6",
42
+ "@types/lodash": "4.14.199",
43
+ "@types/luxon": "3.3.2",
45
44
  "app-root-path": "3.1.0",
46
45
  "get-port": "5.1.1",
47
- "globby": "13.1.2",
46
+ "globby": "13.2.2",
48
47
  "http-status-codes": "2.2.0",
49
48
  "lodash": "4.17.21",
50
- "luxon": "2.5.2",
49
+ "luxon": "3.4.3",
51
50
  "moment": "2.29.4",
52
- "rimraf": "3.0.2",
51
+ "rimraf": "5.0.5",
53
52
  "tsconfig-extends": "1.0.1"
54
53
  },
55
54
  "devDependencies": {
56
- "@types/chai": "4.3.3",
55
+ "@types/chai": "4.3.6",
57
56
  "@types/fs-extra": "9.0.13",
58
57
  "@types/mocha": "9.1.1",
59
58
  "@types/node": "16.x",
60
- "@types/sinon": "10.0.13",
61
- "@types/uuid": "8.3.4",
59
+ "@types/sinon": "10.0.18",
60
+ "@types/uuid": "9.0.4",
62
61
  "@villedemontreal/lint-config": "1.7.7",
63
- "chai": "4.3.6",
62
+ "chai": "4.3.10",
64
63
  "fs-extra": "10.1.0",
65
64
  "mocha": "9.2.2",
66
65
  "mocha-jenkins-reporter": "0.4.7",
67
- "sinon": "13.0.2",
66
+ "sinon": "16.0.0",
68
67
  "source-map-support": "0.5.21",
69
68
  "ts-node": "^10.9.1",
70
- "typescript": "4.8.2",
71
- "uuid": "8.3.2"
69
+ "typescript": "5.2.2",
70
+ "uuid": "9.0.1"
72
71
  }
73
72
  }
@@ -1,6 +1,6 @@
1
1
  import { assert } from 'chai';
2
- import * as _ from 'lodash';
3
- import * as moment from 'moment';
2
+ import _ from 'lodash';
3
+ import moment from 'moment';
4
4
  import { getValueDescription, getValueDescriptionWithType, utils } from '.';
5
5
  import { getCartesianProduct } from './collectionUtils';
6
6
  import {
package/src/dateUtils.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as _ from 'lodash';
1
+ import _ from 'lodash';
2
2
  import { DateTime, Zone } from 'luxon';
3
- import * as moment from 'moment';
3
+ import moment from 'moment';
4
4
  // tslint:disable-next-line:no-duplicate-imports
5
5
  import { Moment } from 'moment';
6
6
  import { getValueDescription, utils } from '.';
package/src/utils.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { spawn, StdioOptions } from 'child_process';
2
2
  import * as fs from 'fs';
3
- import * as getPort from 'get-port';
4
- import * as _ from 'lodash';
3
+ import getPort from 'get-port';
4
+ import _ from 'lodash';
5
5
  import * as pathUtils from 'path';
6
- import * as rimraf from 'rimraf';
6
+ import { rimraf } from 'rimraf';
7
7
  import * as tsconfig from 'tsconfig-extends';
8
8
  import { constants } from './config/constants';
9
9
 
@@ -202,16 +202,12 @@ export class Utils {
202
202
  *
203
203
  * You can't delete a root file using this function.
204
204
  */
205
- public async deleteFile(filePath: string) {
205
+ public deleteFile(filePath: string) {
206
206
  if (!this.isSafeToDelete(filePath)) {
207
207
  throw new Error("Unsafe file to delete. A file to delete can't be at the root.");
208
208
  }
209
209
 
210
- return new Promise<void>((resolve, reject) => {
211
- rimraf(filePath, () => {
212
- resolve();
213
- });
214
- });
210
+ return rimraf(filePath);
215
211
  }
216
212
 
217
213
  /**
@@ -225,24 +221,16 @@ export class Utils {
225
221
  throw new Error("Unsafe dir to delete. A dir to delete can't be at the root.");
226
222
  }
227
223
 
228
- return new Promise<void>(async (resolve, reject) => {
229
- try {
230
- rimraf(dirPath, () => {
231
- resolve();
232
- });
233
- } catch (err) {
234
- // ==========================================
235
- // Try recursively as rimraf may sometimes
236
- // fail in infrequent situations...
237
- // ==========================================
238
- await this.clearDir(dirPath);
239
- await new Promise<void>((resolve2, reject2) => {
240
- rimraf(dirPath, () => {
241
- resolve2();
242
- });
243
- });
244
- }
245
- });
224
+ try {
225
+ return rimraf(dirPath);
226
+ } catch (err) {
227
+ // ==========================================
228
+ // Try recursively as rimraf may sometimes
229
+ // fail in infrequent situations...
230
+ // ==========================================
231
+ await this.clearDir(dirPath);
232
+ return rimraf(dirPath);
233
+ }
246
234
  }
247
235
 
248
236
  /**