stonyx 0.2.3-beta.41 → 0.2.3-beta.43
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/cli/load-commands.js +2 -0
- package/dist/cli/serve.js +1 -1
- package/dist/main.js +3 -2
- package/dist/modules.js +7 -7
- package/package.json +2 -2
|
@@ -30,6 +30,8 @@ export default async function loadModuleCommands() {
|
|
|
30
30
|
continue;
|
|
31
31
|
try {
|
|
32
32
|
const commandsModule = await import(path.join(cwd, 'node_modules', moduleName, moduleExports['./commands']));
|
|
33
|
+
if (!commandsModule.default || typeof commandsModule.default !== 'object')
|
|
34
|
+
continue;
|
|
33
35
|
const moduleCommands = commandsModule.default;
|
|
34
36
|
for (const [name, command] of Object.entries(moduleCommands)) {
|
|
35
37
|
if (commands[name]) {
|
package/dist/cli/serve.js
CHANGED
|
@@ -12,7 +12,7 @@ export function createShutdownHandler(modules) {
|
|
|
12
12
|
export default async function serve({ args }) {
|
|
13
13
|
const cwd = process.cwd();
|
|
14
14
|
const entryFlag = args.indexOf('--entry');
|
|
15
|
-
const entryPoint = entryFlag !== -1 ? args[entryFlag + 1] : 'app.js';
|
|
15
|
+
const entryPoint = (entryFlag !== -1 && entryFlag + 1 < args.length) ? args[entryFlag + 1] : 'app.js';
|
|
16
16
|
const { default: config } = await import(`${cwd}/config/environment.js`);
|
|
17
17
|
const { default: Stonyx } = await import('../main.js');
|
|
18
18
|
new Stonyx(config, cwd);
|
package/dist/main.js
CHANGED
|
@@ -38,7 +38,8 @@ export default class Stonyx {
|
|
|
38
38
|
throw new Error('Stonyx requires root project\'s path on startup');
|
|
39
39
|
// Transform config from stonyx-modules running as a standalone
|
|
40
40
|
if (rootPath.includes('stonyx-')) {
|
|
41
|
-
const
|
|
41
|
+
const dirName = rootPath.split('/').pop() ?? '';
|
|
42
|
+
const moduleName = kebabCaseToCamelCase(dirName.replace('stonyx-', ''));
|
|
42
43
|
config = { [moduleName]: config, ...(config.modules || {}) };
|
|
43
44
|
delete config.modules;
|
|
44
45
|
}
|
|
@@ -66,7 +67,7 @@ export default class Stonyx {
|
|
|
66
67
|
for (const [className, config] of Object.entries(this.config)) {
|
|
67
68
|
if (!config || typeof config !== 'object')
|
|
68
69
|
continue;
|
|
69
|
-
if (chronicle
|
|
70
|
+
if (className in chronicle)
|
|
70
71
|
continue;
|
|
71
72
|
const { logColor, logMethod, logTimestamp } = config;
|
|
72
73
|
if (!logColor)
|
package/dist/modules.js
CHANGED
|
@@ -27,8 +27,8 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
27
27
|
const modules = [];
|
|
28
28
|
const initPromises = [];
|
|
29
29
|
const rootPackage = await readFile(`${rootPath}/package.json`, { json: true });
|
|
30
|
-
const dependencies = rootPackage.devDependencies;
|
|
31
|
-
const projectName = rootPackage.name;
|
|
30
|
+
const dependencies = (rootPackage.devDependencies || {});
|
|
31
|
+
const projectName = typeof rootPackage.name === 'string' ? rootPackage.name : '';
|
|
32
32
|
// Expose rootPath to public configuration
|
|
33
33
|
config.rootPath = rootPath;
|
|
34
34
|
const moduleDependencies = Object.keys(dependencies).filter((moduleName) => moduleName.startsWith('@stonyx/'));
|
|
@@ -39,11 +39,11 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
39
39
|
promise.ready = new Promise(resolve => promise.resolve = resolve);
|
|
40
40
|
}
|
|
41
41
|
// Standalone module configuration
|
|
42
|
-
if (rootPackage.keywords
|
|
42
|
+
if (Array.isArray(rootPackage.keywords) && rootPackage.keywords.includes('stonyx-module')) {
|
|
43
43
|
configureLog(chronicle, projectName, config);
|
|
44
|
-
const entryPoint = rootPackage.main;
|
|
44
|
+
const entryPoint = typeof rootPackage.main === 'string' ? rootPackage.main : '';
|
|
45
45
|
const { default: moduleClass } = await import(`${rootPath}/${entryPoint}`);
|
|
46
|
-
initializeModule(
|
|
46
|
+
initializeModule(projectName, moduleClass, modules, initPromises);
|
|
47
47
|
}
|
|
48
48
|
for (const moduleName of moduleDependencies) {
|
|
49
49
|
const modulePackage = await readFile(`${rootPath}/node_modules/${moduleName}/package.json`, { json: true, missingFileCallback: (_filePath) => {
|
|
@@ -52,7 +52,7 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
52
52
|
} });
|
|
53
53
|
if (!modulePackage)
|
|
54
54
|
continue;
|
|
55
|
-
const keywords = modulePackage.keywords;
|
|
55
|
+
const keywords = Array.isArray(modulePackage.keywords) ? modulePackage.keywords : [];
|
|
56
56
|
if (!keywords.includes('stonyx-module')) {
|
|
57
57
|
console.warn(`Warning: Stonyx modules must contain the "stonyx-module" keyword. Module was not loaded`);
|
|
58
58
|
continue;
|
|
@@ -64,7 +64,7 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
64
64
|
try {
|
|
65
65
|
// Load & Configure Async Modules
|
|
66
66
|
const { default: moduleConfig } = await import(`${rootPath}/node_modules/${moduleName}/config/environment.js`);
|
|
67
|
-
const module = kebabCaseToCamelCase(moduleName.split('/').pop());
|
|
67
|
+
const module = kebabCaseToCamelCase(moduleName.split('/').pop() ?? moduleName);
|
|
68
68
|
const userConfig = config[module] || {};
|
|
69
69
|
const finalConfig = mergeObject(moduleConfig, userConfig);
|
|
70
70
|
config[module] = finalConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stonyx",
|
|
3
|
-
"version": "0.2.3-beta.
|
|
3
|
+
"version": "0.2.3-beta.43",
|
|
4
4
|
"description": "Base stonyx framework module",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@stonyx/utils": "0.2.3-beta.19",
|
|
55
|
-
"@stonyx/logs": "1.0.1-beta.
|
|
55
|
+
"@stonyx/logs": "1.0.1-beta.13"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^25.5.2",
|