Skip to content

Commit 21ec80a

Browse files
committed
Updated to latest sdk. Security Updates
1 parent 3316fce commit 21ec80a

File tree

6 files changed

+103
-755
lines changed

6 files changed

+103
-755
lines changed

bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ora from 'ora';
22
import Actinium from 'parse/node.js';
33
import handlebars from 'handlebars';
4-
import Hook from '@atomic-reactor/reactium-sdk-core/lib/sdks/hook/index.js';
4+
import * as SDK from '@atomic-reactor/reactium-sdk-core/core';
55
import path from 'node:path';
66
import crypto from 'node:crypto';
77
import { fileURLToPath } from 'node:url';
@@ -21,7 +21,6 @@ import generator from './lib/generator.js';
2121
import table from 'text-table';
2222
import * as tar from 'tar';
2323
import slugify from 'slugify';
24-
import request from 'request';
2524
import DeleteEmpty from 'delete-empty';
2625
import ActionSequence from 'action-sequence';
2726
import inquirer from 'inquirer';
@@ -33,6 +32,7 @@ import * as AuthSDK from './lib/auth.js';
3332
import { useSpinner } from './lib/useSpinner.js';
3433
import targetApp from './lib/targetApp.js';
3534

35+
const Hook = SDK.Hook;
3636
const normalizePath = (...args) => path.normalize(path.join(...args));
3737

3838
const root = path.dirname(fileURLToPath(import.meta.url));
@@ -219,7 +219,6 @@ const bootstrap = async () => {
219219
prettier,
220220
prompt,
221221
props,
222-
request,
223222
root,
224223
rootCommands,
225224
runCommand,
@@ -230,6 +229,7 @@ const bootstrap = async () => {
230229
targetApp,
231230
tmp: normalizePath(homedir, 'tmp'),
232231
useSpinner,
232+
SDK,
233233
};
234234

235235
// Build the props object

commands/init/actions.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const PAYLOAD = {
1515
};
1616

1717
export default spinner => {
18-
const { path, chalk, decompress, fs, op, request } = arcli;
18+
const { path, chalk, decompress, fs, op, axios } = arcli;
1919

2020
const message = text => {
2121
if (spinner) {
@@ -48,8 +48,8 @@ export default spinner => {
4848

4949
// Download
5050
return new Promise((resolve, reject) => {
51-
request(URL)
52-
.pipe(
51+
axios(URL, { responseType: 'stream' }).then(({ data }) => {
52+
data.pipe(
5353
fs.createWriteStream(
5454
normalize(cwd, 'tmp', 'package.zip'),
5555
),
@@ -60,6 +60,7 @@ export default spinner => {
6060
process.exit();
6161
})
6262
.on('close', () => resolve({ action, status: 200 }));
63+
})
6364
});
6465
},
6566

commands/package/install/actions.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default spinner => {
1515
globby,
1616
op,
1717
path,
18-
request,
18+
axios,
1919
tar,
2020
useSpinner,
2121
} = arcli;
@@ -138,10 +138,15 @@ export default spinner => {
138138

139139
// Pipe download to tmp path
140140
return new Promise((resolve, reject) =>
141-
request(plugin.file.url())
142-
.pipe(fs.createWriteStream(filepath))
143-
.on('error', error => reject(error))
144-
.on('close', () => resolve({ action, status: 200 })),
141+
axios(plugin.file.url(), { responseType: 'stream' }).then(
142+
({ data }) => {
143+
data.pipe(fs.createWriteStream(filepath))
144+
.on('error', error => reject(error))
145+
.on('close', () =>
146+
resolve({ action, status: 200 }),
147+
);
148+
},
149+
),
145150
);
146151
},
147152
extract: async () => {

commands/update/actions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default spinner => {
2121
fs,
2222
semver,
2323
op,
24-
request,
2524
inquirer,
2625
} = arcli;
2726

0 commit comments

Comments
 (0)