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

chore: organize pack output #974

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions bin/node-pg-migrate → bin/node-pg-migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function tryRequire(moduleName) {
if (err.code !== 'MODULE_NOT_FOUND') {
throw err;
}

return null;
}
}
Expand Down Expand Up @@ -266,6 +267,7 @@ function readTsconfig() {
} catch (err) {
console.error("Can't load tsconfig.json:", err);
}

const tsnode = tryRequire('ts-node');
if (!tsnode) {
console.error("For TypeScript support, please install 'ts-node' module");
Expand Down Expand Up @@ -361,13 +363,15 @@ if (config && config.has(argv[configValueArg])) {
const db = config.get(argv[configValueArg]);
readJson(db);
}

process.env.SUPPRESS_NO_CONFIG_WARNING = oldSuppressWarning;

const configFileName = argv[configFileArg];
if (configFileName) {
const jsonConfig = require(path.resolve(configFileName));
readJson(jsonConfig);
}

readTsconfig();

const action = argv._.shift();
Expand Down Expand Up @@ -423,6 +427,7 @@ if (action === 'create') {
);
process.exit(1);
}

DB_CONNECTION = cp;
}

Expand All @@ -445,6 +450,7 @@ if (action === 'create') {
let migrationName;

if (updownArg !== null) {
// eslint-disable-next-line eqeqeq
if (parseInt(updownArg, 10) == updownArg) {
numMigrations = parseInt(updownArg, 10);
} else {
Expand Down Expand Up @@ -487,6 +493,7 @@ if (action === 'create') {
decamelize: DECAMELIZE,
};
};

const promise =
action === 'redo'
? migrationRunner(options('down')).then(() =>
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@
"lint": "eslint --cache --cache-strategy content --report-unused-disable-directives .",
"test": "cross-env NODE_ENV=test mocha --require ./mocha.bootstrap.js \"test/*.ts\"",
"docs:dev": "docsify serve docs",
"migrate": "node bin/node-pg-migrate",
"migrate": "node bin/node-pg-migrate.js",
"prepublishOnly": "pnpm run clean && pnpm install && pnpm run build",
"preflight": "pnpm install && run-s format build lint test"
},
"bin": {
"node-pg-migrate": "bin/node-pg-migrate"
"node-pg-migrate": "bin/node-pg-migrate.js"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
"author": "Theo Ephraim",
"contributors": [
"Salsita Software <jando@salsitasoft.com>",
Expand Down