-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create runnable node.js code with https://github.com/denoland/dnt
To create a publishable build: ```sh cd deno deno task build-npm-package cd ../npm/ npm publish ```
- Loading branch information
Showing
5 changed files
with
69 additions
and
4 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
node_modules | ||
elm-stuff | ||
elm-home | ||
npm | ||
bun | ||
compare |
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 |
---|---|---|
|
@@ -85,14 +85,19 @@ There are three options when you have [deno](https://deno.land) installed. | |
3. Compile a huge binary that contains the deno runtime | ||
|
||
``` | ||
deno compile --allow-env=ELM_HOME,HOME --allow-read --allow-write --allow-net=github.com,codeload.github.com,api.github.com --output elm-janitor-apply-patches https://raw.githubusercontent.com/elm-janitor/apply-patches/main/deno/cli.ts | ||
❯ deno compile --allow-env=ELM_HOME,HOME --allow-read --allow-write --allow-net=github.com,codeload.github.com,api.github.com --output elm-janitor-apply-patches https://raw.githubusercontent.com/elm-janitor/apply-patches/main/deno/cli.ts | ||
``` | ||
|
||
### With node.js | ||
|
||
If there ever will be a stable version, use | ||
https://deno.land/[email protected]/advanced/publishing/dnt to generate a node | ||
module. | ||
The script is also published to | ||
[npm](https://www.npmjs.com/package/elm-janitor-apply-patches). | ||
|
||
You can run it in the node.js runtime for instance like this: | ||
|
||
``` | ||
❯ npx elm-janitor-apply-patches | ||
``` | ||
|
||
### By downloading a binary | ||
|
||
|
@@ -158,6 +163,11 @@ cd .. | |
Then re-run the tests or compile the example `src/Main.elm` file to see the | ||
output of the new `deadEndsToString`. | ||
|
||
### Publishing to npm | ||
|
||
For information how to publish this deno code to npm as a node.js script, see | ||
[explanation](https://github.com/elm-janitor/apply-patches/blob/main/deno/README.md#publish-as-an-npm-package) | ||
|
||
## Notes | ||
|
||
If you rely on local documentation, you can also generate the `docs.json` file | ||
|
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"tasks": { | ||
"build-npm-package": "deno run --allow-env --allow-net=deno.land --allow-write=../npm --allow-read --allow-run=npm scripts/build_npm.ts", | ||
"update-deps": "deno cache --reload --lock=deno.lock deps.ts" | ||
} | ||
} |
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,41 @@ | ||
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { path } from "../deps.ts"; | ||
|
||
const outDir = "../npm"; | ||
await emptyDir(outDir); | ||
|
||
await build({ | ||
entryPoints: [{ | ||
kind: "bin", | ||
name: "elm-janitor-apply-patches", | ||
path: "./cli.ts", | ||
}], | ||
outDir, | ||
shims: { | ||
// see JS docs for overview and more options | ||
deno: true, | ||
}, | ||
typeCheck: false, | ||
test: false, | ||
declaration: false, | ||
scriptModule: false, | ||
package: { | ||
// package.json properties | ||
name: "elm-janitor-apply-patches", | ||
version: "0.1.0", | ||
description: "Script to apply the elm-janitor patches to ELM_HOME.", | ||
license: "UNLICENSE", | ||
repository: { | ||
type: "git", | ||
url: "git+https://github.com/elm-janitor/apply-patches.git", | ||
}, | ||
bugs: { | ||
url: "https://github.com/elm-janitor/apply-patches/issues", | ||
}, | ||
}, | ||
postBuild() { | ||
// steps to run after building and before running the tests | ||
Deno.copyFileSync("../UNLICENSE", path.join(outDir, "UNLICENSE")); | ||
Deno.copyFileSync("../README.md", path.join(outDir, "README.md")); | ||
}, | ||
}); |