Fixing broken release (#6)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mep-agency/local-dev-db",
|
"name": "@mep-agency/local-dev-db",
|
||||||
"version": "1.0.0-alpha11",
|
"version": "1.0.0-alpha12",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A zero-config local MariaDB instance for local development (using Docker)",
|
"description": "A zero-config local MariaDB instance for local development (using Docker)",
|
||||||
"author": "Marco Lipparini <developer@liarco.net>",
|
"author": "Marco Lipparini <developer@liarco.net>",
|
||||||
|
|||||||
33
src/index.ts
33
src/index.ts
@@ -6,7 +6,7 @@ import mysql from 'mysql';
|
|||||||
|
|
||||||
import config from './config';
|
import config from './config';
|
||||||
|
|
||||||
const PACKAGE_INSTALLATION_PATH = `${__dirname}/../..`;
|
const LDD_ROOT_PATH = `${__dirname}/..`;
|
||||||
|
|
||||||
interface DockerImagesCommandResult {
|
interface DockerImagesCommandResult {
|
||||||
images: {
|
images: {
|
||||||
@@ -21,7 +21,7 @@ interface DockerImagesCommandResult {
|
|||||||
const dockerCompose: typeof dockerCommand = async (command, options) => {
|
const dockerCompose: typeof dockerCommand = async (command, options) => {
|
||||||
try {
|
try {
|
||||||
return await dockerCommand(
|
return await dockerCommand(
|
||||||
`compose --file "${PACKAGE_INSTALLATION_PATH}/docker/docker-compose.yml" --project-name "ldd" ${command}`,
|
`compose --file "${LDD_ROOT_PATH}/docker/docker-compose.yml" --project-name "ldd" ${command}`,
|
||||||
{ echo: false, ...(options ?? {}) },
|
{ echo: false, ...(options ?? {}) },
|
||||||
);
|
);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
@@ -83,18 +83,27 @@ program
|
|||||||
`phpmyadmin:${process.env.LDD_PMA_IMAGE_TAG ?? 'latest'}`,
|
`phpmyadmin:${process.env.LDD_PMA_IMAGE_TAG ?? 'latest'}`,
|
||||||
];
|
];
|
||||||
|
|
||||||
const availableImagesImages = ((await dockerCommand('images', { echo: false })) as DockerImagesCommandResult).images
|
try {
|
||||||
.map((imageData) => `${imageData.repository}:${imageData.tag}`)
|
const availableImagesImages = ((await dockerCommand('images', { echo: false })) as DockerImagesCommandResult).images
|
||||||
.filter((imageName) => requiredImages.includes(imageName));
|
.map((imageData) => `${imageData.repository}:${imageData.tag}`)
|
||||||
|
.filter((imageName) => requiredImages.includes(imageName));
|
||||||
|
|
||||||
const missingImages = requiredImages.filter((requiredImage) => !availableImagesImages.includes(requiredImage));
|
const missingImages = requiredImages.filter((requiredImage) => !availableImagesImages.includes(requiredImage));
|
||||||
|
|
||||||
if (missingImages.length > 0) {
|
if (missingImages.length > 0) {
|
||||||
console.info('');
|
console.info('');
|
||||||
console.info('The following images will be downloaded as they are required but not available:');
|
console.info('The following images will be downloaded as they are required but not available:');
|
||||||
missingImages.map((image) => console.info(` - ${image}`));
|
missingImages.map((image) => console.info(` - ${image}`));
|
||||||
console.info('');
|
console.info('');
|
||||||
console.info('This may take some time, please wait...');
|
console.info('This may take some time, please wait...');
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
if (e.stderr === undefined) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(`ERROR: ${e.stderr}`);
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
await dockerCompose('up -d');
|
await dockerCompose('up -d');
|
||||||
|
|||||||
Reference in New Issue
Block a user