add npm packaging info

This commit is contained in:
ading2210 2024-01-28 22:56:14 -08:00
parent a7be55fd23
commit 58a8f2259e
5 changed files with 33 additions and 5 deletions

View file

@ -21,6 +21,6 @@ jobs:
- name: upload img - name: upload img
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: out name: libcurl
path: client/out/* path: client/out/*
compression-level: 9 compression-level: 9

View file

@ -26,7 +26,7 @@ sudo apt install make cmake emscripten autoconf automake libtool pkg-config wget
The build script will generate `client/out/libcurl.js` as well as `client/out/libcurl_module.mjs`, which is an ES6 module. You can supply the following arguments to the build script to control the build: The build script will generate `client/out/libcurl.js` as well as `client/out/libcurl_module.mjs`, which is an ES6 module. You can supply the following arguments to the build script to control the build:
- `release` - Use all optimizations. - `release` - Use all optimizations.
- `single_file` - Include the WASM binary in the outputted JS using base64. - `single_file` - Include the WASM binary in the outputted JS using base64.
- `all` - Build twice, once normally, and once as a single file.
## Javascript API: ## Javascript API:

19
client/npm/package.json Normal file
View file

@ -0,0 +1,19 @@
{
"name": "libcurl.js",
"version": "0.1.0",
"description": "An experimental port of libcurl to WebAssembly for use in the browser.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ading2210/libcurl.js.git"
},
"author": "ading2210",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/ading2210/libcurl.js/issues"
},
"homepage": "https://github.com/ading2210/libcurl.js"
}

9
client/publish.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
#publish libcurl.js as an npm package
#run build.sh first
cp npm/* out
cp ../README.md out
cd out
npm publish

View file

@ -24,12 +24,12 @@ fi
if [ ! -d $BROTLI_PREFIX ]; then if [ ! -d $BROTLI_PREFIX ]; then
tools/brotli.sh tools/brotli.sh
fi fi
if [ ! -d $CURL_PREFIX ]; then
tools/curl.sh
fi
if [ ! -d $NGHTTP2_PREFIX ]; then if [ ! -d $NGHTTP2_PREFIX ]; then
tools/nghttp2.sh tools/nghttp2.sh
fi fi
if [ ! -d $CURL_PREFIX ]; then
tools/curl.sh
fi
cp -r $OPENSSL_PREFIX/* $CURL_PREFIX cp -r $OPENSSL_PREFIX/* $CURL_PREFIX
cp -r $CJSON_PREFIX/* $CURL_PREFIX cp -r $CJSON_PREFIX/* $CURL_PREFIX