diff --git a/templates/.github/workflows/npm-publish.yml b/.github/workflows/bun-create-templates.yml similarity index 82% rename from templates/.github/workflows/npm-publish.yml rename to .github/workflows/bun-create-templates.yml index b80f34eec0..b5885f36eb 100644 --- a/templates/.github/workflows/npm-publish.yml +++ b/.github/workflows/bun-create-templates.yml @@ -1,12 +1,12 @@ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages -name: Publish NPM Packages +name: Publish bun-create templates on: push: branches: - - 'main' + - "main" jobs: publish-npm: @@ -19,11 +19,14 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - - run: npm install + - uses: actions/setup-bun - - run: node publish.js + - run: bun install + + - run: bun run publish.ts env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - uses: "EndBug/add-and-commit@v9" + with: default_author: github_actions diff --git a/docs/templates.md b/docs/templates.md index e80e95eda6..f1fa1298a4 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -156,8 +156,7 @@ Each of these can correspond to a string or array of strings. An array of comman }, "bun-create": { "preinstall": "echo 'Installing...'", // a single command - "postinstall": ["echo 'Done!'"], // an array of commands - "start": "bun run echo 'Hello world!'" + "postinstall": ["echo 'Done!'"] // an array of commands } } ``` @@ -246,7 +245,7 @@ ELSE IF local template 5. Auto-detect the npm client, preferring `pnpm`, `yarn` (v1), and lastly `npm` 6. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client 7. Run `${npmClient} install` unless `--no-install` is passed OR no dependencies are in package.json -8. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client +8. Run any tasks defined in `"bun-create": { "postinstall" }` with the npm client 9. Run `git init; git add -A .; git commit -am "Initial Commit";` - Rename `gitignore` to `.gitignore`. NPM automatically removes `.gitignore` files from appearing in packages. diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index 8614d10d75..663b55848b 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -1547,7 +1547,7 @@ pub const CreateCommand = struct { Output.pretty( \\ - \\Come hang out in bun's Discord: https://bun.sh/discord + \\Come hang out in Bun's Discord: https://bun.sh/discord \\ , .{}); @@ -2117,18 +2117,18 @@ pub const CreateListExamplesCommand = struct { Output.prettyln("Welcome to bun! Create a new project by pasting any of the following:\n\n", .{}); Output.flush(); - Example.print(examples.items, null); + Example.print(examples.items, "./my-app"); - Output.prettyln("# You can also paste a GitHub repository:\n\n bun create ahfarmer/calculator calc\n\n", .{}); + Output.prettyln("# To clone from a GitHub repository:\n\n bun create ahfarmer/calculator calc\n\n", .{}); if (env_loader.map.get("HOME")) |homedir| { Output.prettyln( - "This command is completely optional. To add a new local template, create a folder in {s}/.bun-create/. To publish a new template, git clone https://github.com/oven-sh/bun, add a new folder to the \"examples\" folder, and submit a PR.", + "This command is completely optional. To add a new local template, create a folder in {s}/.bun-create/. To publish a new template, fork https://github.com/oven-sh/bun, add a new directory to the \"templates\" folder, and submit a PR.", .{homedir}, ); } else { Output.prettyln( - "This command is completely optional. To add a new local template, create a folder in $HOME/.bun-create/. To publish a new template, git clone https://github.com/oven-sh/bun, add a new folder to the \"examples\" folder, and submit a PR.", + "This command is completely optional. To add a new local template, create a folder in $HOME/.bun-create/. To publish a new template, fork https://github.com/oven-sh/bun, add a new directory to the \"templates\" folder, and submit a PR.", .{}, ); } diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000000..b7bb47f4ea --- /dev/null +++ b/templates/README.md @@ -0,0 +1,66 @@ +# Templates for `bun create` + +This repo contains the templates for `bun create`. + +## Usage + +> Refer to the [Bun docs](https://bun.dev/docs/templates) for complete documentation of `bun create`. + +To see a list of all official templates: + +```bash +$ bun create +``` + +To scaffold a new project using a particular template: + +```bash +$ bun create