Skip to content

Commit

Permalink
Build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rametta committed Jun 5, 2024
1 parent 39ed6de commit df420d4
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 34 deletions.
Binary file modified bun.lockb
Binary file not shown.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
"main": "dist/index.cjs",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"type": "module",
"sideEffects": false,
"private": false,
"license": "Apache-2.0",
"devDependencies": {
"prettier": "^3.3.1",
"rollup": "^1.23.1",
"rollup-plugin-typescript2": "^0.24.3",
"typescript": "^3.6.3",
"rollup": "^4.18.0",
"rollup-plugin-typescript2": "^0.36.0",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"bugs": {
Expand All @@ -32,9 +33,7 @@
],
"scripts": {
"test": "vitest",
"build:tsd": "rm -rf dist && tsc src/index.ts --emitDeclarationOnly -d --outDir dist",
"rollup": "rollup -c",
"build": "bun run build:tsd && bun run rollup",
"build": "bun run rollup -c",
"deploy": "bun run build && bun run publish",
"pretty": "prettier --check 'src/**/*.ts'",
"pretty-fix": "prettier --write 'src/**/*.ts'"
Expand Down
29 changes: 12 additions & 17 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import typescript from 'rollup-plugin-typescript2'
import { RollupOptions } from "rollup";
import typescriptPlugin from "rollup-plugin-typescript2"
import typescript from "typescript"

/** @type {RollupOptions} */
export default {
input: 'src/index.ts',
input: "src/index.ts",
output: [
{
name: 'pratica',
format: 'cjs',
file: 'dist/index.cjs'
name: "pratica",
format: "cjs",
file: "dist/index.cjs",
},
{
name: 'pratica',
format: 'es',
file: 'dist/index.esm.js'
}
],
plugins: [
typescript({
typescript: require('typescript'),
})
name: "pratica",
format: "es",
file: "dist/index.esm.js",
},
],
}
plugins: [typescriptPlugin({ typescript, tsconfig: "tsconfig.build.json" })],
}
2 changes: 1 addition & 1 deletion src/encase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export const encaseRes = <A, E>(func: () => A): Result<A, E> => {
try {
return Ok<A>(func())
} catch (e) {
return Err<E>(e)
return Err<E>(e as E)
}
}
2 changes: 1 addition & 1 deletion src/parseDate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { nullable, Maybe, Nothing, Just } from "./maybe"

export const parseDate = (date: string | number | Date | undefined | null): Maybe<Date> =>
export const parseDate = (date: string | number | undefined | null): Maybe<Date> =>
nullable(date)
.map((d) => new Date(d))
.chain((d) => (isNaN(d.valueOf()) ? Nothing : Just(d)))
25 changes: 25 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"declaration": true,
"outDir": "dist",

/* Bundler mode */
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"strictNullChecks": true,

/* Sourcemaps */
"sourceMap": true,
},
"include": ["src"]
}
27 changes: 18 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"declaration": true,
"outDir": "dist",

/* Bundler mode */
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"noEmit": true
"isolatedModules": true,

/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"strictNullChecks": true,

/* Sourcemaps */
"sourceMap": true,
},
"include": ["src", "specs"]
}

0 comments on commit df420d4

Please sign in to comment.