Skip to content

Commit 7a77672

Browse files
committed
Use rimraf for rm -rf in fleetctl NPM install (#310)
Ubuntu 20.04 uses an older version of Node by default that does not support the rmSync method we were using previously. This should extend compatibility.
1 parent 278d1b1 commit 7a77672

File tree

3 files changed

+85
-3
lines changed

3 files changed

+85
-3
lines changed

tools/fleetctl-npm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"homepage": "https://fleetdm.com",
1818
"dependencies": {
1919
"axios": "0.21.1",
20+
"rimraf": "3.0.2",
2021
"tar": "6.1.0"
2122
},
2223
"keywords": [

tools/fleetctl-npm/run.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env node
22

3+
const child = require('child_process');
4+
const fs = require('fs');
35
const os = require('os');
46
const path = require('path');
5-
const fs = require('fs');
6-
const child = require('child_process');
77

88
const axios = require('axios');
9+
const rimraf = require('rimraf');
910
const tar = require('tar');
1011

1112
const { version } = require('./package.json');
@@ -56,7 +57,8 @@ const install = async () => {
5657

5758
const run = async () => {
5859
if (!fs.existsSync(binPath)) {
59-
fs.rmSync(binDir, { recursive: true, force: true });
60+
// Remove any existing binaries before installing the new one.
61+
rimraf.sync(binDir);
6062
console.log(`Installing fleetctl ${version}...`);
6163
try {
6264
await install();

tools/fleetctl-npm/yarn.lock

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,29 @@ [email protected]:
99
dependencies:
1010
follow-redirects "^1.10.0"
1111

12+
balanced-match@^1.0.0:
13+
version "1.0.0"
14+
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
15+
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
16+
17+
brace-expansion@^1.1.7:
18+
version "1.1.11"
19+
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
20+
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
21+
dependencies:
22+
balanced-match "^1.0.0"
23+
concat-map "0.0.1"
24+
1225
chownr@^2.0.0:
1326
version "2.0.0"
1427
resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
1528
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==
1629

30+
31+
version "0.0.1"
32+
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
33+
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
34+
1735
follow-redirects@^1.10.0:
1836
version "1.13.2"
1937
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147"
@@ -26,6 +44,43 @@ fs-minipass@^2.0.0:
2644
dependencies:
2745
minipass "^3.0.0"
2846

47+
fs.realpath@^1.0.0:
48+
version "1.0.0"
49+
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
50+
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
51+
52+
glob@^7.1.3:
53+
version "7.1.6"
54+
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
55+
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
56+
dependencies:
57+
fs.realpath "^1.0.0"
58+
inflight "^1.0.4"
59+
inherits "2"
60+
minimatch "^3.0.4"
61+
once "^1.3.0"
62+
path-is-absolute "^1.0.0"
63+
64+
inflight@^1.0.4:
65+
version "1.0.6"
66+
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
67+
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
68+
dependencies:
69+
once "^1.3.0"
70+
wrappy "1"
71+
72+
inherits@2:
73+
version "2.0.4"
74+
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
75+
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
76+
77+
minimatch@^3.0.4:
78+
version "3.0.4"
79+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
80+
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
81+
dependencies:
82+
brace-expansion "^1.1.7"
83+
2984
minipass@^3.0.0:
3085
version "3.1.3"
3186
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd"
@@ -46,6 +101,25 @@ mkdirp@^1.0.3:
46101
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
47102
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
48103

104+
once@^1.3.0:
105+
version "1.4.0"
106+
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
107+
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
108+
dependencies:
109+
wrappy "1"
110+
111+
path-is-absolute@^1.0.0:
112+
version "1.0.1"
113+
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
114+
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
115+
116+
117+
version "3.0.2"
118+
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
119+
integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
120+
dependencies:
121+
glob "^7.1.3"
122+
49123
50124
version "6.1.0"
51125
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.0.tgz#d1724e9bcc04b977b18d5c573b333a2207229a83"
@@ -58,6 +132,11 @@ [email protected]:
58132
mkdirp "^1.0.3"
59133
yallist "^4.0.0"
60134

135+
wrappy@1:
136+
version "1.0.2"
137+
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
138+
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
139+
61140
yallist@^4.0.0:
62141
version "4.0.0"
63142
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"

0 commit comments

Comments
 (0)