Skip to content

Commit

Permalink
Updated to latest sdk. Security Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jdillick committed May 3, 2024
1 parent 3316fce commit 21ec80a
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 755 deletions.
6 changes: 3 additions & 3 deletions bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ora from 'ora';
import Actinium from 'parse/node.js';
import handlebars from 'handlebars';
import Hook from '@atomic-reactor/reactium-sdk-core/lib/sdks/hook/index.js';
import * as SDK from '@atomic-reactor/reactium-sdk-core/core';
import path from 'node:path';
import crypto from 'node:crypto';
import { fileURLToPath } from 'node:url';
Expand All @@ -21,7 +21,6 @@ import generator from './lib/generator.js';
import table from 'text-table';
import * as tar from 'tar';
import slugify from 'slugify';
import request from 'request';
import DeleteEmpty from 'delete-empty';
import ActionSequence from 'action-sequence';
import inquirer from 'inquirer';
Expand All @@ -33,6 +32,7 @@ import * as AuthSDK from './lib/auth.js';
import { useSpinner } from './lib/useSpinner.js';
import targetApp from './lib/targetApp.js';

const Hook = SDK.Hook;
const normalizePath = (...args) => path.normalize(path.join(...args));

const root = path.dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -219,7 +219,6 @@ const bootstrap = async () => {
prettier,
prompt,
props,
request,
root,
rootCommands,
runCommand,
Expand All @@ -230,6 +229,7 @@ const bootstrap = async () => {
targetApp,
tmp: normalizePath(homedir, 'tmp'),
useSpinner,
SDK,
};

// Build the props object
Expand Down
7 changes: 4 additions & 3 deletions commands/init/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const PAYLOAD = {
};

export default spinner => {
const { path, chalk, decompress, fs, op, request } = arcli;
const { path, chalk, decompress, fs, op, axios } = arcli;

const message = text => {
if (spinner) {
Expand Down Expand Up @@ -48,8 +48,8 @@ export default spinner => {

// Download
return new Promise((resolve, reject) => {
request(URL)
.pipe(
axios(URL, { responseType: 'stream' }).then(({ data }) => {
data.pipe(
fs.createWriteStream(
normalize(cwd, 'tmp', 'package.zip'),
),
Expand All @@ -60,6 +60,7 @@ export default spinner => {
process.exit();
})
.on('close', () => resolve({ action, status: 200 }));
})
});
},

Expand Down
15 changes: 10 additions & 5 deletions commands/package/install/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default spinner => {
globby,
op,
path,
request,
axios,
tar,
useSpinner,
} = arcli;
Expand Down Expand Up @@ -138,10 +138,15 @@ export default spinner => {

// Pipe download to tmp path
return new Promise((resolve, reject) =>
request(plugin.file.url())
.pipe(fs.createWriteStream(filepath))
.on('error', error => reject(error))
.on('close', () => resolve({ action, status: 200 })),
axios(plugin.file.url(), { responseType: 'stream' }).then(
({ data }) => {
data.pipe(fs.createWriteStream(filepath))
.on('error', error => reject(error))
.on('close', () =>
resolve({ action, status: 200 }),
);
},
),
);
},
extract: async () => {
Expand Down
1 change: 0 additions & 1 deletion commands/update/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default spinner => {
fs,
semver,
op,
request,
inquirer,
} = arcli;

Expand Down
Loading

0 comments on commit 21ec80a

Please sign in to comment.