Skip to content

Commit

Permalink
♻️ chore: Move general utils out of config package (#600)
Browse files Browse the repository at this point in the history
## Description

Move general utils out of config package to effect package

## Testing

Explain the quality checks that have been done on the code changes

## Additional Information

- [ ] I read the [contributing docs](../docs/contributing.md) (if this
is your first contribution)

Your ENS/address:

Co-authored-by: Will Cory <[email protected]>
  • Loading branch information
roninjin10 and Will Cory authored Oct 23, 2023
1 parent 44dca01 commit af9e112
Show file tree
Hide file tree
Showing 173 changed files with 4,635 additions and 46 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Tools for configuring `evmts.config.ts` file.

## See [Evmts Beta project board](https://github.com/orgs/evmts/projects/1) for progress on the upcoming beta release

## See [Contributing docs](./CONTRIBUTING.md) for detailed contributing docs
## See [Contributing docs](https://github.com/evmts/evmts-monorepo/blob/main/config/CONTRIBUTING.md) for detailed contributing docs

## License 📄

Expand Down
1 change: 1 addition & 0 deletions config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
},
"dependencies": {
"@effect/schema": "^0.45.5",
"@evmts/effect": "workspace:^",
"@types/node": "^20.7.2",
"bundle-require": "^4.0.2",
"effect": "^2.0.0-next.50",
Expand Down
9 changes: 5 additions & 4 deletions config/scripts/runFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const runFixture = (name: string) => {
runSync(
provide(
loadConfig(configDir).pipe(
flatMap(config => {
flatMap((config) => {
if (expectedErrors.includes(validName)) {
return fail(config)
}
Expand All @@ -74,9 +74,10 @@ export const runFixture = (name: string) => {
return succeed(e)
}
return logError(
`error running ${validName} ${expectedErrors.includes(validName)
? `should have errored but didn't`
: 'error'
`error running ${validName} ${
expectedErrors.includes(validName)
? `should have errored but didn't`
: 'error'
}. Try running the individual fixture with "bun fixture ${validName}"`,
).pipe(flatMap(() => fail(e)))
}),
Expand Down
3 changes: 3 additions & 0 deletions config/src/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './mergeConfigs.js'
export * from './validateUserConfig.js'
export * from './withDefaults.js'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions config/src/defineConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { loadFoundryConfig } from './utils/loadFoundryConfig.js'
import { mergeConfigs } from './utils/mergeConfigs.js'
import { validateUserConfig } from './utils/validateUserConfig.js'
import { withDefaults } from './utils/withDefaults.js'
import {
mergeConfigs,
validateUserConfig,
withDefaults,
} from './config/index.js'
import { loadFoundryConfig } from './foundry/index.js'
import { all, catchTags, fail, flatMap, logDebug, tap } from 'effect/Effect'

/**
Expand Down
1 change: 1 addition & 0 deletions config/src/foundry/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './loadFoundryConfig.js'
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO would be nice to break this up into composable effects
import { execSync } from 'child_process'
import { fail, logDebug, succeed, tap } from 'effect/Effect'
import * as path from 'path'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
* @typedef {import('./types.js').ResolvedCompilerConfig} ResolvedCompilerConfig
*/

export { defaultConfig } from './utils/withDefaults.js'
export { defaultConfig } from './config/index.js'
export { defineConfig } from './defineConfig.js'
export { loadConfig } from './loadConfig.js'
12 changes: 5 additions & 7 deletions config/src/loadConfig.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getEvmtsConfigFromTsConfig } from './utils/getEvmtsConfigFromTsConfig.js'
import { loadFoundryConfig } from './utils/loadFoundryConfig.js'
import { loadTsConfig } from './utils/loadTsConfig.js'
import { logAllErrors } from './utils/logAllErrors.js'
import { mergeConfigs } from './utils/mergeConfigs.js'
import { withDefaults } from './utils/withDefaults.js'
import { mergeConfigs, withDefaults } from './config/index.js'
import { loadFoundryConfig } from './foundry/index.js'
import { getEvmtsConfigFromTsConfig, loadTsConfig } from './tsconfig/index.js'
import { logAllErrors } from '@evmts/effect'
import {
all,
catchTags,
Expand All @@ -15,7 +13,7 @@ import {
} from 'effect/Effect'

/**
* @typedef {import("./utils/loadTsConfig.js").LoadTsConfigError | import("./utils/getEvmtsConfigFromTsConfig.js").GetEvmtsConfigFromTsConfigError | import("./utils/loadFoundryConfig.js").LoadFoundryConfigError} LoadConfigErrorType
* @typedef {import("./tsconfig/index.js").LoadTsConfigError | import("./tsconfig/index.js").GetEvmtsConfigFromTsConfigError | import("./foundry/index.js").LoadFoundryConfigError} LoadConfigErrorType
*/

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { validateUserConfig } from './validateUserConfig.js'
import { validateUserConfig } from '../config/index.js'
import { fail, logDebug, map, tap } from 'effect/Effect'

/**
Expand All @@ -13,7 +13,7 @@ export class NoPluginFoundError extends Error {
}

/**
* @typedef {NoPluginFoundError | import("./validateUserConfig.js").ValidateUserConfigError } GetEvmtsConfigFromTsConfigError
* @typedef {NoPluginFoundError | import("../config/index.js").ValidateUserConfigError } GetEvmtsConfigFromTsConfigError
*/

/**
Expand Down
2 changes: 2 additions & 0 deletions config/src/tsconfig/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './getEvmtsConfigFromTsConfig.js'
export * from './loadTsConfig.js'
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { parseJson } from './parseJson.js'
import {
array,
optional,
parseEither,
string,
struct,
} from '@effect/schema/Schema'
import { parseJson } from '@evmts/effect'
import { Effect } from 'effect'
import { catchTag, fail, flatMap, logDebug, tap } from 'effect/Effect'
import { existsSync, readFileSync } from 'fs'
Expand Down Expand Up @@ -66,7 +66,7 @@ const STsConfig = struct({
})

/**
* @typedef {import("./parseJson.js").ParseJsonError | FailedToReadConfigError | InvalidTsConfigError} LoadTsConfigError
* @typedef {import("@evmts/effect").ParseJsonError | FailedToReadConfigError | InvalidTsConfigError} LoadTsConfigError
* @internal
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
InvalidTsConfigError,
loadTsConfig,
} from './loadTsConfig.js'
import { ParseJsonError } from './parseJson.js'
import { ParseJsonError } from '@evmts/effect'
import { runSync } from 'effect/Effect'
import { join } from 'path'

Expand Down
4 changes: 2 additions & 2 deletions config/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ValidateUserConfigError } from './config/index.js'
import type { DefineConfigError } from './defineConfig.js'
import type { LoadFoundryConfigError } from './utils/loadFoundryConfig.js'
import type { ValidateUserConfigError } from './utils/validateUserConfig.js'
import type { LoadFoundryConfigError } from './foundry/index.js'
import type { Effect } from 'effect/Effect'
import type { ReadonlyRecord } from 'effect/ReadonlyRecord'

Expand Down
6 changes: 3 additions & 3 deletions config/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default defineConfig({
environment: 'node',
coverage: {
reporter: ['text', 'json-summary', 'json'],
lines: 98.83,
statements: 98.83,
lines: 98.54,
statements: 98.54,
functions: 100,
branches: 99.12,
branches: 98.83,
thresholdAutoUpdate: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Tools for configuring `evmts.config.ts` file.

## See [Evmts Beta project board](https://github.com/orgs/evmts/projects/1) for progress on the upcoming beta release

## See [Contributing docs](./CONTRIBUTING.md) for detailed contributing docs
## See [Contributing docs](https://github.com/evmts/evmts-monorepo/blob/main/config/CONTRIBUTING.md) for detailed contributing docs

## License 📄

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/config/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The default CompilerConfig

#### Defined in

[utils/withDefaults.js:6](https://github.com/evmts/evmts-monorepo/blob/main/config/src/utils/withDefaults.js#L6)
[config/withDefaults.js:6](https://github.com/evmts/evmts-monorepo/blob/main/config/src/config/withDefaults.js#L6)

## Functions

Expand Down Expand Up @@ -149,4 +149,4 @@ runPromise(loadConfig('./tsconfig.json')).pipe(

#### Defined in

[loadConfig.js:63](https://github.com/evmts/evmts-monorepo/blob/main/config/src/loadConfig.js#L63)
[loadConfig.js:61](https://github.com/evmts/evmts-monorepo/blob/main/config/src/loadConfig.js#L61)
1 change: 1 addition & 0 deletions docs/reference/effect/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
37 changes: 37 additions & 0 deletions docs/reference/effect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@evmts/effect / [Exports](/reference/effect/modules.md)

<p align="center">
<a href="https://evmts.dev/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/35039927/218812217-92f0f784-cb85-43b9-9ca6-e2b9effd9eb2.png">
<img alt="wagmi logo" src="https://user-images.githubusercontent.com/35039927/218812217-92f0f784-cb85-43b9-9ca6-e2b9effd9eb2.png" width="auto" height="300">
</picture>
</a>
</p>

<p align="center">
Execute solidity scripts in browser
</p>

[![CI](https://github.com/evmts/evmts-monorepo/actions/workflows/e2e.yml/badge.svg)](https://github.com/evmts/evmts-monorepo/actions/workflows/e2e.yml)
[![CI](https://github.com/evmts/evmts-monorepo/actions/workflows/unit.yml/badge.svg)](https://github.com/evmts/evmts-monorepo/actions/workflows/unit.yml)
<a href="https://www.npmjs.com/package/@evmts/core" target="\_parent">
<img alt="" src="https://img.shields.io/npm/dm/@evmts/core.svg" />
</a>
<a href="https://bundlephobia.com/package/@evmts/core@latest" target="\_parent">
<img alt="" src="https://badgen.net/bundlephobia/minzip/@evmts/core" />
</a>

# @evmts/effect

Low level tools around [effect.ts](https://www.effect.website/docs/why-effect)

## Visit [Docs](https://evmts.dev/) for docs, guides, API and more!

## See [Evmts Beta project board](https://github.com/orgs/evmts/projects/1) for progress on the upcoming beta release

## See [Contributing docs](https://github.com/evmts/evmts-monorepo/blob/main/effect/CONTRIBUTING.md) for detailed contributing docs

## License 📄

<a href="./LICENSE"><img src="https://user-images.githubusercontent.com/35039927/231030761-66f5ce58-a4e9-4695-b1fe-255b1bceac92.png" width="200" /></a>
Loading

1 comment on commit af9e112

@vercel
Copy link

@vercel vercel bot commented on af9e112 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

evmts-docs – ./

evmts-docs-evmts.vercel.app
evmts-docs-git-main-evmts.vercel.app
evmts.dev

Please sign in to comment.