-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import * as esbuild from 'npm:esbuild' | ||
|
||
console.log( | ||
await esbuild.build({ | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
outdir: 'dist', | ||
format: 'esm', | ||
}), | ||
) | ||
import { execSync } from 'node:child_process' | ||
|
||
const pkg = JSON.parse(Deno.readTextFileSync('./deno.json')) | ||
|
||
try { | ||
Deno.removeSync('./package.json') | ||
console.log('Previous package.json removed.') | ||
} catch { // NOOP | ||
} | ||
|
||
const packageJson = { | ||
name: pkg.name, | ||
version: pkg.version, | ||
main: 'dist/index.js', | ||
type: 'module', | ||
exports: { | ||
'.': { | ||
import: './dist/index.mjs', | ||
require: './dist/index.cjs', | ||
}, | ||
}, | ||
main: './dist/index.cjs', | ||
types: './dist/index.d.ts', | ||
files: ['dist'], | ||
author: 'YieldRay', | ||
license: 'MIT', | ||
|
@@ -33,6 +33,9 @@ const packageJson = { | |
homepage: 'https://github.com/YieldRay/json-rpc-ts#readme', | ||
} | ||
|
||
Deno.writeTextFileSync('./package.json', JSON.stringify(packageJson, null, 4)) | ||
console.log('New package.json created.') | ||
console.log(packageJson) | ||
|
||
Deno.writeTextFileSync('./package.json', JSON.stringify(packageJson, null, 4)) | ||
console.log('Building package using unbuild...') | ||
execSync('npx [email protected]', { stdio: ['ignore', 'inherit', 'inherit'] }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This file is redundant for Deno | ||
// But necessary for unbuild, as it indirectly reads this config | ||
// https://docs.deno.com/runtime/manual/advanced/typescript/configuration | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"experimentalDecorators": false, | ||
"inlineSourceMap": true, | ||
"isolatedModules": true, | ||
"jsx": "react", | ||
"module": "esnext", | ||
"moduleDetection": "force", | ||
"strict": true, | ||
"target": "esnext", | ||
"useDefineForClassFields": true, | ||
"allowImportingTsExtensions": true | ||
} | ||
} |