Skip to content

Commit fb8493a

Browse files
authored
Merge pull request #2 from myty:feature/dnt-npm-package
update npm buid script
2 parents 39a69f0 + f25b773 commit fb8493a

File tree

5 files changed

+74
-170
lines changed

5 files changed

+74
-170
lines changed

.github/workflows/npm.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,27 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12+
1213
- uses: denoland/[email protected]
1314
with:
1415
deno-version: v1.x
15-
# Setup .npmrc file to publish to npm
16+
17+
- name: check format
18+
run: deno fmt --check
19+
20+
- name: check linting
21+
run: deno lint
22+
23+
- name: build npm package
24+
run: deno run -A _build_npm.ts {{ github.ref }}
25+
1626
- uses: actions/setup-node@v2
1727
with:
1828
node-version: '16.x'
1929
registry-url: 'https://registry.npmjs.org'
20-
- run: npm run prepare
21-
- run: npm publish
30+
31+
- run: |
32+
cd npm
33+
npm publish
2234
env:
2335
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ dist
103103
# TernJS port file
104104
.tern-port
105105

106-
index.bundle.js
106+
npm/

_build_npm.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-net --allow-env --allow-run
2+
// Copyright 2018-2022 the oak authors. All rights reserved. MIT license.
3+
4+
/**
5+
* This is the build script for building the oak framework into a Node.js
6+
* compatible npm package.
7+
*
8+
* @module
9+
*/
10+
11+
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts";
12+
13+
async function start() {
14+
await emptyDir("./npm");
15+
16+
await build({
17+
entryPoints: ["./mod.ts"],
18+
outDir: "./npm",
19+
shims: {
20+
deno: true,
21+
timers: true,
22+
},
23+
test: true,
24+
compilerOptions: {
25+
importHelpers: true,
26+
target: "ES2021",
27+
},
28+
package: {
29+
name: "jimmy-js",
30+
version: Deno.args[0].substring(1),
31+
description: "An simple mediator for both Deno and Node.js",
32+
license: "MIT",
33+
author: "Michael Tyson",
34+
engines: {
35+
node: ">=16.5.0 <18",
36+
},
37+
repository: {
38+
type: "git",
39+
url: "git+https://github.com/myty/jimmy.git",
40+
},
41+
bugs: {
42+
url: "https://github.com/myty/jimmy/issues",
43+
},
44+
homepage: "https://github.com/myty/jimmy#readme",
45+
dependencies: {
46+
"tslib": "~2.3.1",
47+
},
48+
devDependencies: {
49+
"@types/node": "^16",
50+
},
51+
},
52+
});
53+
54+
await Deno.copyFile("LICENSE", "npm/LICENSE");
55+
await Deno.copyFile("README.md", "npm/README.md");
56+
}
57+
58+
start();

index.d.ts

Lines changed: 0 additions & 138 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)