@abtnode/core 1.7.19 → 1.7.20
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/lib/blocklet/extras.js +1 -5
- package/lib/blocklet/hooks.js +9 -9
- package/lib/blocklet/manager/disk.js +284 -215
- package/lib/blocklet/migration.js +1 -1
- package/lib/migrations/1.7.20-blocklet-component.js +41 -0
- package/lib/router/helper.js +1 -1
- package/lib/router/index.js +1 -1
- package/lib/router/manager.js +24 -21
- package/lib/states/audit-log.js +1 -1
- package/lib/states/blocklet-extras.js +66 -159
- package/lib/states/blocklet.js +65 -62
- package/lib/util/blocklet.js +160 -127
- package/lib/validators/router.js +1 -2
- package/package.json +15 -15
package/lib/blocklet/extras.js
CHANGED
|
@@ -51,11 +51,7 @@ const mergeConfigs = ({ old: oldConfigs, cur: newConfigs = [], did = '', dek = '
|
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return true;
|
|
54
|
+
return !(key.toString().startsWith('ABT_NODE_') || key.toString().startsWith('BLOCKLET_'));
|
|
59
55
|
});
|
|
60
56
|
|
|
61
57
|
newConfig.forEach((config) => {
|
package/lib/blocklet/hooks.js
CHANGED
|
@@ -7,7 +7,7 @@ const logger = require('@abtnode/logger')(`${require('../../package.json').name}
|
|
|
7
7
|
|
|
8
8
|
const { getSafeEnv } = require('../util');
|
|
9
9
|
|
|
10
|
-
const runUserHook = async (
|
|
10
|
+
const runUserHook = async (processId, hookName, args) => {
|
|
11
11
|
const { appDir, hooks, env, exitOnError = true, silent = false, notification, did } = args;
|
|
12
12
|
const hook = get(hooks, `[${hookName}]`) || get(hooks, `[${camelCase(hookName)}]`);
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ const runUserHook = async (appId, hookName, args) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
logger.info(`run hook:${hookName}:`, { hook });
|
|
20
|
-
await runScript(hook, [
|
|
20
|
+
await runScript(hook, [processId, hookName].join(':'), { cwd: appDir, env: getSafeEnv(env), silent });
|
|
21
21
|
} catch (error) {
|
|
22
22
|
logger.error(`run ${hook} error:`, { error });
|
|
23
23
|
|
|
@@ -37,10 +37,10 @@ const runUserHook = async (appId, hookName, args) => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const preDeploy = (
|
|
41
|
-
const preInstall = (
|
|
42
|
-
const postInstall = (
|
|
43
|
-
const preConfig = (
|
|
40
|
+
const preDeploy = (processId, ...args) => runUserHook(processId, 'pre-deploy', ...args);
|
|
41
|
+
const preInstall = (processId, ...args) => runUserHook(processId, 'pre-install', ...args);
|
|
42
|
+
const postInstall = (processId, ...args) => runUserHook(processId, 'post-install', ...args);
|
|
43
|
+
const preConfig = (processId, ...args) => runUserHook(processId, 'pre-config', ...args);
|
|
44
44
|
const preStart = async (blocklet, options) => {
|
|
45
45
|
// check required environments
|
|
46
46
|
let environments = get(blocklet, 'meta.environments', []);
|
|
@@ -53,10 +53,10 @@ const preStart = async (blocklet, options) => {
|
|
|
53
53
|
throw new Error(`Required environments is not set: ${tmp.join(',')}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
return runUserHook(blocklet.env.
|
|
56
|
+
return runUserHook(blocklet.env.processId, 'pre-start', options);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
const preUninstall = (
|
|
60
|
-
const preStop = (
|
|
59
|
+
const preUninstall = (processId, ...args) => runUserHook(processId, 'pre-uninstall', ...args);
|
|
60
|
+
const preStop = (processId, ...args) => runUserHook(processId, 'pre-stop', ...args);
|
|
61
61
|
|
|
62
62
|
module.exports = { preDeploy, preInstall, postInstall, preStart, preUninstall, preStop, preConfig };
|