-
-
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
1 parent
8a98234
commit c1d4ac0
Showing
16 changed files
with
124 additions
and
24 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,3 +1,7 @@ | ||
## 0.1.0 | ||
|
||
- Custom esbuild file | ||
|
||
## 0.0.11 | ||
|
||
- Cleanup | ||
|
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,55 @@ | ||
# Build scripts and configuration | ||
|
||
## Installation | ||
|
||
Add configuration and setup scripts: | ||
|
||
```sh | ||
npm install -D -E baxast | ||
``` | ||
|
||
## Usage | ||
|
||
`package.json` | ||
|
||
```json | ||
{ | ||
"name": "my-awesome-package", | ||
"scripts": { | ||
"prepublishOnly": "baxast 'Source/**/*.ts'" | ||
}, | ||
"dependencies": { | ||
"baxast": "latest" | ||
} | ||
} | ||
``` | ||
|
||
or with a custom esbuild config file: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"prepublishOnly": "baxast 'Source/**/*.ts' -es ESBuild.ts" | ||
} | ||
} | ||
``` | ||
|
||
#### See an example of a config file in [ESBuild.ts](Source/Configuration/esbuild.ts) | ||
|
||
`tsconfig.json` | ||
|
||
```json | ||
{ | ||
"compilerOptions": { | ||
"outDir": "Target" | ||
}, | ||
"extends": "./Source/Configuration/TypeScript", | ||
"include": ["Source"] | ||
} | ||
``` | ||
|
||
The script will now automatically compile your build files with [esbuild] and | ||
add TypeScript types. | ||
|
||
[baxast]: https://npmjs.org/baxast | ||
[esbuild]: https://npmjs.org/esbuild |
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
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
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,30 @@ | ||
import { readFile as _File, writeFile as File } from "fs/promises"; | ||
import TypeScript from "typescript"; | ||
import { pathToFileURL as URL } from "url"; | ||
import _JSON from "./JSON.js"; | ||
|
||
export default async (Path: string) => { | ||
if (Path.split(".").pop() === "ts") { | ||
const { options } = TypeScript.convertCompilerOptionsFromJson( | ||
(await _JSON("../Configuration/TypeScript.json", import.meta.url)) | ||
?.compilerOptions, | ||
"." | ||
); | ||
|
||
TypeScript.createProgram( | ||
[Path], | ||
options, | ||
TypeScript.createCompilerHost(options) | ||
).emit(); | ||
|
||
await File( | ||
Path.replace(".ts", ".js"), | ||
TypeScript.transpile( | ||
(await _File(Path, "utf-8")).toString(), | ||
options | ||
) | ||
); | ||
} | ||
|
||
return (await import(URL(Path).toString().replace(".ts", ".js"))).default; | ||
}; |
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,6 +1,7 @@ | ||
import type { Pattern } from "fast-glob"; | ||
export type Pipe = string[]; | ||
declare const _default: (Files: Pattern[], Options?: { | ||
esbuild?: string; | ||
TypeScript?: string; | ||
}) => Promise<void>; | ||
export default _default; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
declare const _default: (Path: string) => Promise<any>; | ||
export default _default; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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