pagecrypt
Advanced tools
Comparing version 3.0.0 to 3.1.0
# Changelog for `pagecrypt` | ||
## 3.1.0 - 2021-04-24 | ||
### Features | ||
- Replace `yargs` with `sade` and simplify CLI + dependencies. No breaking changes. | ||
- This greatly improves both installation + runtime performance. | ||
- It also simplifies the CLI implementation. | ||
- The CLI API is preserved exactly like in 3.0.0 | ||
--- | ||
## 3.0.0 - 2021-04-24 | ||
@@ -4,0 +15,0 @@ |
43
cli.js
#!/usr/bin/env node | ||
const yargs = require('yargs') | ||
const { hideBin } = require('yargs/helpers') | ||
const sade = require('sade') | ||
const { encrypt } = require('./index') | ||
const pkg = require('./package.json') | ||
const argv = yargs(hideBin(process.argv)) | ||
.scriptName('pagecrypt') | ||
.usage('🔐 Usage: $0 [input-file] [output-file] [password]') | ||
.example('$0 input.html out.html strong-password') | ||
.command('[input-file]', false) | ||
.help('[input-file]', 'Input HTML file to encrypt.') | ||
.command('[output-file]', false) | ||
.help( | ||
'[output-file]', | ||
'Output HTML file where you want to save the encrypted result.', | ||
sade(`${pkg.name} <src> <dest> <password>`, true) | ||
.version(pkg.version) | ||
.describe( | ||
'Encrypt the <src> HTML file with <password> and save the result in the <dest> HTML file.', | ||
) | ||
.command('[password]', false) | ||
.help( | ||
'[password]', | ||
'Password to decrypt the your output HTML file. Use a strong password.', | ||
) | ||
.demandCommand(3, 3) | ||
.alias('h', 'help') | ||
.alias('v', 'version') | ||
.help().argv | ||
async function cli() { | ||
if (argv._?.length === 3) { | ||
const [inputFile, outputFile, password] = argv._ | ||
console.log(`🔐 Encrypting ${inputFile} → ${outputFile}`) | ||
await encrypt(inputFile, outputFile, password) | ||
} | ||
} | ||
cli() | ||
.example('index.html encrypted.html password') | ||
.action(async (src, dest, password) => { | ||
console.log(`🔐 Encrypting ${src} → ${dest}`) | ||
await encrypt(src, dest, password) | ||
}) | ||
.parse(process.argv) |
{ | ||
"name": "pagecrypt", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Easily add client-side password-protection to your Single Page Applications and HTML files.", | ||
@@ -48,3 +48,3 @@ "main": "index.js", | ||
"rfc4648": "^1.4.0", | ||
"yargs": "^16.2.0" | ||
"sade": "^1.7.4" | ||
}, | ||
@@ -51,0 +51,0 @@ "devDependencies": { |
@@ -16,3 +16,3 @@ # PageCrypt - Password Protected Single Page Applications and HTML files | ||
```sh | ||
npx pagecrypt [input.html] [output.html] [password] | ||
npx pagecrypt <src> <dest> <password> | ||
``` | ||
@@ -52,3 +52,3 @@ | ||
// Encrypt a HTML file and write to the filesystem | ||
await encrypt('input.html', 'output.html', 'password') | ||
await encrypt('index.html', 'encrypted.html', 'password') | ||
``` | ||
@@ -55,0 +55,0 @@ |
22790
124
+ Addedsade@^1.7.4
+ Addedmri@1.2.0(transitive)
+ Addedsade@1.8.1(transitive)
- Removedyargs@^16.2.0
- Removedansi-regex@5.0.1(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedcliui@7.0.4(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedescalade@3.1.2(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedwrap-ansi@7.0.0(transitive)
- Removedy18n@5.0.8(transitive)
- Removedyargs@16.2.0(transitive)
- Removedyargs-parser@20.2.9(transitive)