Skip to content

Commit

Permalink
adding deno support
Browse files Browse the repository at this point in the history
  • Loading branch information
jabez007 committed Oct 31, 2024
1 parent 08258e7 commit 6763f17
Show file tree
Hide file tree
Showing 13 changed files with 1,677 additions and 375 deletions.
18 changes: 18 additions & 0 deletions .github/shared/jsr/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish to JSR
description: ''

inputs:
deno_version:
description: ''

runs:
using: composite
steps:
- name: Set up Deno ${{ inputs.deno_version }}
uses: denoland/setup-deno@v2
with:
deno-version: ${{ inputs.deno_version }}

- name: Publish package
run: deno publish --token ${{ env.JSR_TOKEN }}
shell: bash
14 changes: 14 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ jobs:
node_version: 22.x
env:
GHPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish_to_jsr:
runs-on: ubuntu-latest
permissions:
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Shared Publish to JSR
if: ${{ hashFiles('deno.json') != '' }}
uses: McCann-Hub/create-typescript-template/.github/shared/jsr/publish@master
with:
deno_version: 2.x
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extension": [
"ts"
],
"spec": "tests/**/*.ts",
"spec": "tests/**/*.spec.ts",
"require": [
"ts-node/register",
"tsconfig-paths/register"
Expand Down
34 changes: 17 additions & 17 deletions bin/ask-question.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
const readline = require('readline')
const readline = require('readline');

function question (inquiry) {
return new Promise(resolve => {
function question(inquiry) {
return new Promise((resolve) => {
const ui = readline.createInterface({
input: process.stdin,
output: process.stdout
})
output: process.stdout,
});

ui.question(inquiry, input => {
ui.close()
resolve(input)
})
})
ui.question(inquiry, (input) => {
ui.close();
resolve(input);
});
});
}

module.exports = async (query, preset = '', validate = () => true) => {
let resp
let resp;
while (true) {
resp = (await question(query)) || preset
const valid = validate(resp)
resp = (await question(query)) || preset;
const valid = validate(resp);
if (valid === true) {
break
break;
}
console.log(valid || `Invalid response: ${resp}`)
console.log(valid || `Invalid response: ${resp}`);
}
return resp
}
return resp;
};
19 changes: 16 additions & 3 deletions bin/github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
jobs:
publish_to_npm:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -28,9 +27,23 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Shared Publish to NPM
- name: Shared Publish to GHPR
uses: McCann-Hub/create-typescript-template/.github/shared/ghpr/publish@master
with:
node_version: 22.x
env:
GHPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GHPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish_to_jsr:
runs-on: ubuntu-latest
permissions:
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Shared Publish to JSR
if: ${{ hashFiles('deno.json') != '' }}
uses: McCann-Hub/create-typescript-template/.github/shared/jsr/publish@master
with:
deno_version: 2.x
Loading

0 comments on commit 6763f17

Please sign in to comment.