Skip to content

Commit

Permalink
Revert "chore: remove npm build"
Browse files Browse the repository at this point in the history
This reverts commit 42f1af6.
  • Loading branch information
kitsonk committed Mar 5, 2024
1 parent b4b616a commit a532445
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jobs:

- name: run tests generating coverage
run: deno task test:coverage

- name: run tests no check
run: deno task test:no-check

- name: test build for Node.js
run: deno task build

- name: generate lcov
run: deno task coverage > cov.lcov
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
!.vscode
.tool-versions
oak.bundle.js
cov.lcov
cov/
npm/
63 changes: 63 additions & 0 deletions _build_npm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-net --allow-env --allow-run
// Copyright 2018-2024 the oak authors. All rights reserved. MIT license.

/**
* This is the build script for building the oak framework into a Node.js
* compatible npm package.
*
* @module
*/

import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts";
import { copy } from "https://deno.land/[email protected]/fs/copy.ts";

async function start() {
await emptyDir("./npm");
await copy("fixtures", "npm/esm/fixtures", { overwrite: true });
await copy("fixtures", "npm/script/fixtures", { overwrite: true });

await build({
entryPoints: ["./mod.ts"],
outDir: "./npm",
shims: {
blob: true,
crypto: true,
deno: true,
undici: true,
},
test: true,
typeCheck: false,
compilerOptions: {
importHelpers: true,
target: "ES2022",
lib: ["ESNext", "DOM", "DOM.Iterable"],
},
package: {
name: "@oakserver/oak",
version: Deno.args[0],
description: "A middleware framework for handling HTTP requests",
license: "MIT",
engines: {
node: ">=16.5.0 <22",
},
repository: {
type: "git",
url: "git+https://github.com/oakserver/oak.git",
},
bugs: {
url: "https://github.com/oakserver/oak/issues",
},
dependencies: {
"tslib": "~2.6.2",
},
devDependencies: {
"@types/node": "^20",
},
},
});

await Deno.copyFile("LICENSE", "npm/LICENSE");
await Deno.copyFile("README.md", "npm/README.md");
}

start();
2 changes: 2 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"./testing": "./testing.ts"
},
"tasks": {
"build": "deno run --allow-read --allow-write --allow-net --allow-env --allow-run _build_npm.ts",
"coverage": "deno coverage --lcov ./cov",
"example": "deno run --allow-net examples/echoServer.ts",
"test": "deno test --allow-read --allow-write --allow-net --parallel --ignore=npm",
"test:no-check": "deno test --allow-read --allow-write --allow-net --no-check --parallel --ignore=npm,http_server_native_unstable_test.ts",
"test:coverage": "deno test --coverage=./cov --allow-read --allow-write --allow-net --cert ./examples/tls/RootCA.crt --parallel --ignore=npm"
},
"fmt": {
Expand Down

0 comments on commit a532445

Please sign in to comment.