@golemio/core 1.20.11-dev.1910890108 → 1.20.11-dev.1925284932
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/package.json +1 -4
- package/bin/import-test-data.js +0 -61
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/core",
|
|
3
|
-
"version": "1.20.11-dev.
|
|
3
|
+
"version": "1.20.11-dev.1925284932",
|
|
4
4
|
"description": "Golemio Core Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"golemio-import-test-data": "bin/import-test-data.js"
|
|
9
|
-
},
|
|
10
7
|
"scripts": {
|
|
11
8
|
"build": "rimraf ./dist && tspc -p ./tsconfig.build.json",
|
|
12
9
|
"build-minimal": "run-s 'build -- --sourceMap false --declaration false'",
|
package/bin/import-test-data.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
require("../dist/shared/_global");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const glob = require("fast-glob");
|
|
7
|
-
|
|
8
|
-
const APP_ROOT_PATH = fs.realpathSync(process.cwd());
|
|
9
|
-
require("dotenv").config({ path: path.resolve(APP_ROOT_PATH, ".env") });
|
|
10
|
-
|
|
11
|
-
// TODO use unified logger
|
|
12
|
-
// https://gitlab.com/operator-ict/golemio/code/modules/core/-/issues/1
|
|
13
|
-
const log = {
|
|
14
|
-
info: console.info,
|
|
15
|
-
warn: console.warn,
|
|
16
|
-
error: console.error,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const variables = {
|
|
20
|
-
sqlDumpFiles: process.env.SQL_DUMP_FILES || " ",
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated No longer maintained, use Golemio CLI instead
|
|
25
|
-
*/
|
|
26
|
-
const importPostgresTestData = async () => {
|
|
27
|
-
const files = glob.sync(variables.sqlDumpFiles, {
|
|
28
|
-
cwd: APP_ROOT_PATH,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (files.length < 1) {
|
|
32
|
-
log.info(`Skipping SQL data import`);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const { sequelizeConnection } = require("../dist/output-gateway/database");
|
|
37
|
-
|
|
38
|
-
for (const file of files) {
|
|
39
|
-
log.info(`Restoring SQL data from '${file}'`);
|
|
40
|
-
const query = fs.readFileSync(path.join(APP_ROOT_PATH, file)).toString();
|
|
41
|
-
|
|
42
|
-
await sequelizeConnection.query(query);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
(async () => {
|
|
47
|
-
console.log(
|
|
48
|
-
"\x1b[33m%s\x1b[0m",
|
|
49
|
-
"Deprecation warning: golemio-import-test-data is no longer maintained. Use Golemio CLI import-db-data instead"
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
await importPostgresTestData();
|
|
53
|
-
|
|
54
|
-
// Exit with zero code
|
|
55
|
-
process.exit(0);
|
|
56
|
-
})().catch((e) => {
|
|
57
|
-
log.error(e);
|
|
58
|
-
|
|
59
|
-
// Exit with non-zero code
|
|
60
|
-
process.exit(1);
|
|
61
|
-
});
|