Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies updates, only import necessary Lodash functions and upda… #146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,724 changes: 1,039 additions & 3,685 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mup-aws-beanstalk",
"version": "0.7.0",
"version": "0.7.1",
"description": "Deploy apps to AWS Elastic Beanstalk using Meteor Up",
"main": "index.js",
"scripts": {
Expand All @@ -21,33 +21,35 @@
"devDependencies": {
"@babel/cli": "^7.15.7",
"@babel/core": "^7.15.5",
"@babel/eslint-parser": "^7.15.8",
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
"@babel/plugin-transform-modules-commonjs": "^7.15.4",
"babel-eslint": "^10.1.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.0",
"gfm-code-blocks": "^1.0.0",
"mocha": "^8.0.1",
"mocha": "^9.1.3",
"mup": "^1.5.4",
"shelljs": "^0.8.4"
},
"dependencies": {
"@hapi/joi": "^15.1.1",
"archiver": "^4.0.2",
"archiver": "^5.3.0",
"aws-sdk": "^2.991.0",
"axios": "^0.21.4",
"axios": "^0.23.0",
"babel-polyfill": "^6.26.0",
"chalk": "^2.3.0",
"ejs": "^2.5.7",
"lodash": "^4.17.21",
"chalk": "^4.1.2",
"ejs": "^3.1.6",
"joi": "^17.4.2",
"lodash.difference": "^4.5.0",
"lodash.isequal": "^4.5.0",
"lodash.round": "^4.0.4",
"random-seed": "^0.3.0",
"shell-escape": "^0.2.0",
"ssh2": "^1.4.0",
"uuid": "^3.1.0"
"uuid": "^8.3.2"
}
}
2 changes: 1 addition & 1 deletion src/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function configure({ auth, name, region }) {
region: region || 'us-east-1',
maxRetries: 25,
retryDelayOptions: {
customBackoff: retryCount => Math.min((2 ** retryCount * 1000), MAX_RETRY_DELAY)
customBackoff: (retryCount) => Math.min((2 ** retryCount * 1000), MAX_RETRY_DELAY)
}
};

Expand Down
23 changes: 11 additions & 12 deletions src/command-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
oldVersions,
oldEnvVersions
} from './versions';
import { createEnvFile } from './env-settings';
import createEnvFile from './env-settings';
import {
createDesiredConfig,
prepareUpdateEnvironment,
Expand Down Expand Up @@ -136,7 +136,7 @@ export async function setup(api) {
Applications
} = await beanstalk.describeApplications().promise();

if (!Applications.find(app => app.ApplicationName === appName)) {
if (!Applications.find((app) => app.ApplicationName === appName)) {
const params = {
ApplicationName: appName,
Description: `App "${appConfig.name}" managed by Meteor Up`
Expand All @@ -150,9 +150,9 @@ export async function setup(api) {
logStep('=> Ensuring Graceful Shutdown is setup');

const existingBucket = findBucketWithPrefix(Buckets, trailBucketPrefix);
const trailBucketName = existingBucket ?
existingBucket.Name :
createUniqueName(trailBucketPrefix);
const trailBucketName = existingBucket
? existingBucket.Name
: createUniqueName(trailBucketPrefix);
const region = appConfig.region || 'us-east-1';
const accountId = await getAccountId();
const policy = trailBucketPolicy(accountId, trailBucketName);
Expand Down Expand Up @@ -219,13 +219,12 @@ export async function deploy(api) {
environment
} = names(config);


const version = await largestVersion(api);
const nextVersion = version + 1;

// Mutates the config, so the meteor.build command will have the correct build location
config.app.buildOptions.buildLocation = config.app.buildOptions.buildLocation ||
tmpBuildPath(config.app.path, api);
config.app.buildOptions.buildLocation = config.app.buildOptions.buildLocation
|| tmpBuildPath(config.app.path, api);

const bundlePath = api.resolvePath(config.app.buildOptions.buildLocation, 'bundle.zip');
const willBuild = shouldRebuild(bundlePath, api.getOptions()['cached-build']);
Expand Down Expand Up @@ -461,7 +460,7 @@ export async function reconfig(api) {
environment,
bucket
} = names(config);
const deploying = !!api.commandHistory.find(entry => entry.name === 'beanstalk.deploy');
const deploying = !!api.commandHistory.find((entry) => entry.name === 'beanstalk.deploy');

logStep('=> Configuring Beanstalk environment');

Expand All @@ -473,7 +472,7 @@ export async function reconfig(api) {
EnvironmentNames: [environment]
}).promise();

if (!Environments.find(env => env.Status !== 'Terminated')) {
if (!Environments.find((env) => env.Status !== 'Terminated')) {
const desiredEbConfig = createDesiredConfig(
api.getConfig(),
api.getSettings(),
Expand Down Expand Up @@ -556,7 +555,7 @@ export async function events(api) {
EnvironmentName: environment
}).promise();

console.log(envEvents.map(ev => `${ev.EventDate}: ${ev.Message}`).join('\n'));
console.log(envEvents.map((ev) => `${ev.EventDate}: ${ev.Message}`).join('\n'));
}

export async function status(api) {
Expand Down Expand Up @@ -602,7 +601,7 @@ export async function status(api) {
console.log(`Health Status: ${coloredStatusText(result.Color, result.HealthStatus)}`);
if (result.Causes.length > 0) {
console.log('Causes: ');
result.Causes.forEach(cause => console.log(` ${cause}`));
result.Causes.forEach((cause) => console.log(` ${cause}`));
}
console.log('');
console.log(`=== Metrics For Last ${Duration || 'Unknown'} Minutes ===`);
Expand Down
1 change: 0 additions & 1 deletion src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export const logsEb = {
handler: prepare(commandHandlers.logsEb)
};


export const start = {
description: 'Start app',
handler: prepare(commandHandlers.start)
Expand Down
14 changes: 7 additions & 7 deletions src/eb-config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { difference } from 'lodash';
import difference from 'lodash.difference';
import { beanstalk } from './aws';
import downloadEnvFile from './download';
import { createEnvFile } from './env-settings';
import createEnvFile from './env-settings';
import { uploadEnvFile } from './upload';
import { names } from './utils';
import { largestEnvVersion } from './versions';
Expand Down Expand Up @@ -123,7 +123,7 @@ export function createDesiredConfig(mupConfig, settings, longEnvVarsVersion) {
});
}

const customOptions = customBeanstalkConfig.map(option => ({
const customOptions = customBeanstalkConfig.map((option) => ({
Namespace: option.namespace,
OptionName: option.option,
Value: option.value
Expand Down Expand Up @@ -153,8 +153,8 @@ export function scalingConfigChanged(currentConfig, mupConfig) {
}
});

return currentMinInstances !== minInstances.toString() ||
currentMaxInstances !== maxInstances.toString();
return currentMinInstances !== minInstances.toString()
|| currentMaxInstances !== maxInstances.toString();
}

export function scalingConfig({ minInstances, maxInstances }) {
Expand Down Expand Up @@ -196,7 +196,7 @@ export function diffConfig(current, desired) {
desired = desired.reduce(convertToObject, {});

const toRemove = difference(Object.keys(current), Object.keys(desired))
.filter(key => key.indexOf('aws:elasticbeanstalk:application:environment-') === 0)
.filter((key) => key.indexOf('aws:elasticbeanstalk:application:environment-') === 0)
.map((key) => {
const option = current[key];
return {
Expand All @@ -211,7 +211,7 @@ export function diffConfig(current, desired) {
}

return true;
}).map(key => desired[key]);
}).map((key) => desired[key]);

return {
toRemove,
Expand Down
4 changes: 2 additions & 2 deletions src/env-settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import shellEscape from 'shell-escape';

export function createEnvFile(env, settings) {
export default function createEnvFile(env, settings) {
let content = '';
const settingsString = encodeURIComponent(JSON.stringify(settings));

Expand All @@ -10,5 +10,5 @@ export function createEnvFile(env, settings) {
});

content += `export METEOR_SETTINGS_ENCODED=${shellEscape([settingsString])}`;
return content
return content;
}
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const commands = _commands;

export const validate = {
app(config, utils) {
if (config.app && config.app.type === 'aws-beanstalk') {
if (config.app?.type === 'aws-beanstalk') {
return validator(config, utils);
}

Expand Down Expand Up @@ -45,7 +45,7 @@ export function prepareConfig(config) {
function isBeanstalkApp(api) {
const config = api.getConfig();

if (config.app && config.app.type === 'aws-beanstalk') {
if (config.app?.type === 'aws-beanstalk') {
return true;
}

Expand Down
7 changes: 3 additions & 4 deletions src/prepare-bundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import archiver from 'archiver';
import fs from 'fs';
import ejs from 'ejs';
import { round } from 'lodash';
import round from 'lodash.round';
import { getNodeVersion, logStep, names } from './utils';

function copy(source, destination, vars = {}) {
Expand All @@ -13,7 +13,7 @@ function copy(source, destination, vars = {}) {
...vars,
padScript(content, spaces) {
const padding = ''.padStart(spaces, ' ');
return content.split('\n').map(line => padding + line).join('\n');
return content.split('\n').map((line) => padding + line).join('\n');
}
},
{
Expand All @@ -30,7 +30,7 @@ export function injectFiles(api, name, version, appConfig) {
forceSSL,
gracefulShutdown,
buildOptions,
longEnvVars,
// longEnvVars,
path
} = appConfig;
const bundlePath = buildOptions.buildLocation;
Expand Down Expand Up @@ -70,7 +70,6 @@ export function injectFiles(api, name, version, appConfig) {
}
});


// For some resources we make two copies of scripts:
// 1) In .platform/hooks. These are used in AWS Linux 2
// 2) as part of a config file in .ebextensions for older platforms
Expand Down
2 changes: 1 addition & 1 deletion src/upload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import shellEscape from 'shell-escape';
// import shellEscape from 'shell-escape';
import { s3 } from './aws';

export default function upload(appConfig, bucket, key, bundlePath) {
Expand Down
Loading