Skip to content

Commit

Permalink
feat: junoDevConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Feb 18, 2024
1 parent 240a856 commit 194d785
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
12 changes: 12 additions & 0 deletions packages/config/src/dev/config.ts
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion packages/config/src/dev/juno.dev.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Rule} from '../core/rules';
import type {Rule} from '../types/rules';

export type SatelliteDevCollection = Omit<Rule, 'created_at' | 'updated_at'>;

Expand Down
18 changes: 3 additions & 15 deletions packages/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
13 changes: 13 additions & 0 deletions packages/config/src/mainnet/config.ts
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion packages/config/src/mainnet/satellite.config.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-version.mjs
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 194d785

Please sign in to comment.