Skip to content

Commit

Permalink
Merge pull request #25 from nicodoggie/master
Browse files Browse the repository at this point in the history
CVE-2020-28500: Updating lodash package, bump to 4.4.4
  • Loading branch information
nicodoggie authored May 5, 2023
2 parents f872e3a + 34687f0 commit 28c7b75
Show file tree
Hide file tree
Showing 6 changed files with 7,401 additions and 4,367 deletions.
Binary file added .yarn/install-state.gz
Binary file not shown.
876 changes: 876 additions & 0 deletions .yarn/releases/yarn-4.0.0-rc.43.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-4.0.0-rc.43.cjs
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"name": "@splitmedialabs/devctl",
"version": "4.4.2",
"version": "4.4.4",
"author": "Makara Sok",
"description": "Easily start developing in monorepos with docker-compose",
"main": "dist/cli.js",
"bin": {
"devctl": "./bin/devctl.js"
},
"bin": "./bin/devctl.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf dist/",
Expand Down Expand Up @@ -59,8 +57,8 @@
"rimraf": "^4.1.2",
"typescript": "^4.6.3"
},

"volta": {
"node": "16.18.1"
}
},
"packageManager": "[email protected]"
}
87 changes: 83 additions & 4 deletions src/commands/switch-env.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,91 @@
const YAML = require('js-yaml');
const { filesystem, prompt } = require('@cipherstash/gluegun');
const get = require('lodash/get');
const getDockerHost = require('../utils/getDockerHost');

async function askEnvironment(project) {
if (Object.values(project.environment).length === 1) {
return {
environment: Object.values(project.environment)[0].name,
};
}

return await prompt.ask({
type: 'select',
name: 'environment',
message: 'Which environment do you want to use?',
choices: Object.values(project.environment).map((env) => ({
name: env.name,
message: env.name,
hint: env.description,
value: env.name,
})),
initial: get(project, 'current.environment', null),
});
}

async function askServices(project) {
const allChoices = Object.values(project.services)
.map((service) => ({
name: service.name,
message: service.name,
hint: service.description,
value: service.name,
category: service.category,
}))
.sort(function (a, b) {
const keyA = a.name.toLowerCase();
const keyB = b.name.toLowerCase();
if (keyA < keyB) return -1;
if (keyA > keyB) return 1;
return 0;
});

const choices = allChoices.filter((c) => c.category !== 'always');
const choicesArray = choices.map((c) => c.value);
const always = allChoices
.filter((c) => c.category === 'always')
.map((c) => c.value);

const initial = get(project, 'current.services', []).filter((c) =>
choicesArray.includes(c)
);

const { services } = await prompt.ask({
type: 'multiselect',
name: 'services',
message: 'Which services do you want to work on?',
choices,
initial,
});

return { services: [...services, ...always] };
}

async function saveCurrentConfig(path, config) {
return filesystem.write(path, YAML.dump(config));
}

module.exports = {
name: 'switch-env',
description: `Switch environments without running`,
hidden: true,
description: `Switch services and/or environment`,
run: async (toolbox) => {
await require('../cli.js').run('switch-current');
const project = toolbox.config;

const { services } = await askServices(project);

const { environment } = await askEnvironment(project);

const currentConfig = {
services,
environment,
dockerhost: '',
};

await saveCurrentConfig(project.paths.current, currentConfig);
await require('../cli.js').run('pull-secrets');
await require('../cli.js').run('compile');

process.exit(0);
return;
},
};
Loading

0 comments on commit 28c7b75

Please sign in to comment.