diff options
author | 2021-10-26 17:09:38 -0700 | |
---|---|---|
committer | 2021-10-26 17:09:38 -0700 | |
commit | 221b280856068aad1f1886c006f28e8900236d4a (patch) | |
tree | 881d2550a0ff52e351702990581c7e5ddab081dd | |
parent | 933378ab80e2893bf143fcc2b600032030461368 (diff) | |
download | bun-221b280856068aad1f1886c006f28e8900236d4a.tar.gz bun-221b280856068aad1f1886c006f28e8900236d4a.tar.zst bun-221b280856068aad1f1886c006f28e8900236d4a.zip |
spacing
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | src/cli.zig | 1 | ||||
-rw-r--r-- | src/options.zig | 5 |
3 files changed, 7 insertions, 6 deletions
@@ -52,10 +52,6 @@ bun run clean bun clean ``` -For maximum performance, any scripts that invoke `npm run`, `yarn run`, or `pnpm run` will automatically be replaced in-memory with `bun run`. This means you can try `bun run` in existing codebases that aren't using Bun and get an immediate performance boost. - -`bun run` supports lifecycle hooks like `post${task}` and `pre{task}`, adds `node_modules/.bin` to `$PATH` (for all parent `node_modules` folders), and automatically loads `.env` files if they exist. Like with yarn, you can use `bun run` without typing `run` (but any new subcommands will override it, so be warned!) - ## Using Bun with Next.js To create a new Next.js app with Bun: @@ -184,7 +180,6 @@ Bun is a project with incredibly large scope, and it's early days. | Sharing `.bun` files | Bun | | [Finish fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | Bun.js | | [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) | Bun.js | -| `bun run` command | Bun.js | <sup>JS Transpiler == JavaScript Transpiler</sup><br/> <sup>TS Transpiler == TypeScript Transpiler</sup><br/> @@ -524,6 +519,8 @@ The default shell it uses is `bash`, but if that's not found, it tries `sh` and `bun run` automatically adds any parent `node_modules/.bin` to `$PATH` and if no scripts match, it will load that binary instead. That means you can run executables from packages too. +`bun run` supports lifecycle hooks like `post${task}` and `pre{task}`. If they exist, they will run matching the behavior of npm clients. If the `pre${task}` fails, the next task will not be run. There is currently no flag to skip these lifecycle tasks if they exist, if you want that file an issue. + ```bash # If you use Relay bun run relay-compiler diff --git a/src/cli.zig b/src/cli.zig index df9357cf3..cfbaa9850 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -458,6 +458,7 @@ const HelpCommand = struct { \\> <r> <b><green>dev <r><d> ./a.ts ./b.jsx<r> Start a Bun Dev Server \\> <r> <b><magenta>bun <r><d> ./a.ts ./b.jsx<r> Bundle dependencies of input files into a <r><magenta>.bun<r> \\> <r> <b><cyan>create <r><d> next ./app<r> Start a new project from a template <d>(shorthand: c)<r> + \\> <r> <b><green>run <r><d> test <r> Run a package.json script or executable<r> \\> <r> <b><blue>discord <r> Open Bun's Discord server \\> <r> <b><d>help <r> Print this help menu \\ diff --git a/src/options.zig b/src/options.zig index e40939b2b..bd38cb83a 100644 --- a/src/options.zig +++ b/src/options.zig @@ -601,11 +601,14 @@ pub const defaultLoaders = std.ComptimeStringMap(Loader, .{ .{ ".jsx", Loader.jsx }, .{ ".json", Loader.json }, .{ ".js", Loader.jsx }, + .{ ".mjs", Loader.js }, + .{ ".cjs", Loader.js }, + .{ ".css", Loader.css }, .{ ".ts", Loader.ts }, .{ ".tsx", Loader.tsx }, - .{ ".cjs", Loader.js }, + .{ ".mts", Loader.ts }, .{ ".cts", Loader.ts }, }); |