From fd24252fec1004a60aecc3274283f0f37c2c27d3 Mon Sep 17 00:00:00 2001 From: JacobWeisenburger Date: Wed, 31 Jan 2024 11:23:54 -0600 Subject: [PATCH] changes --- README.md | 53 ++++++++++++++++++++++++++++++++-- package.json | 2 +- scripts/build.ts | 36 +++++++++++++---------- lib.test.ts => src/lib.test.ts | 0 lib.ts => src/lib.ts | 0 tsconfig.json | 2 +- 6 files changed, 74 insertions(+), 19 deletions(-) rename lib.test.ts => src/lib.test.ts (100%) rename lib.ts => src/lib.ts (100%) diff --git a/README.md b/README.md index d097a9a..1776aa7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,52 @@ -# @weis-guys/result +
+

@weis-guys/result

+
+ +
+ + Created by Jacob Weisenburger + + + stars + +
+ +
+ + npm + + + downloads + +
+ +
+ Docs +   •   + github +   •   + npm +
+ + + +
+ +## 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' @@ -71,4 +119,5 @@ if ( result.success ) { ``` ## TODO -- [ ] make reduced readme for npm \ No newline at end of file +- Auto publish to npm + - GitHub Actions ? \ No newline at end of file diff --git a/package.json b/package.json index 5ad7d89..f49692e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@weis-guys/result", - "version": "0.0.5", + "version": "0.0.6", "main": "lib.js", "type": "module", "author": "Jacob Weisenburger", diff --git a/scripts/build.ts b/scripts/build.ts index ec8fe7a..48ac23d 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -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( '' )[ 0 ] + .trim() + + await Bun.write( distPath, newContents ) + .then( () => console.log( section ) ) + .catch( logError( { section, distPath, contents } ) ) } ) .then( async () => { diff --git a/lib.test.ts b/src/lib.test.ts similarity index 100% rename from lib.test.ts rename to src/lib.test.ts diff --git a/lib.ts b/src/lib.ts similarity index 100% rename from lib.ts rename to src/lib.ts diff --git a/tsconfig.json b/tsconfig.json index 022740a..93a371f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,7 @@ ], }, "include": [ - "./**/*", + ".src/**/*", "package.json" ] } \ No newline at end of file