Compare commits
18 Commits
1.0.0-alph
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a5d6bcba6d | |||
| 35d1b9c4cc | |||
|
|
9395aecef4 | ||
|
|
602f25e619 | ||
|
|
ea1c908461 | ||
|
|
640bb325a9 | ||
|
|
1961d75eec | ||
|
|
0ec6b214cd | ||
|
|
dcc379607b | ||
|
|
ea39e4bad6 | ||
|
|
86ac444781 | ||
|
|
8e7703652e | ||
|
|
a53aab7ccf | ||
|
|
e8ce789943 | ||
|
|
0fc09fb3c7 | ||
|
|
473c3a4846 | ||
|
|
b572044439 | ||
|
|
cd101d6ba0 |
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -1,5 +1,5 @@
|
||||
name: Lint
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
||||
bin/@mep-agency
|
||||
build
|
||||
|
||||
# misc
|
||||
|
||||
87
README.md
87
README.md
@@ -5,22 +5,22 @@
|
||||
<span class="badge-npmversion"><a href="https://www.npmjs.com/package/@mep-agency/local-dev-db" title="View this project on NPM"><img src="https://img.shields.io/npm/v/%40mep-agency/local-dev-db" alt="NPM version" /></a></span>
|
||||
<span class="badge-npmdownloads"><a href="https://www.npmjs.com/package/@mep-agency/local-dev-db" title="View this project on NPM"><img src="https://img.shields.io/npm/dt/%40mep-agency/local-dev-db" alt="NPM downloads" /></a></span>
|
||||
|
||||
A zero-config local MariaDB instance for local development (using Docker) so you can finally stop doing things like:
|
||||
A zero-config local mariadb instance for local development (using Docker) so you can finally stop doing things like:
|
||||
|
||||
- Using SQLite for dev and MariaDB/MySQL for production
|
||||
- Installing a local database server directly
|
||||
- Spending a lot of time to get up and running on a new dev environment
|
||||
- Using different databases for dev and prod environments (e.g. SQLite vs mariadb/MariaDB)
|
||||
- Installing a local database server directly on your machine
|
||||
- Spending time getting up and running in a new development environment
|
||||
|
||||
## How does it fit your workflow?
|
||||
## How does it fit into your workflow?
|
||||
|
||||
While this tool is meant to be installed as a dependency to your projects, it actually runs as a single database server.
|
||||
This makes it possible to optimize the resources when working on multiple projects at the same time.
|
||||
While this tool is designed to be installed as a dependency in your projects, it actually runs as a single database server.
|
||||
This makes it possible to optimize resources when working on multiple projects at the same time.
|
||||
|
||||
Feel free to install this tool as a dependency to all of your projects, CLI commands will act on the same instance and all of your databases will share the same storage volume.
|
||||
Feel free to install this tool as a dependency in any project where you need a mariadb/MariaDB database, CLI commands will act on the same instance and all your databases will share the same storage volume.
|
||||
|
||||
## Features
|
||||
|
||||
- Runs a fully-featured MariaDB server without touching your local system
|
||||
- Runs a fully-featured mariadb server without touching your local system
|
||||
- Runs a PhpMyAdmin instance attached to the DB server so you can manage your databases with no additional software
|
||||
- Provides you with a simple set of CLI commands do run common tasks:
|
||||
- Create/drop databases and dedicated users
|
||||
@@ -30,6 +30,10 @@ Feel free to install this tool as a dependency to all of your projects, CLI comm
|
||||
|
||||
- **Docker:** this tool uses docker (compose) to spwan some containers for you. A basic default installation is usually more than enough (e.g. `brew install docker` or similar).
|
||||
|
||||
## Project lifecycle, contribution and support policy
|
||||
|
||||
Our policies are available on our [main oranization page](https://github.com/mep-agency#projects-lifecycle-contribution-and-support-policy).
|
||||
|
||||
## Original author
|
||||
|
||||
- Marco Lipparini ([liarco](https://github.com/liarco))
|
||||
@@ -41,21 +45,21 @@ Make sure Docker is installed and configured properly, the `docker` CLI must be
|
||||
Simply install the package using any package manager:
|
||||
|
||||
```bash
|
||||
# With Yarn
|
||||
$ yarn add --dev @mep-agency/local-dev-db
|
||||
|
||||
# With NPM
|
||||
$ npm install --save-dev @mep-agency/local-dev-db
|
||||
$ npm install --save-dev git+ssh@git.vascowhite.co.uk:paul/local-dev-db.git
|
||||
```
|
||||
|
||||
Run the `ldd` binary to see the available commands:
|
||||
|
||||
```bash
|
||||
# With Yarn
|
||||
$ yarn ldd --help
|
||||
Usage: ldd [options] [command]
|
||||
|
||||
A zero-config local MariaDB instance for local development (using Docker)
|
||||
# With NPM
|
||||
$ npx ldd
|
||||
|
||||
Usage: ldd [options] [command]
|
||||
# ...
|
||||
A zero-config local mariadb instance for local development (using Docker)
|
||||
|
||||
Options:
|
||||
-V, --version output the version number
|
||||
@@ -63,14 +67,9 @@ Options:
|
||||
|
||||
Commands:
|
||||
# ...
|
||||
|
||||
# With NPM
|
||||
$ npx ldd
|
||||
Usage: ldd [options] [command]
|
||||
# ...
|
||||
```
|
||||
|
||||
## Starting a new project
|
||||
### Starting a new project
|
||||
|
||||
Creating a brand new database for your project is pretty easy:
|
||||
|
||||
@@ -91,7 +90,7 @@ Username: my-awesome-app
|
||||
Password: my-awesome-app-pwd
|
||||
```
|
||||
|
||||
Our main focus is DX and speed, so don't expect any fancy configuration options or proper security. You can connect to the new database with simple default auth: `mysql://my-awesome-app:my-awesome-app-pwd@127.0.0.1:3306/my-awesome-app`.
|
||||
Our main focus is DX and speed, so don't expect any fancy configuration options or proper security. You can connect to the new database with simple default auth: `mariadb://my-awesome-app:my-awesome-app-pwd@127.0.0.1:3306/my-awesome-app`.
|
||||
|
||||
You can also connect to http://127.0.0.1:8010 to access a PhpMyAdmin instance attached to your server.
|
||||
|
||||
@@ -105,9 +104,47 @@ Stopping local database containers...
|
||||
|
||||
## Advanced configuration
|
||||
|
||||
We hope you never have to use it, but just in case, here are some ENV vars you can set on your machine to customize the behavior of the application:
|
||||
The goal of LDD is to speed up the process of setting up new projects and synchronizing a common system configuration across multiple environments. That's why we don't plan to support deep customization options.
|
||||
|
||||
- `LDD_DB_IMAGE_TAG` (default: `latest`): we use the official [MariaDB](https://hub.docker.com/_/mariadb) Docker image. You can pick a different tag if you wish.
|
||||
However, there are some common use cases that require a bit more flexibility, so the following features may help.
|
||||
|
||||
### Project config files
|
||||
|
||||
Each project usually requires its own database, and you will probably need to run most commands against it, depending on the project you are working on.
|
||||
|
||||
The closest available `ldd.json` file is used to load the configuration for the current project:
|
||||
|
||||
```json
|
||||
{
|
||||
"dbName": "my-awesome-app"
|
||||
}
|
||||
```
|
||||
|
||||
With the configuration above, any command will default to `my-awesome-app` as the `<db_name>` argument value if nothing is passed manually:
|
||||
|
||||
```bash
|
||||
$ yarn ldd create
|
||||
Loading configuration from: /MyProjects/my-awesome-app/ldd.json
|
||||
Creating a new DB named "my-awesome-app"...
|
||||
|
||||
# ...
|
||||
```
|
||||
|
||||
### ENV variables
|
||||
|
||||
We hope you never have to use them, but just in case, here are some ENV vars you can set on your machine to customize the behavior of the application:
|
||||
|
||||
#### Server behavior
|
||||
|
||||
- `LDD_SQL_MODE` (default: `"ANSI,ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES,ALLOW_INVALID_DATES"`): The SQL mode to use for the mariadb server.
|
||||
- `LDD_SQL_REQUIRE_PRIMARY_KEY` (default: `OFF`): Whether to require primary keys to be defined for each table.
|
||||
- `LDD_DEFAULT_STORAGE_ENGINE` (default: `InnoDB`): The default storage engine to use for the mariadb server.
|
||||
- `LDD_EXPLICIT_DEFAULTS_FOR_TIMESTAMP` (default: `ON`): Whether to use explicit defaults for timestamp columns.
|
||||
- `LDD_mariadb_NATIVE_PASSWORD` (default: `ON`): Whether to enable the native mariadb password hashing algorithm.
|
||||
|
||||
#### Advanced customization
|
||||
|
||||
- `LDD_DB_IMAGE_TAG` (default: `lts`): we use the official [mariadb](https://hub.docker.com/_/mariadb) Docker image. You can pick a different tag if you wish.
|
||||
- `LDD_DB_PORT` (default: `3306`): The database server will be attached to this port on your local machine. You can customize this to avoid any conflicts with other services.
|
||||
- `LDD_DB_ROOT_PASSWORD` (default: `not-secure-pwd`): This tool is not secure by design, so you should probably leave this untouched to avoid issues.
|
||||
- `LDD_PMA_IMAGE_TAG` (default: `latest`): we use the official [PhpMyAdmin](https://hub.docker.com/_/phpmyadmin) Docker image. You can pick a different tag if you wish.
|
||||
|
||||
6
bin/ldd
6
bin/ldd
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Inspired by https://github.com/yarnpkg/yarn/issues/3421#issuecomment-1399393547
|
||||
|
||||
echo "This file is just a stub; it is not meant to be executed.
|
||||
It will be replaced by the postinstall script with the binary for the target platform."
|
||||
3
bin/ldd.js
Executable file
3
bin/ldd.js
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import '../build/index.js';
|
||||
@@ -2,21 +2,28 @@ version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: "mariadb:${LDD_DB_IMAGE_TAG:-latest}"
|
||||
image: 'mariadb:${LDD_DB_IMAGE_TAG:-latest}'
|
||||
ports:
|
||||
- "${LDD_DB_PORT:-3306}:3306"
|
||||
- '${LDD_DB_PORT:-3306}:3306'
|
||||
command: >
|
||||
--sql-mode=${LDD_SQL_MODE:-"ANSI,ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES,ALLOW_INVALID_DATES"}
|
||||
--sql-require-primary-key=${LDD_SQL_REQUIRE_PRIMARY_KEY:-OFF}
|
||||
--default-storage-engine=${LDD_DEFAULT_STORAGE_ENGINE:-InnoDB}
|
||||
--explicit_defaults_for_timestamp=${LDD_EXPLICIT_DEFAULTS_FOR_TIMESTAMP:-ON}
|
||||
--mysql-native-password=${LDD_MYSQL_NATIVE_PASSWORD:-ON}
|
||||
networks:
|
||||
- private
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: "${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}"
|
||||
MARIADB_DATABASE: defaultdb
|
||||
MYSQL_ROOT_PASSWORD: '${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}'
|
||||
MYSQL_DATABASE: defaultdb
|
||||
|
||||
phpmyadmin:
|
||||
image: "phpmyadmin:${LDD_PMA_IMAGE_TAG:-latest}"
|
||||
image: 'phpmyadmin:${LDD_PMA_IMAGE_TAG:-latest}'
|
||||
restart: always
|
||||
ports:
|
||||
- "${LDD_PMA_PORT:-8010}:80"
|
||||
- '${LDD_PMA_PORT:-8010}:80'
|
||||
networks:
|
||||
- private
|
||||
depends_on:
|
||||
@@ -25,8 +32,8 @@ services:
|
||||
PMA_HOST: db
|
||||
PMA_PORT: 3306
|
||||
PMA_USER: root
|
||||
PMA_PASSWORD: "${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}"
|
||||
MYSQL_ROOT_PASSWORD: "${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}"
|
||||
PMA_PASSWORD: '${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}'
|
||||
MYSQL_ROOT_PASSWORD: '${LDD_DB_ROOT_PASSWORD:-not-secure-pwd}'
|
||||
|
||||
networks:
|
||||
private:
|
||||
|
||||
71
lifecycle.js
71
lifecycle.js
@@ -1,71 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Inspired by: https://blog.xendit.engineer/how-we-repurposed-npm-to-publish-and-distribute-our-go-binaries-for-internal-cli-23981b80911b
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const BIN_BASE_DIR = `${__dirname}/bin`;
|
||||
const BIN_OUTPUT_PATH = `${BIN_BASE_DIR}/ldd`;
|
||||
const BIN_OPTIONS_DIR = `${BIN_BASE_DIR}/@mep-agency`;
|
||||
const BIN_OPTIONS_BASE_NAME = `${BIN_OPTIONS_DIR}/local-dev-db`;
|
||||
|
||||
if (!fs.existsSync(BIN_OPTIONS_DIR) || !fs.statSync(BIN_OPTIONS_DIR).isDirectory()) {
|
||||
console.info('Binaries are not available, this probably means we are in a development environment... skipping!');
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const ARCH_MAPPING = {
|
||||
x64: '',
|
||||
};
|
||||
|
||||
const PLATFORM_MAPPING = {
|
||||
darwin: 'macos',
|
||||
linux: 'linux',
|
||||
win32: 'win.exe',
|
||||
};
|
||||
|
||||
async function postinstall(callback) {
|
||||
if (PLATFORM_MAPPING[process.platform] === undefined) {
|
||||
callback(`Unsupported platform: "${process.platform}"`);
|
||||
}
|
||||
|
||||
if (ARCH_MAPPING[process.arch] === undefined) {
|
||||
callback(`Unsupported architecture: "${process.arch}"`);
|
||||
}
|
||||
|
||||
const binaryNameTokens = [BIN_OPTIONS_BASE_NAME, PLATFORM_MAPPING[process.platform], ARCH_MAPPING[process.arch]].filter(
|
||||
(token) => token.length > 0,
|
||||
);
|
||||
|
||||
console.info(`Copying the relevant binary for your platform ${process.platform} (${process.arch})`);
|
||||
|
||||
fs.copyFileSync(binaryNameTokens.join('-'), BIN_OUTPUT_PATH);
|
||||
|
||||
callback(null);
|
||||
}
|
||||
|
||||
// Parse command line arguments and call the right method
|
||||
var actions = {
|
||||
postinstall: postinstall,
|
||||
};
|
||||
|
||||
const argv = process.argv;
|
||||
|
||||
if (argv && argv.length > 2) {
|
||||
var cmd = process.argv[2];
|
||||
if (!actions[cmd]) {
|
||||
console.log('Invalid command.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
actions[cmd](function (err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
772
package-lock.json
generated
Normal file
772
package-lock.json
generated
Normal file
@@ -0,0 +1,772 @@
|
||||
{
|
||||
"name": "@mep-agency/local-dev-db",
|
||||
"version": "1.0.0-alpha14",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@mep-agency/local-dev-db",
|
||||
"version": "1.0.0-alpha14",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/prompts": "^4.0.0",
|
||||
"commander": "^12.0.0",
|
||||
"docker-cli-js": "^2.10.0",
|
||||
"mysql2": "^3.14.0"
|
||||
},
|
||||
"bin": {
|
||||
"ldd": "bin/ldd.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.8.8",
|
||||
"typescript": "^5.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/checkbox": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-2.1.0.tgz",
|
||||
"integrity": "sha512-DyvMAKFoqJ5BCVBqHqiQELSJvwHTqXaJmV1onATgjxyM3vtp6b8xbfPE5feX1pR9wvH+sso02Pb326S92h6Q/A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"ansi-escapes": "^4.3.2",
|
||||
"chalk": "^4.1.2",
|
||||
"figures": "^3.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/confirm": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-3.0.0.tgz",
|
||||
"integrity": "sha512-LHeuYP1D8NmQra1eR4UqvZMXwxEdDXyElJmmZfU44xdNLL6+GcQBS0uE16vyfZVjH8c22p9e+DStROfE/hyHrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/core": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/core/-/core-7.0.0.tgz",
|
||||
"integrity": "sha512-g13W5yEt9r1sEVVriffJqQ8GWy94OnfxLCreNSOTw0HPVcszmc/If1KIf7YBmlwtX4klmvwpZHnQpl3N7VX2xA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"@types/mute-stream": "^0.0.4",
|
||||
"@types/node": "^20.11.16",
|
||||
"@types/wrap-ansi": "^3.0.0",
|
||||
"ansi-escapes": "^4.3.2",
|
||||
"chalk": "^4.1.2",
|
||||
"cli-spinners": "^2.9.2",
|
||||
"cli-width": "^4.1.0",
|
||||
"figures": "^3.2.0",
|
||||
"mute-stream": "^1.0.0",
|
||||
"run-async": "^3.0.0",
|
||||
"signal-exit": "^4.1.0",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"wrap-ansi": "^6.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/core/node_modules/@types/node": {
|
||||
"version": "20.11.20",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz",
|
||||
"integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/editor": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-2.0.0.tgz",
|
||||
"integrity": "sha512-0n3agxb1X23A/lx+MI5sV6s/qeywGr4xmKAzZS7ZhToee7L/6DXotWa/VvvwNEoBT0mSuk9SDIAoQ0zLkJmpHg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"external-editor": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/expand": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-2.0.0.tgz",
|
||||
"integrity": "sha512-2VETEz+RyRrIeBwULKc5o+PJzKqbsibyT6IY0oP0XvM/17flO6eW7P+rdGCAvFP6g2hKieIH23ZVrcgsosb1/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"chalk": "^4.1.2",
|
||||
"figures": "^3.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/input": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/input/-/input-2.0.0.tgz",
|
||||
"integrity": "sha512-qOjxSHLzqp/u6TvK7UtidPERoCa6BSSKyKG17aEaSOBl9uAQ4XIIqs9TtcEqwDloakarWS6xxTfR0sE1qvLwIQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/password": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/password/-/password-2.0.0.tgz",
|
||||
"integrity": "sha512-PlUek3wTMiGZothmmGIL4OBLo+rDSCxqIUHsyroyM/+AnR3xr5NHMM0/5z6CuptpJs1ZbQewqslaNi7k6goWMw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"ansi-escapes": "^4.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/prompts": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-4.1.0.tgz",
|
||||
"integrity": "sha512-HUVJ5yLjDUEq61LQiujs26qqFrKIaZOnpzDRmnYT67bsXUD8gxPmLg+DJq2ENniiDSQyBK33qVQIbeeAdR3ZlQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/checkbox": "^2.1.0",
|
||||
"@inquirer/confirm": "^3.0.0",
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/editor": "^2.0.0",
|
||||
"@inquirer/expand": "^2.0.0",
|
||||
"@inquirer/input": "^2.0.0",
|
||||
"@inquirer/password": "^2.0.0",
|
||||
"@inquirer/rawlist": "^2.0.0",
|
||||
"@inquirer/select": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/rawlist": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-2.0.0.tgz",
|
||||
"integrity": "sha512-o4jHJBAvknVE6K15zX8AuLMemb1eN1EL0l+BIbJ2JgtpoU2zSuLf6jT98omvtWk/gbaowjw7RLsW7X5F+G19KA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"chalk": "^4.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/select": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/select/-/select-2.0.0.tgz",
|
||||
"integrity": "sha512-ZxWP1gHbReAH6HdoNQRV/9W/UjgKSeiiQX2DxJ6w3GDiQeC3fRAL+lukuMM+QGteGqaTjWwIEWhPLvgbGIrRgg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^7.0.0",
|
||||
"@inquirer/type": "^1.2.0",
|
||||
"ansi-escapes": "^4.3.2",
|
||||
"chalk": "^4.1.2",
|
||||
"figures": "^3.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@inquirer/type": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.2.0.tgz",
|
||||
"integrity": "sha512-/vvkUkYhrjbm+RolU7V1aUFDydZVKNKqKHR5TsE+j5DXgXFwrsOPcoGUJ02K0O7q7O53CU2DOTMYCHeGZ25WHA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/blue-tape": {
|
||||
"version": "0.1.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/blue-tape/-/blue-tape-0.1.33.tgz",
|
||||
"integrity": "sha512-l5cQcLM3aPh55bBQ4geWQ8hZ4Ew+s4RvyhMaBpgW3aJ2HUfRgwd8ENKrk/utC4Hz1dJAiehyIa4vN6emxBMaog==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/tape": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.14.119",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.119.tgz",
|
||||
"integrity": "sha512-Z3TNyBL8Vd/M9D9Ms2S3LmFq2sSMzahodD6rCS9V2N44HUMINb75jNkSuwAx7eo2ufqTdfOdtGQpNbieUjPQmw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/mute-stream": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz",
|
||||
"integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz",
|
||||
"integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/tape": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/tape/-/tape-5.6.0.tgz",
|
||||
"integrity": "sha512-yt27qxGg45IVJ0i2PdbYopND9d4eaXwne/jpi0saYb7PHYu8ZYaQB+cADjj+YZkZZjCM4rnhMPYFGd6+M8sWKg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/through": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/through": {
|
||||
"version": "0.0.30",
|
||||
"resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz",
|
||||
"integrity": "sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/wrap-ansi": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz",
|
||||
"integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ansi-escapes": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
|
||||
"integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"type-fest": "^0.21.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/aws-ssl-profiles": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz",
|
||||
"integrity": "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chardet": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
|
||||
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cli-spinners": {
|
||||
"version": "2.9.2",
|
||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz",
|
||||
"integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/cli-table-2-json": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/cli-table-2-json/-/cli-table-2-json-1.0.13.tgz",
|
||||
"integrity": "sha512-CpUj9dubfuIZSEezwUPycAJqM2dlATyyRUyBkfGeK2KNfrqK3XrdaBohMt0XlkEvsZyDfUEmPWCNvUO+a/7Wsw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/blue-tape": "^0.1.30",
|
||||
"@types/lodash": "4.14.119",
|
||||
"lodash": "^4.17.15"
|
||||
}
|
||||
},
|
||||
"node_modules/cli-width": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz",
|
||||
"integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "12.0.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz",
|
||||
"integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/denque": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
|
||||
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/docker-cli-js": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/docker-cli-js/-/docker-cli-js-2.10.0.tgz",
|
||||
"integrity": "sha512-p/Hf3igU69bIZ0WvHu0M0/VrKE3LojVWiKyh/4hfPkvCGaad3mWE51q0OyxYP+P26cEISAx0mImtsO6VJdKiZA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cli-table-2-json": "1.0.13",
|
||||
"dockermachine-cli-js": "3.0.5",
|
||||
"lodash.snakecase": "^4.1.1",
|
||||
"nodeify-ts": "1.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/dockermachine-cli-js": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/dockermachine-cli-js/-/dockermachine-cli-js-3.0.5.tgz",
|
||||
"integrity": "sha512-oV9RRKGvWrvsGl8JW9TWKpjBJVGxn/1qMvhqwPJiOPfRES0+lrq/Q8Wzixb6qinuXPVBhlWqhXb/Oxrh6Vuf/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cli-table-2-json": "1.0.13",
|
||||
"nodeify-ts": "1.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/external-editor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
|
||||
"integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chardet": "^0.7.0",
|
||||
"iconv-lite": "^0.4.24",
|
||||
"tmp": "^0.0.33"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/figures": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
|
||||
"integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^1.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/generate-function": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
|
||||
"integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-property": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-property": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
|
||||
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.snakecase": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz",
|
||||
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/long": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-5.3.1.tgz",
|
||||
"integrity": "sha512-ka87Jz3gcx/I7Hal94xaN2tZEOPoUOEVftkQqZx2EeQRN7LGdfLlI3FvZ+7WDplm+vK2Urx9ULrvSowtdCieng==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "7.18.3",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
|
||||
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/lru.min": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.2.tgz",
|
||||
"integrity": "sha512-Nv9KddBcQSlQopmBHXSsZVY5xsdlZkdH/Iey0BlcBYggMd4two7cZnKOK9vmy3nY0O5RGH99z1PCeTpPqszUYg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"bun": ">=1.0.0",
|
||||
"deno": ">=1.30.0",
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wellwelwel"
|
||||
}
|
||||
},
|
||||
"node_modules/mute-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql2": {
|
||||
"version": "3.14.0",
|
||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.14.0.tgz",
|
||||
"integrity": "sha512-8eMhmG6gt/hRkU1G+8KlGOdQi2w+CgtNoD1ksXZq9gQfkfDsX4LHaBwTe1SY0Imx//t2iZA03DFnyYKPinxSRw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"aws-ssl-profiles": "^1.1.1",
|
||||
"denque": "^2.1.0",
|
||||
"generate-function": "^2.3.1",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"long": "^5.2.1",
|
||||
"lru.min": "^1.0.0",
|
||||
"named-placeholders": "^1.1.3",
|
||||
"seq-queue": "^0.0.5",
|
||||
"sqlstring": "^2.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql2/node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql2/node_modules/sqlstring": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz",
|
||||
"integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/named-placeholders": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz",
|
||||
"integrity": "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lru-cache": "^7.14.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nodeify-ts": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/nodeify-ts/-/nodeify-ts-1.0.6.tgz",
|
||||
"integrity": "sha512-jq+8sqVG1aLqy5maMTceL8NUJ1CvarWztlxvrYh3G0aao9BsVeoVmVedUnrUSBLetP7oLIAJrPrw4+iIo7v3GA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
"integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
||||
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/run-async": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz",
|
||||
"integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/seq-queue": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
|
||||
"integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/tmp": {
|
||||
"version": "0.0.33",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
|
||||
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"os-tmpdir": "~1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "0.21.3",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
|
||||
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
package.json
39
package.json
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "@mep-agency/local-dev-db",
|
||||
"version": "1.0.0-alpha6",
|
||||
"version": "1.0.0-alpha17",
|
||||
"private": false,
|
||||
"description": "A zero-config local MariaDB instance for local development (using Docker)",
|
||||
"type": "module",
|
||||
"description": "A zero-config local MySQL instance for local development (using Docker)",
|
||||
"author": "Marco Lipparini <developer@liarco.net>",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
@@ -21,39 +22,27 @@
|
||||
"url": "https://github.com/mep-agency/local-dev-db/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf ./bin/@mep-agency && rm -rf ./build && tsc && pkg -c package.json ./build/src/index.js",
|
||||
"build": "rm -rf ./build && tsc",
|
||||
"watch": "tsc --watch",
|
||||
"format": "prettier --write \"**/*.{ts,md,scss,css,js}\"",
|
||||
"lint": "prettier --check \"**/*.{ts,md,scss,css,js}\"",
|
||||
"postinstall": "node lifecycle.js postinstall"
|
||||
"lint": "prettier --check \"**/*.{ts,md,scss,css,js}\""
|
||||
},
|
||||
"bin": {
|
||||
"ldd": "./bin/ldd"
|
||||
"ldd": "./bin/ldd.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"docker",
|
||||
"lifecycle.js",
|
||||
"LICENCE",
|
||||
"README.md"
|
||||
"build/**/*.js",
|
||||
"docker"
|
||||
],
|
||||
"pkg": {
|
||||
"targets": [
|
||||
"linux-x64",
|
||||
"macos-x64",
|
||||
"win-x64"
|
||||
],
|
||||
"outputPath": "bin"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@inquirer/prompts": "^3.0.0",
|
||||
"@types/mysql": "^2.15.21",
|
||||
"commander": "^11.0.0",
|
||||
"docker-cli-js": "^2.10.0",
|
||||
"mysql": "^2.18.1",
|
||||
"pkg": "^5.8.1",
|
||||
"prettier": "^2.8.8",
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"dependencies": {}
|
||||
"dependencies": {
|
||||
"@inquirer/prompts": "^4.0.0",
|
||||
"commander": "^12.0.0",
|
||||
"docker-cli-js": "^2.10.0",
|
||||
"mysql2": "^3.14.0"
|
||||
}
|
||||
}
|
||||
|
||||
62
src/config.ts
Normal file
62
src/config.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const JSON_CONFIG_FILE_NAME = 'ldd.json';
|
||||
const PACKAGE_JSON_PATH = fileURLToPath(new URL('../package.json', import.meta.url));
|
||||
|
||||
const DEFAULT_CONFIG: Partial<JsonConfiguration> = {
|
||||
dbName: undefined,
|
||||
};
|
||||
|
||||
interface JsonConfiguration {
|
||||
dbName?: string;
|
||||
packageInfo: {
|
||||
name: string;
|
||||
description: string;
|
||||
version: string;
|
||||
};
|
||||
}
|
||||
|
||||
const findAndReadConfig = () => {
|
||||
let userConfig = {};
|
||||
|
||||
try {
|
||||
let startdir = process.cwd();
|
||||
|
||||
while (true) {
|
||||
var list = fs.readdirSync(startdir);
|
||||
|
||||
if (list.indexOf(JSON_CONFIG_FILE_NAME) != -1) {
|
||||
// Found
|
||||
console.info(`Loading configuration from: ${path.join(startdir, JSON_CONFIG_FILE_NAME)}`);
|
||||
|
||||
userConfig = JSON.parse(fs.readFileSync(path.join(startdir, JSON_CONFIG_FILE_NAME)).toString());
|
||||
break;
|
||||
} else if (startdir == '/') {
|
||||
// Root dir, file not found
|
||||
break;
|
||||
} else {
|
||||
startdir = path.normalize(path.join(startdir, '..'));
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('ERROR: Failed loading LDD configuration file...');
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
return {
|
||||
...DEFAULT_CONFIG,
|
||||
...userConfig,
|
||||
packageInfo: JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH).toString()),
|
||||
} as JsonConfiguration;
|
||||
} catch (e) {
|
||||
console.error('ERROR: Failed loading LDD package.json...');
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
export default findAndReadConfig();
|
||||
100
src/index.ts
100
src/index.ts
@@ -1,20 +1,28 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import fs from 'node:fs';
|
||||
import { program } from 'commander';
|
||||
import { confirm } from '@inquirer/prompts';
|
||||
import { dockerCommand } from 'docker-cli-js';
|
||||
import mysql from 'mysql';
|
||||
import mysql from 'mysql2';
|
||||
|
||||
import packageInfo from '../package.json';
|
||||
import config from './config.js';
|
||||
|
||||
let PACKAGE_INSTALLATION_PATH = path.normalize(
|
||||
__dirname.startsWith('/snapshot') ? path.dirname(process.execPath) : `${__dirname}/../..`,
|
||||
);
|
||||
const LDD_ROOT_PATH = fileURLToPath(new URL('..', import.meta.url));
|
||||
|
||||
interface DockerImagesCommandResult {
|
||||
images: {
|
||||
repository: string;
|
||||
tag: string;
|
||||
'image id': string;
|
||||
created: string;
|
||||
size: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
const dockerCompose: typeof dockerCommand = async (command, options) => {
|
||||
try {
|
||||
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 ?? {}) },
|
||||
);
|
||||
} catch (e: any) {
|
||||
@@ -52,7 +60,7 @@ const execQuery = (query: string, database: string = 'defaultdb') => {
|
||||
|
||||
connection.query(query, (error, results) => {
|
||||
if (error) {
|
||||
console.error(`ERROR: ${error.sqlMessage}`);
|
||||
console.error(`ERROR: ${error.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -63,17 +71,46 @@ const execQuery = (query: string, database: string = 'defaultdb') => {
|
||||
});
|
||||
};
|
||||
|
||||
program.name('ldd').description(packageInfo.description).version(packageInfo.version);
|
||||
program.name('ldd').description(config.packageInfo.description).version(config.packageInfo.version);
|
||||
|
||||
program
|
||||
.command('start')
|
||||
.description('Starts your local DB server')
|
||||
.action(async (str, options) => {
|
||||
.action(async () => {
|
||||
console.info('Starting local database containers...');
|
||||
|
||||
const requiredImages = [
|
||||
`mysql:${process.env.LDD_DB_IMAGE_TAG ?? 'lts'}`,
|
||||
`phpmyadmin:${process.env.LDD_PMA_IMAGE_TAG ?? 'latest'}`,
|
||||
];
|
||||
|
||||
try {
|
||||
const availableImagesImages = ((await dockerCommand('images', { echo: false })) as DockerImagesCommandResult).images
|
||||
.map((imageData) => `${imageData.repository}:${imageData.tag}`)
|
||||
.filter((imageName) => requiredImages.includes(imageName));
|
||||
|
||||
const missingImages = requiredImages.filter((requiredImage) => !availableImagesImages.includes(requiredImage));
|
||||
|
||||
if (missingImages.length > 0) {
|
||||
console.info('');
|
||||
console.info('The following images will be downloaded as they are required but not available:');
|
||||
missingImages.map((image) => console.info(` - ${image}`));
|
||||
console.info('');
|
||||
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');
|
||||
|
||||
console.info('');
|
||||
console.info('Done!');
|
||||
console.info(`A PhpMyAdmin instance is running on: http://127.0.0.1:${process.env.LDD_PMA_PORT ?? 8010}`);
|
||||
});
|
||||
|
||||
@@ -109,7 +146,7 @@ program
|
||||
program
|
||||
.command('create')
|
||||
.description('Creates a new database')
|
||||
.argument('<db_name>', 'The database name')
|
||||
.argument(config.dbName !== undefined ? '[db_name]' : '<db_name>', 'The database name', config.dbName)
|
||||
.action(async (databaseName) => {
|
||||
const username = databaseName;
|
||||
const userPwd = `${databaseName}-pwd`;
|
||||
@@ -129,15 +166,18 @@ program
|
||||
program
|
||||
.command('drop')
|
||||
.description('Drops the given database and its default user (if they exist)')
|
||||
.argument('<db_name>', 'The database name')
|
||||
.action(async (databaseName) => {
|
||||
.argument(config.dbName !== undefined ? '[db_name]' : '<db_name>', 'The database name', config.dbName)
|
||||
.option('-f,--force', 'Skip safety confirmation', false)
|
||||
.action(async (databaseName, options) => {
|
||||
const username = databaseName;
|
||||
const userPwd = `${databaseName}-pwd`;
|
||||
|
||||
const confirmation = await confirm({
|
||||
message: `This action will delete your database "${databaseName}" and cannot be reverted. Are you sure?`,
|
||||
default: false,
|
||||
});
|
||||
const confirmation =
|
||||
options.force === true ||
|
||||
(await confirm({
|
||||
message: `This action will delete your database "${databaseName}" and cannot be reverted. Are you sure?`,
|
||||
default: false,
|
||||
}));
|
||||
|
||||
if (confirmation !== true) {
|
||||
console.info('Aborting...');
|
||||
@@ -166,18 +206,15 @@ program
|
||||
|
||||
fs.writeFileSync(
|
||||
`./${dumpFileName}`,
|
||||
(
|
||||
await dockerCompose(
|
||||
'exec db sh -c \'exec mariadb-dump --all-databases --lock-tables -uroot -p"$MARIADB_ROOT_PASSWORD"\'',
|
||||
)
|
||||
).raw,
|
||||
(await dockerCompose('exec db sh -c \'exec mysqldump --all-databases --lock-tables -uroot -p"$MYSQL_ROOT_PASSWORD"\''))
|
||||
.raw,
|
||||
);
|
||||
});
|
||||
|
||||
program
|
||||
.command('dump')
|
||||
.description('Creates a SQL dump file of the given database')
|
||||
.argument('<db_name>', 'The database name')
|
||||
.argument(config.dbName !== undefined ? '[db_name]' : '<db_name>', 'The database name', config.dbName)
|
||||
.action(async (databaseName) => {
|
||||
const now = new Date();
|
||||
const month = now.getMonth().toString().padStart(2, '0');
|
||||
@@ -193,7 +230,7 @@ program
|
||||
`./${dumpFileName}`,
|
||||
(
|
||||
await dockerCompose(
|
||||
`exec db sh -c \'exec mariadb-dump --databases "${databaseName}" --lock-tables -uroot -p"$MARIADB_ROOT_PASSWORD"\'`,
|
||||
`exec db sh -c \'exec mysqldump --databases "${databaseName}" --lock-tables -uroot -p"$MYSQL_ROOT_PASSWORD"\'`,
|
||||
)
|
||||
).raw,
|
||||
);
|
||||
@@ -203,11 +240,14 @@ program
|
||||
.command('import')
|
||||
.description('Runs all queries from the given SQL file')
|
||||
.argument('<sql_file_path>', 'The SQL file to import')
|
||||
.action(async (sqlFilePath) => {
|
||||
const confirmation = await confirm({
|
||||
message: 'This action will execute any SQL statement found in the given file and cannot be reverted. Are you sure?',
|
||||
default: false,
|
||||
});
|
||||
.option('-f,--force', 'Skip safety confirmation', false)
|
||||
.action(async (sqlFilePath, options) => {
|
||||
const confirmation =
|
||||
options.force === true ||
|
||||
(await confirm({
|
||||
message: 'This action will execute any SQL statement found in the given file and cannot be reverted. Are you sure?',
|
||||
default: false,
|
||||
}));
|
||||
|
||||
if (confirmation !== true) {
|
||||
console.info('Aborting...');
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"module": "Node16",
|
||||
"moduleResolution": "Node16",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"incremental": true,
|
||||
|
||||
Reference in New Issue
Block a user