Skip to content

Commit

Permalink
♻️ Did a bunch of cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
Schotsl committed Aug 20, 2024
1 parent 76aa7fa commit 08e7b69
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 188 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup latest Deno version
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: vx.x.x

- name: Run Deno fmt
run: deno fmt --check **.ts
- name: Check formatting with Deno
run: deno task format:check

- name: Run Deno lint
run: deno lint **.ts
- name: Check linting with Deno
run: deno task lint

test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup latest Deno version
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: vx.x.x

- name: Run Deno test
run: deno test index.ts
run: deno task test
65 changes: 23 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,45 @@ on:
- published

jobs:
quality:
name: Quality
publish-npm:
name: Publish NPM
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup latest Deno version
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: vx.x.x

- name: Run Deno fmt
run: deno fmt --check **.ts

- name: Run Deno lint
run: deno lint **.ts

test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup latest Deno version
uses: denolib/setup-deno@v2
- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
deno-version: v1.x
node-version: "latest"
registry-url: "https://registry.npmjs.org"

- name: Building package
run: deno task build

- name: Run Deno test
run: deno test index.ts
- name: Publishing to NPM
run: cd npm && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

deploy:
name: NPM publish
publish-jsr:
name: Publish JSR
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup latest Deno version
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Setup Node.js 20
uses: actions/setup-node@v2
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
deno-version: vx.x.x

- name: Building package
run: deno run --allow-run=npm --allow-net=deno.land --allow-env=HOME,DENO_AUTH_TOKENS,DENO_DIR,XDG_CACHE_HOME --allow-read --allow-write build.ts

- name: Publishing to NPM
run: cd dist && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publishing to JSR
run: deno publish --token ${{ secrets.JSR_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
# Temporary build files for NPM
npm
25 changes: 16 additions & 9 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import { build, emptyDir } from "https://deno.land/x/dnt@0.40.0/mod.ts";
import { build, emptyDir } from "@deno/dnt";

await emptyDir("./npm");
await build({
entryPoints: ["./index.ts"],
outDir: "./npm",
shims: {
deno: true,
},
package: {
name: "uwuifier",
author: "Sjors van Holst",
license: "MIT",
version: "4.1.0",
version: "4.1.1",
homepage: "https://uwuifier.com",
repository: "git://github.com/Schotsl/Uwuifier.git",
description:
"Uwuifier is a lightweight package that allows you to uwuify any words or sentences (excluding URL's) with many configurable parameters",
`Uwuifier is a lightweight package that allows you to uwuify any words or sentences (excluding URL's) with many configurable parameters!`,
repository: {
url: "git+https://github.com/Schotsl/Uwuifier.git",
type: "git",
},
bugs: {
url: "https://github.com/Schotsl/Uwuifier/issues",
},
},
postBuild() {
Deno.copyFileSync("README.md", "npm/README.md");
Deno.copyFileSync("LICENSE.md", "npm/LICENSE.md");
},
outDir: "./dist",
entryPoints: ["./index.ts"],
});

Deno.copyFileSync("README.md", "dist/README.md");
Deno.copyFileSync("LICENSE.md", "dist/LICENSE.md");
13 changes: 11 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"name": "@schotsl/uwuifier",
"version": "4.1.0",
"exports": "./index.ts"
"version": "4.1.1",
"exports": "./index.ts",
"imports": { "@deno/dnt": "jsr:@deno/dnt@^0.41.3" },
"exclude": ["npm"],
"tasks": {
"lint": "deno lint",
"test": "deno test test.ts",
"build": "deno run --allow-env --allow-read --allow-write --allow-net --allow-run build.ts",
"format": "deno fmt",
"format:check": "deno fmt --check"
}
}
Loading

0 comments on commit 08e7b69

Please sign in to comment.