Skip to content

Commit

Permalink
Migrating to ESM (#8)
Browse files Browse the repository at this point in the history
* Migrating to ESM

* Fixing broken prettier
  • Loading branch information
liarco authored Feb 25, 2024
1 parent 0ec6b21 commit 1961d75
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/ldd.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require('../build/index.js');
import '../build/index.js';
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@mep-agency/local-dev-db",
"version": "1.0.0-alpha13",
"version": "1.0.0-alpha14",
"private": false,
"type": "module",
"description": "A zero-config local MariaDB instance for local development (using Docker)",
"author": "Marco Lipparini <[email protected]>",
"license": "MIT",
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from 'fs';
import path from 'path';
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 = `${__dirname}/../package.json`;
const PACKAGE_JSON_PATH = fileURLToPath(new URL('../package.json', import.meta.url));

const DEFAULT_CONFIG: Partial<JsonConfiguration> = {
dbName: undefined,
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
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 config from './config';
import config from './config.js';

const LDD_ROOT_PATH = `${__dirname}/..`;
const LDD_ROOT_PATH = fileURLToPath(new URL('..', import.meta.url));

interface DockerImagesCommandResult {
images: {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"module": "CommonJS",
"moduleResolution": "node",
"module": "Node16",
"moduleResolution": "Node16",
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
Expand Down

0 comments on commit 1961d75

Please sign in to comment.