Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobWeisenburger committed Jan 31, 2024
1 parent 963f45c commit fd24252
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 19 deletions.
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
# @weis-guys/result
<div align='center'>
<h1>@weis-guys/result</h1>
</div>

<div align='center'>
<a href='https://github.com/JacobWeisenburger' rel='nofollow'>
<img alt='Created by Jacob Weisenburger'
src='https://img.shields.io/badge/created%20by-Jacob%20Weisenburger-274D82.svg'>
</a>
<a href='https://github.com/weis-guys/result/stargazers' rel='nofollow'>
<img alt='stars' src='https://img.shields.io/github/stars/weis-guys/result?color=blue'>
</a>
</div>

<div align='center'>
<a href='https://www.npmjs.com/package/@weis-guys/result' rel='nofollow'>
<img alt='npm' src='https://img.shields.io/npm/v/@weis-guys/result?color=blue'>
</a>
<a href='https://www.npmjs.com/package/@weis-guys/result' rel='nofollow'>
<img alt='downloads' src='https://img.shields.io/npm/dw/@weis-guys/result?color=blue'>
</a>
</div>

<div align="center">
<a href="https://github.com/weis-guys/result">Docs</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://github.com/weis-guys/result">github</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://www.npmjs.com/package/@weis-guys/result">npm</a>
</div>

<!-- Dist Readme Stops Here -->

<br />

## Contribute

Always open to ideas. Positive or negative, all are welcome. Feel free to contribute an [issue](https://github.com/weis-guys/result/issues) or [PR](https://github.com/weis-guys/result/pulls).

## Installation

```sh
npm install @weis-guys/result
yarn add @weis-guys/result
pnpm add @weis-guys/result
bun add @weis-guys/result
```

## Getting Started

```ts
import { Result } from '@weis-guys/result'
Expand Down Expand Up @@ -71,4 +119,5 @@ if ( result.success ) {
```

## TODO
- [ ] make reduced readme for npm
- Auto publish to npm
- GitHub Actions ?
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@weis-guys/result",
"version": "0.0.5",
"version": "0.0.6",
"main": "lib.js",
"type": "module",
"author": "Jacob Weisenburger",
Expand Down
36 changes: 21 additions & 15 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,54 @@ await Promise.resolve()
} )
)

.then( async () => {
await rm( dist, { recursive: true } )
.then( () => console.log( 'dist: deleted' ) )
.catch( logError( { dist } ) )
} )
// .then( async () => {
// await rm( dist, { recursive: true } )
// .then( () => console.log( 'dist: deleted' ) )
// .catch( logError( { dist } ) )
// } )

.then( async () => {
const section = 'Bun.build'
const config: BuildConfig = {
entrypoints: [ './lib.ts' ],
root,
outdir: dist,
entrypoints: [ './src/lib.ts' ],
format: 'esm',
minify: true,
sourcemap: 'external',
sourcemap: 'inline',
target: 'node',
plugins: [
dts()
],
}
await Bun.build( config )
.then( buildResult => Promise.all(
buildResult.outputs.map( res => Bun.write( Path.join( dist, res.path ), res ) )
) )
.then( () => console.log( 'Bun.build: ran' ) )
.catch( logError( { section, config } ) )
} )

.then( async () => {
const section = 'package.json'
const section = 'Reduced package.json: written'
const distPath = Path.join( dist, 'package.json' )
const { scripts, devDependencies, ...reduced } = packageJSON

await Bun.write( distPath, JSON.stringify( reduced, null, 4 ) )
.then( () => console.log( 'package: copied' ) )
.then( () => console.log( section ) )
.catch( logError( { section, distPath, reduced } ) )
} )

.then( async () => {
const section = 'README'
const section = 'Reduced README: written'
const srcPath = Path.join( root, 'README.md' )
const distPath = Path.join( dist, 'README.md' )
await copyFile( srcPath, distPath )
.then( () => console.log( 'README: copied' ) )
.catch( logError( { section, srcPath, distPath } ) )
const contents = await Bun.file( srcPath ).text()
const newContents = contents
.split( '<!-- Dist Readme Stops Here -->' )[ 0 ]
.trim()

await Bun.write( distPath, newContents )
.then( () => console.log( section ) )
.catch( logError( { section, distPath, contents } ) )
} )

.then( async () => {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
},
"include": [
"./**/*",
".src/**/*",
"package.json"
]
}

0 comments on commit fd24252

Please sign in to comment.