From 194d7854df1e75e356be0bb4a6755ceaa928f496 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Sun, 18 Feb 2024 10:18:07 +0100 Subject: [PATCH] feat: junoDevConfig --- packages/config/src/dev/config.ts | 12 ++++++++++++ packages/config/src/dev/juno.dev.config.ts | 2 +- packages/config/src/index.ts | 18 +++--------------- packages/config/src/mainnet/config.ts | 13 +++++++++++++ .../config/src/mainnet/satellite.config.ts | 2 +- scripts/update-version.mjs | 2 +- 6 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 packages/config/src/dev/config.ts create mode 100644 packages/config/src/mainnet/config.ts diff --git a/packages/config/src/dev/config.ts b/packages/config/src/dev/config.ts new file mode 100644 index 00000000..3661c195 --- /dev/null +++ b/packages/config/src/dev/config.ts @@ -0,0 +1,12 @@ +import type {JunoDevConfig} from './juno.dev.config'; + +export type JunoDevConfigFn = () => JunoDevConfig; + +export type JunoDevConfigFnOrObject = JunoDevConfig | JunoDevConfigFn; + +export function defineDevConfig(config: JunoDevConfig): JunoDevConfig; +export function defineDevConfig(config: JunoDevConfigFn): JunoDevConfigFn; +export function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject; +export function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject { + return config; +} diff --git a/packages/config/src/dev/juno.dev.config.ts b/packages/config/src/dev/juno.dev.config.ts index 8b36a02e..1a2ebc59 100644 --- a/packages/config/src/dev/juno.dev.config.ts +++ b/packages/config/src/dev/juno.dev.config.ts @@ -1,4 +1,4 @@ -import type {Rule} from '../core/rules'; +import type {Rule} from '../types/rules'; export type SatelliteDevCollection = Omit; diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 522889ee..d3cd3ac1 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -7,18 +7,6 @@ export type * from './types/encoding'; export type * from './types/rules'; export type * from './utils/ts.utils'; -/// Export and expose functions for user configuration - -import type {JunoConfig} from './mainnet/juno.config'; -import type {JunoConfigEnv} from './mainnet/juno.env'; - -export type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig; - -export type JunoConfigFnOrObject = JunoConfig | JunoConfigFn; - -export function defineConfig(config: JunoConfig): JunoConfig; -export function defineConfig(config: JunoConfigFn): JunoConfigFn; -export function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject; -export function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject { - return config; -} +/// Export and expose functions for developers' configuration +export * from './dev/config'; +export * from './mainnet/config'; diff --git a/packages/config/src/mainnet/config.ts b/packages/config/src/mainnet/config.ts new file mode 100644 index 00000000..1f46ab1b --- /dev/null +++ b/packages/config/src/mainnet/config.ts @@ -0,0 +1,13 @@ +import type {JunoConfig} from './juno.config'; +import type {JunoConfigEnv} from './juno.env'; + +export type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig; + +export type JunoConfigFnOrObject = JunoConfig | JunoConfigFn; + +export function defineConfig(config: JunoConfig): JunoConfig; +export function defineConfig(config: JunoConfigFn): JunoConfigFn; +export function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject; +export function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject { + return config; +} diff --git a/packages/config/src/mainnet/satellite.config.ts b/packages/config/src/mainnet/satellite.config.ts index 5feefe81..b8f22868 100644 --- a/packages/config/src/mainnet/satellite.config.ts +++ b/packages/config/src/mainnet/satellite.config.ts @@ -1,4 +1,4 @@ -import type {ENCODING_TYPE} from '../core/encoding'; +import type {ENCODING_TYPE} from '../types/encoding'; import type {Either} from '../utils/ts.utils'; import type {JunoConfigMode} from './juno.env'; import type {StorageConfig} from './storage.config'; diff --git a/scripts/update-version.mjs b/scripts/update-version.mjs index e19f4a63..87086c20 100644 --- a/scripts/update-version.mjs +++ b/scripts/update-version.mjs @@ -1,5 +1,5 @@ -import {existsSync, readFileSync, writeFileSync} from 'node:fs'; import fetch from 'node-fetch'; +import {existsSync, readFileSync, writeFileSync} from 'node:fs'; import {join} from 'node:path'; // The suffix we use to publish to npm wip version of the libs