generated from denorg/starter
-
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
0 parents
commit 51e5ad2
Showing
10 changed files
with
226 additions
and
0 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 |
---|---|---|
@@ -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 }} |
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,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 |
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,16 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"semantic-release-gitmoji", | ||
{ | ||
"releaseRules": { | ||
"patch": { | ||
"include": [":bento:", ":recycle:"] | ||
} | ||
} | ||
} | ||
], | ||
"@semantic-release/github", | ||
"@semantic-release/npm" | ||
] | ||
} |
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,3 @@ | ||
{ | ||
"deno.enable": true | ||
} |
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,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. |
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,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. | ||
|
||
[](https://github.com/denorg/starter/actions) | ||
[](https://github.com/denorg/starter/blob/master/LICENSE) | ||
[](https://github.com/denorg/starter/graphs/contributors) | ||
[](https://denorg.github.io/starter/) | ||
[](https://github.com/denorg) | ||
[](https://github.com/denorg/starter) | ||
[](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> |
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 @@ | ||
theme: jekyll-theme-minimal |
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,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()); | ||
} | ||
} |
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,4 @@ | ||
/** JSDoc for this line */ | ||
export function mode() { | ||
return 0; | ||
} |
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,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); | ||
}); |