@axium/server 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database.js +1 -1
- package/dist/io.d.ts +1 -1
- package/dist/io.js +2 -2
- package/package.json +1 -1
package/dist/database.js
CHANGED
|
@@ -107,7 +107,7 @@ export async function init(opt) {
|
|
|
107
107
|
opt.output('debug', 'Generated password and wrote to global config');
|
|
108
108
|
}
|
|
109
109
|
const _sql = (command, message) => run(opt, message, `sudo -u postgres psql -c "${command}"`);
|
|
110
|
-
const relationExists = someWarnings(opt, [/relation "\w+" already exists/, 'already exists.']);
|
|
110
|
+
const relationExists = someWarnings(opt.output, [/relation "\w+" already exists/, 'already exists.']);
|
|
111
111
|
await _sql('CREATE DATABASE axium', 'Creating database').catch(async (error) => {
|
|
112
112
|
if (error != 'database "axium" already exists')
|
|
113
113
|
throw error;
|
package/dist/io.d.ts
CHANGED
|
@@ -69,4 +69,4 @@ export declare function restrictedPorts(opt: PortOptions): Promise<void>;
|
|
|
69
69
|
* The handler will allow the parent scope to continue if a relation already exists,
|
|
70
70
|
* rather than fatally exiting.
|
|
71
71
|
*/
|
|
72
|
-
export declare function someWarnings(
|
|
72
|
+
export declare function someWarnings(output: Output, ...allowList: [RegExp, string?][]): (error: string | Error) => void;
|
package/dist/io.js
CHANGED
|
@@ -172,12 +172,12 @@ export async function restrictedPorts(opt) {
|
|
|
172
172
|
* The handler will allow the parent scope to continue if a relation already exists,
|
|
173
173
|
* rather than fatally exiting.
|
|
174
174
|
*/
|
|
175
|
-
export function someWarnings(
|
|
175
|
+
export function someWarnings(output, ...allowList) {
|
|
176
176
|
return (error) => {
|
|
177
177
|
error = typeof error == 'object' && 'message' in error ? error.message : error;
|
|
178
178
|
for (const [pattern, message = error] of allowList) {
|
|
179
179
|
if (pattern.test(error))
|
|
180
|
-
|
|
180
|
+
output('warn', message);
|
|
181
181
|
}
|
|
182
182
|
throw error;
|
|
183
183
|
};
|