@snowieedev/vertex-config 0.1.0

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,5 @@
1
+ import type { VertexConfig } from './types.js';
2
+ /**
3
+ * Helper to define VERTEX configuration with type checking.
4
+ */
5
+ export declare function defineConfig(config: VertexConfig): VertexConfig;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Helper to define VERTEX configuration with type checking.
3
+ */
4
+ export function defineConfig(config) {
5
+ return config;
6
+ }
7
+ //# sourceMappingURL=defineConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../src/defineConfig.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './defineConfig.js';
3
+ export * from './loadConfig.js';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './defineConfig.js';
3
+ export * from './loadConfig.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { VertexConfig } from './types.js';
2
+ export declare function loadConfig(cwd?: string): Promise<VertexConfig>;
@@ -0,0 +1,23 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { logger, CONFIG_FILE_NAME, VertexError } from '@snowieedev/vertex-shared';
4
+ import jiti from 'jiti';
5
+ export async function loadConfig(cwd = process.cwd()) {
6
+ const configPath = path.resolve(cwd, CONFIG_FILE_NAME);
7
+ if (!fs.existsSync(configPath)) {
8
+ logger.debug(`No ${CONFIG_FILE_NAME} found at ${cwd}, using default configuration.`);
9
+ return {};
10
+ }
11
+ try {
12
+ const createJiti = jiti.default || jiti;
13
+ const jitiInstance = createJiti(process.cwd(), { interopDefault: true });
14
+ const configModule = jitiInstance(configPath);
15
+ // Support module.exports or export default
16
+ const config = configModule.default || configModule;
17
+ return config;
18
+ }
19
+ catch (error) {
20
+ throw new VertexError(`Failed to load configuration from ${configPath}: ${error instanceof Error ? error.message : String(error)}`);
21
+ }
22
+ }
23
+ //# sourceMappingURL=loadConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,MAAM,gBAAgB,aAAa,GAAG,gCAAgC,CAAC,CAAC;QACrF,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAI,IAAY,CAAC,OAAO,IAAI,IAAI,CAAC;QACjD,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,MAAM,YAAY,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAE9C,2CAA2C;QAC3C,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC;QACpD,OAAO,MAAsB,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CAAC,qCAAqC,UAAU,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtI,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface VertexConfig {
2
+ /**
3
+ * Application base path
4
+ */
5
+ base?: string;
6
+ /**
7
+ * Dev server port
8
+ */
9
+ port?: number;
10
+ /**
11
+ * Enable/disable strict mode
12
+ */
13
+ strict?: boolean;
14
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@snowieedev/vertex-config",
3
+ "version": "0.1.0",
4
+ "description": "Configuration package for VERTEX framework",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "dependencies": {
12
+ "jiti": "^1.21.0",
13
+ "@snowieedev/vertex-shared": "0.1.0"
14
+ },
15
+ "devDependencies": {
16
+ "typescript": "^5.4.0"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsc --watch",
21
+ "clean": "rm -rf dist"
22
+ }
23
+ }