From d17a373a890545e9f84c10df74098661a2cc34ec Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 8 Oct 2019 13:07:57 -0600 Subject: [PATCH] update docs --- README.md | 61 +++++++++++++++++++++++++++++++++++++++-------- webpack.config.js | 4 ++-- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c708632..3a01e7e 100644 --- a/README.md +++ b/README.md @@ -51,26 +51,40 @@ var ACME = require('@root/acme'); ## WebPack +```html + +``` + +(necessary in case the webserver headers don't specify `plain/text; charset="UTF-8"`) + ```js var ACME = require('@root/acme'); ``` ## Vanilla JS -```js -var ACME = window.ACME; +```html + ``` +(necessary in case the webserver headers don't specify `plain/text; charset="UTF-8"`) + `acme.js` ```html - + ``` `acme.min.js` ```html - + +``` + +Use + +```js +var ACME = window['@root/acme']; ``` ## Examples @@ -230,15 +244,42 @@ acme.certificates.create({ The punycode library itself is lightweight and dependency-free. It is available both in node and for browsers. -# Full Documentation +# Testing -See [acme.js](https://git.coolaj86.com/coolaj86/acme-v2.js). +You will need to use one of the [`acme-dns-01-*` plugins](https://www.npmjs.com/search?q=acme-dns-01-) +to run the test locally. -Aside from the loading instructions (`npm` and `require` instead of `script` tags), -the usage is identical to the node version. +You'll also need a `.env` that looks something like the one in `examples/example.env`: -That said, the two may leap-frog a little from time to time -(for example, the browser version is just a touch ahead at the moment). +```bash +ENV=DEV +SUBSCRIBER_EMAIL=letsencrypt+staging@example.com +BASE_DOMAIN=test.example.com +CHALLENGE_TYPE=dns-01 +CHALLENGE_PLUGIN=acme-dns-01-digitalocean +CHALLENGE_OPTIONS='{"token":"xxxxxxxxxxxx"}' +``` + +For example: + +```bash +# Get the repo and change directories into it +git clone https://git.rootprojects.org/root/bluecrypt-acme.js +pushd bluecrypt-acme.js/ + +# Install the challenge plugin you'll use for the tests +npm install --save-dev acme-dns-01-digitalocean + +# Copy the sample .env file +rsync -av examples/example.env .env + +# Edit the config file to use a domain in your account, and your API token +#vim .env +code .env + +# Run the tests +node tests/index.js +``` # Developing diff --git a/webpack.config.js b/webpack.config.js index e41d04a..fb8c547 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,12 +7,12 @@ module.exports = { output: { path: path.resolve(__dirname, 'dist'), filename: 'acme.js', - library: 'acme', + library: '@root/acme', libraryTarget: 'umd', globalObject: "typeof self !== 'undefined' ? self : this" }, resolve: { aliasFields: ['webpack', 'browser'], - mainFields: ['browser'] + mainFields: ['browser'] } };