wmx-os-core 0.1.0 → 0.1.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.
@@ -0,0 +1,12 @@
1
+ export interface WmxConfig {
2
+ framework?: string;
3
+ backend?: string;
4
+ database?: string;
5
+ ignore?: string[];
6
+ plugins?: string[];
7
+ deploy?: {
8
+ provider: string;
9
+ };
10
+ }
11
+ export declare function loadConfig(cwd: string): WmxConfig | null;
12
+ export declare function saveConfig(config: WmxConfig, dir: string): void;
package/dist/config.js ADDED
@@ -0,0 +1,26 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "fs";
2
+ import { join, resolve } from "path";
3
+ const CONFIG_FILENAME = ".wmxrc.json";
4
+ export function loadConfig(cwd) {
5
+ let current = resolve(cwd);
6
+ while (true) {
7
+ const candidate = join(current, CONFIG_FILENAME);
8
+ if (existsSync(candidate)) {
9
+ try {
10
+ const raw = readFileSync(candidate, "utf-8");
11
+ return JSON.parse(raw);
12
+ }
13
+ catch {
14
+ return null;
15
+ }
16
+ }
17
+ const parent = resolve(current, "..");
18
+ if (parent === current)
19
+ return null;
20
+ current = parent;
21
+ }
22
+ }
23
+ export function saveConfig(config, dir) {
24
+ const configPath = join(dir, CONFIG_FILENAME);
25
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
26
+ }
@@ -0,0 +1,8 @@
1
+ import { Logger } from "./logger.js";
2
+ import type { WmxConfig } from "./config.js";
3
+ export interface WmxContext {
4
+ cwd: string;
5
+ config: WmxConfig | null;
6
+ logger: Logger;
7
+ }
8
+ export declare function createContext(): Promise<WmxContext>;
@@ -0,0 +1,11 @@
1
+ import { loadConfig } from "./config.js";
2
+ import { logger } from "./logger.js";
3
+ export async function createContext() {
4
+ const cwd = process.cwd();
5
+ const config = loadConfig(cwd);
6
+ return {
7
+ cwd,
8
+ config,
9
+ logger,
10
+ };
11
+ }
@@ -0,0 +1,6 @@
1
+ export { logger, Logger } from "./logger.js";
2
+ export type { WmxConfig } from "./config.js";
3
+ export { loadConfig, saveConfig } from "./config.js";
4
+ export type { WmxContext } from "./context.js";
5
+ export { createContext } from "./context.js";
6
+ export type { WmxCommand, WmxPlugin } from "./plugin.js";
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { logger, Logger } from "./logger.js";
2
+ export { loadConfig, saveConfig } from "./config.js";
3
+ export { createContext } from "./context.js";
@@ -0,0 +1,8 @@
1
+ export declare class Logger {
2
+ info(message: string): void;
3
+ success(message: string): void;
4
+ warn(message: string): void;
5
+ error(message: string): void;
6
+ debug(message: string): void;
7
+ }
8
+ export declare const logger: Logger;
package/dist/logger.js ADDED
@@ -0,0 +1,19 @@
1
+ import chalk from "chalk";
2
+ export class Logger {
3
+ info(message) {
4
+ console.log(`${chalk.blue("[i]")} ${message}`);
5
+ }
6
+ success(message) {
7
+ console.log(`${chalk.green("[ok]")} ${message}`);
8
+ }
9
+ warn(message) {
10
+ console.warn(`${chalk.yellow("[!]")} ${message}`);
11
+ }
12
+ error(message) {
13
+ console.error(`${chalk.red("[x]")} ${message}`);
14
+ }
15
+ debug(message) {
16
+ console.log(`${chalk.gray("[...]")} ${message}`);
17
+ }
18
+ }
19
+ export const logger = new Logger();
@@ -0,0 +1,12 @@
1
+ import type { WmxContext } from "./context.js";
2
+ export interface WmxCommand {
3
+ name: string;
4
+ description: string;
5
+ options?: Record<string, string>;
6
+ run(options: Record<string, unknown>, context: WmxContext): Promise<void>;
7
+ }
8
+ export interface WmxPlugin {
9
+ name: string;
10
+ version: string;
11
+ commands?: WmxCommand[];
12
+ }
package/dist/plugin.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wmx-os-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,5 +14,10 @@
14
14
  "devDependencies": {
15
15
  "@types/node": "^26.0.1",
16
16
  "typescript": "^5.4.0"
17
- }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "src",
21
+ "package.json"
22
+ ]
18
23
  }
@@ -0,0 +1,12 @@
1
+ export interface WmxConfig {
2
+ framework?: string;
3
+ backend?: string;
4
+ database?: string;
5
+ ignore?: string[];
6
+ plugins?: string[];
7
+ deploy?: {
8
+ provider: string;
9
+ };
10
+ }
11
+ export declare function loadConfig(cwd: string): WmxConfig | null;
12
+ export declare function saveConfig(config: WmxConfig, dir: string): void;
package/src/config.js ADDED
@@ -0,0 +1,26 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "fs";
2
+ import { join, resolve } from "path";
3
+ const CONFIG_FILENAME = ".wmxrc.json";
4
+ export function loadConfig(cwd) {
5
+ let current = resolve(cwd);
6
+ while (true) {
7
+ const candidate = join(current, CONFIG_FILENAME);
8
+ if (existsSync(candidate)) {
9
+ try {
10
+ const raw = readFileSync(candidate, "utf-8");
11
+ return JSON.parse(raw);
12
+ }
13
+ catch {
14
+ return null;
15
+ }
16
+ }
17
+ const parent = resolve(current, "..");
18
+ if (parent === current)
19
+ return null;
20
+ current = parent;
21
+ }
22
+ }
23
+ export function saveConfig(config, dir) {
24
+ const configPath = join(dir, CONFIG_FILENAME);
25
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
26
+ }
@@ -0,0 +1,8 @@
1
+ import { Logger } from "./logger.js";
2
+ import type { WmxConfig } from "./config.js";
3
+ export interface WmxContext {
4
+ cwd: string;
5
+ config: WmxConfig | null;
6
+ logger: Logger;
7
+ }
8
+ export declare function createContext(): Promise<WmxContext>;
package/src/context.js ADDED
@@ -0,0 +1,11 @@
1
+ import { loadConfig } from "./config.js";
2
+ import { logger } from "./logger.js";
3
+ export async function createContext() {
4
+ const cwd = process.cwd();
5
+ const config = loadConfig(cwd);
6
+ return {
7
+ cwd,
8
+ config,
9
+ logger,
10
+ };
11
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export { logger, Logger } from "./logger.js";
2
+ export type { WmxConfig } from "./config.js";
3
+ export { loadConfig, saveConfig } from "./config.js";
4
+ export type { WmxContext } from "./context.js";
5
+ export { createContext } from "./context.js";
6
+ export type { WmxCommand, WmxPlugin } from "./plugin.js";
package/src/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { logger, Logger } from "./logger.js";
2
+ export { loadConfig, saveConfig } from "./config.js";
3
+ export { createContext } from "./context.js";
@@ -0,0 +1,8 @@
1
+ export declare class Logger {
2
+ info(message: string): void;
3
+ success(message: string): void;
4
+ warn(message: string): void;
5
+ error(message: string): void;
6
+ debug(message: string): void;
7
+ }
8
+ export declare const logger: Logger;
package/src/logger.js ADDED
@@ -0,0 +1,19 @@
1
+ import chalk from "chalk";
2
+ export class Logger {
3
+ info(message) {
4
+ console.log(`${chalk.blue("[i]")} ${message}`);
5
+ }
6
+ success(message) {
7
+ console.log(`${chalk.green("[ok]")} ${message}`);
8
+ }
9
+ warn(message) {
10
+ console.warn(`${chalk.yellow("[!]")} ${message}`);
11
+ }
12
+ error(message) {
13
+ console.error(`${chalk.red("[x]")} ${message}`);
14
+ }
15
+ debug(message) {
16
+ console.log(`${chalk.gray("[...]")} ${message}`);
17
+ }
18
+ }
19
+ export const logger = new Logger();
@@ -0,0 +1,12 @@
1
+ import type { WmxContext } from "./context.js";
2
+ export interface WmxCommand {
3
+ name: string;
4
+ description: string;
5
+ options?: Record<string, string>;
6
+ run(options: Record<string, unknown>, context: WmxContext): Promise<void>;
7
+ }
8
+ export interface WmxPlugin {
9
+ name: string;
10
+ version: string;
11
+ commands?: WmxCommand[];
12
+ }
package/src/plugin.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": ["src"]
8
- }