Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nisgrak committed Jul 24, 2020
0 parents commit 51e5ad2
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deno CI
on:
push:
branches:
- master
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
env:
GH_ACTIONS: true
DENO_BUILD_MODE: release
V8_BINARY: true
steps:
- uses: actions/checkout@v2
- name: Setup Deno
uses: denolib/setup-deno@master
with:
deno-version: 1.x
- name: Tests
run: deno test --allow-read
release:
name: Release
runs-on: ubuntu-18.04
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.17.0
- name: Setup package.json
run: echo '{"name":"@denorg/starter","version":"0.0.0","publishConfig":{"access":"public"},"scripts":{"semantic-release":"semantic-release"},"repository":{"type":"git","url":"https://github.com/denorg/starter.git"},"author":"Denorg<[email protected]>","license":"MIT","bugs":{"url":"https://github.com/denorg/starter/issues"},"homepage":"https://denorg.github.io/starter/","devDependencies":{"semantic-release":"^17.0.4","semantic-release-gitmoji":"^1.3.3"}}' > package.json
- name: Install dependencies
run: npm install
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test CI
on:
push:
branches-ignore:
- "master"
pull_request:
branches-ignore:
- "master"
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
env:
GH_ACTIONS: true
DENO_BUILD_MODE: release
V8_BINARY: true
steps:
- uses: actions/checkout@v2
- name: Setup Deno
uses: denolib/setup-deno@master
with:
deno-version: 1.x
- name: Run tests
run: deno test --allow-read
16 changes: 16 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": [
[
"semantic-release-gitmoji",
{
"releaseRules": {
"patch": {
"include": [":bento:", ":recycle:"]
}
}
}
],
"@semantic-release/github",
"@semantic-release/npm"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deno.enable": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Anand Chowdhary <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# 🏁 Deno Starter

This is a starter template for building Deno packages in TypeScript, with GitHub Actions-powered CI, tests, CLI, and Semantic Release on GitHub and npm.

[![Deno CI](https://github.com/denorg/starter/workflows/Deno%20CI/badge.svg)](https://github.com/denorg/starter/actions)
[![GitHub](https://img.shields.io/github/license/denorg/starter)](https://github.com/denorg/starter/blob/master/LICENSE)
[![Contributors](https://img.shields.io/github/contributors/denorg/starter)](https://github.com/denorg/starter/graphs/contributors)
[![Deno Starter](https://img.shields.io/badge/deno-starter-brightgreen)](https://denorg.github.io/starter/)
[![Made by Denorg](https://img.shields.io/badge/made%20by-denorg-0082fb)](https://github.com/denorg)
[![TypeScript](https://img.shields.io/badge/types-TypeScript-blue)](https://github.com/denorg/starter)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

## 💡 How to use

1. [Create a new repository](https://github.com/denorg/starter/generate) using this template
2. Update the project name ("Deno Starter") from the first line in `README.md`
3. Find and replace "denorg/starter" with your "username/repository" in `README.md`
4. Update the "Getting started" guide with your exported functions' names
5. In `.github/workflows/*.yml` files, add additional permissions after `deno test`
6. Setup Semantic Release
- Add a repository secret `NPM_TOKEN` with your npm token
- In `.github/workflows/deno.yml`, find and replace "denorg/starter" with your "username/repository"
7. Remove this section ("How to use") after setting up your respoitory

If you're not building a Denorg project, the following steps are required too:

1. Remove the "A project by Denorg..." footer from `README.md`
2. Remove the "Made by Denorg" shield from the `README.md` badges section
3. Change the "Denorg" name to yours in `LICENSE` and under "License" in `README.md`

## ⭐ Getting started

Import the `mode` function and use it:

```ts
import { mode } from "https://raw.githubusercontent.com/denorg/starter/master/mod.ts";

const result = mode();
```

### CLI with [DPX](https://github.com/denorg/dpx)

After [installing DPX](https://github.com/denorg/dpx), you can directly use the CLI using the `dpx` command:

```bash
dpx --allow-read starter <arguments>
```

### CLI

Alternatively, you can use it directly from the CLI by using `deno run`:

```bash
deno run --allow-read https://raw.githubusercontent.com/denorg/starter/master/cli.ts <arguments>
```

You can also install it globally using the following:

```bash
deno install --allow-read -n starter https://raw.githubusercontent.com/denorg/starter/master/cli.ts
```

Then, the package is available to run:

```bash
starter <arguments>
```

### Configuration

Required permissions:

1. `--allow-read`

## 👩‍💻 Development

Run tests:

```bash
deno test --allow-read
```

## 📄 License

MIT © [Denorg](https://den.org.in)

<p align="center">
<a href="https://den.org.in">
<img width="100" alt="" src="https://raw.githubusercontent.com/denorg/denorg/master/logo.svg">
</a>
</p>
<p align="center">
<sub>A project by <a href="https://den.org.in">Denorg</a>, the world's first Deno-focused community<br>organization and consulting company. <a href="https://den.org.in">Work with us →</a></sub>
</p>
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-minimal
8 changes: 8 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mode } from "./mod.ts";

// https://deno.land/manual/tools/script_installer
if (import.meta.main) {
for (let arg of Deno.args) {
console.log(arg, mode());
}
}
4 changes: 4 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** JSDoc for this line */
export function mode() {
return 0;
}
6 changes: 6 additions & 0 deletions mod_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import { mode } from "./mod.ts";

Deno.test("test starter function", async (): Promise<void> => {
assertEquals(mode(), 0);
});

0 comments on commit 51e5ad2

Please sign in to comment.