Skip to content

Commit

Permalink
misc: template init
Browse files Browse the repository at this point in the history
  • Loading branch information
antho-bunny committed Sep 3, 2024
0 parents commit 9ec58ec
Show file tree
Hide file tree
Showing 22 changed files with 1,364 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
25 changes: 25 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Setup Node, deno, pnpm & install'

description: 'Setup node, deno, pnpm and install'

runs:
using: "composite"
steps:
- uses: pnpm/[email protected]
with:
version: 8

- uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: './pnpm-lock.yaml'

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install
shell: bash
run: pnpm install --frozen-lockfile

38 changes: 38 additions & 0 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Changeset

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
permissions:
contents: write
issues: write
pull-requests: write

if: github.repository == 'BunnyWay/es-empty-script'

name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.BUNNY_GITHUB }}

- name: Setup Javascript
uses: ./.github/actions/setup-project

- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.BUNNY_GITHUB }}
with:
publish: "pnpm run ci:publish"
version: "pnpm run ci:version"
title: "🎉 Release"
createGithubReleases: true
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Continous integration

on:
push:
branches:
- '*'

jobs:
checkout:
runs-on: ubuntu-latest

name: 'Install, lint and test'

steps:
- name: 'Checkout'
uses: actions/checkout@v4

- name: 'Setup Javascript'
uses: ./.github/actions/setup-project

- name: 'Lint'
run: deno task lint

- name: 'Test'
run: deno task test
31 changes: 31 additions & 0 deletions .github/workflows/on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: On merge changeset

on:
pull_request:
types: [closed]
branches:
- 'main'

jobs:
publish:
if: contains(github.event.pull_request.head.ref, 'changeset-release')

name: 'Upload script'
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: 'Setup Javascript'
uses: ./.github/actions/setup-project

- name: Bundle the script into a single file
run: deno task build

- name: Publish the script to Bunny
uses: 'BunnyWay/actions/deploy-script@main'
with:
script_id: ${{ secrets.SCRIPT_ID }}
deploy_key: ${{ secrets.DEPLOY_KEY }}
file: "dist/index.ts"
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/
/dist/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.vscode

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Template: es-return-json

This templates demonstrates a basic return JSON built for Bunny using a local `Deno`.

> You do not want to use Deno? Feel free to use something else, [here](https://bunny.net) is a full
> fledged example with `node` instead!
This templated script is currently deployed
[here](https://es-simple-script-8rxx0.b-cdn.net/).

## Setup

To run this example you'll need to have a valid
[Deno](https://docs.deno.com/runtime/manual/getting_started/installation/) installation.

When you have the `deno` binary available, you should be able to run the `check`
task which is the task ensuring everything is compiling fine.

```
# A tiny lint just to be sure!
deno task lint
# We ensure everything is type compliant!
deno task check
```

We also use `pnpm` to use `changeset`.

## Changeset

In this template, we handle versionning with [changeset](https://github.com/changesets/changesets),
each time you do a change, you'll need to indicate the kind of changes you are
doing so we can have the auto-release process ongoing by doing:

```
pnpm changeset
```
45 changes: 45 additions & 0 deletions assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"_id": "66d5bb3e6f40c2b8c79d2181",
"index": 0,
"guid": "0919937a-ec3a-4bc4-a9e7-0b61989320a7",
"isActive": true,
"balance": "$2,314.39",
"picture": "http://placehold.it/32x32",
"age": 24,
"eyeColor": "green",
"name": "Burton Schneider",
"gender": "male",
"company": "ZOID",
"email": "[email protected]",
"phone": "+1 (931) 517-3038",
"address": "147 Union Avenue, Guthrie, Marshall Islands, 4881",
"about": "Sit eiusmod nisi do nostrud tempor reprehenderit exercitation. Elit dolore do eiusmod Lorem magna. Fugiat aute aliquip duis duis magna aliqua dolor enim. Consequat enim Lorem ut irure voluptate aute reprehenderit qui minim laborum et.\r\n",
"registered": "2016-07-17T07:24:51 -02:00",
"latitude": -64.636593,
"longitude": 96.308249,
"tags": [
"ea",
"id",
"sint",
"minim",
"ex",
"laborum",
"pariatur"
],
"friends": [
{
"id": 0,
"name": "Price Wilkinson"
},
{
"id": 1,
"name": "Brennan Jarvis"
},
{
"id": 2,
"name": "Boone Higgins"
}
],
"greeting": "Hello, Burton Schneider! You have 2 unread messages.",
"favoriteFruit": "banana"
}
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "es-hono-pet-store",
"version": "0.1.0",
"main": "src/index.ts",
"type": "module",
"private": true,
"repository": {
"type": "git",
"url": "git+https://github.com/BunnyWay/es-hono-pet-store.git"
},
"keywords": [
"github",
"bunny"
],
"author": "Bunny Devs",
"license": "MIT",
"scripts": {
"lint": "deno lint",
"test": "deno test --allow-none -A src/**/*.test.ts",
"check": "deno check src/main.ts",
"build": "mkdir -p dist && deno bundle src/main.ts dist/index.ts",
"dev": "deno run src/main.ts",
"release": "echo \"No release\"",
"ci:version": "pnpm changeset version",
"ci:publish": "./scripts/publish.sh"
},
"devDependencies": {
"@changesets/cli": "^2.26.2"
}
}
Loading

0 comments on commit 9ec58ec

Please sign in to comment.