New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@azuro-org/dictionaries

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azuro-org/dictionaries - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

57

bin.js

@@ -48,5 +48,5 @@ #!/usr/bin/env node

const downloadFile = (filename) => {
const downloadFile = (filename, version) => {
const localFilepath = path.resolve(OUTPUT_PATH, `${filename}.${fileData.type}`)
const remoteFilepath = `${REMOTE_PATH}/v${VERSION}/${fileData.dir}/${filename}.${fileData.type}`
const remoteFilepath = `${REMOTE_PATH}/${version}/${fileData.dir}/${filename}.${fileData.type}`

@@ -79,6 +79,53 @@ const pipeHandler = fs.createWriteStream(localFilepath)

const download = () => {
console.log(`Start downloading dictionaries@${VERSION}.`)
FILES.forEach(downloadFile)
const getLatestVersion = () => {
return new Promise((resolve) => {
const options = {
hostname: 'api.github.com',
port: 443,
path: '/repos/azuro-protocol/public-config/contents/dictionaries',
method: 'GET',
headers: {
'User-Agent': 'Azuro-protocol',
}
}
const req = https.request(options, (res) => {
let body = ''
res.on('data', (chunk) => {
body += chunk
})
res.on('end', () => {
let resp = JSON.parse(body)
resolve(resp[resp.length - 1].name)
})
})
req.on('error', (err) => {
console.error(err)
process.exit(1)
})
req.end()
})
}
const download = async () => {
let version
if (!VERSION || VERSION === 'latest') {
version = await getLatestVersion()
}
else {
version = `v${VERSION.replace(/[^.\d]/g, '')}`
}
console.log(`Start downloading dictionaries@${version}`)
FILES.forEach((filename) => {
downloadFile(filename, version)
})
if (FILE_TYPE === 'ts' || FILE_TYPE === 'js') {

@@ -85,0 +132,0 @@ createIndexFile(FILE_TYPE)

4

package.json
{
"name": "@azuro-org/dictionaries",
"version": "1.0.5",
"version": "1.0.6",
"description": "CLI and set of helpers to work with Azuro protocol dictionaries",

@@ -13,3 +13,3 @@ "bin": "bin.js",

"prepublishOnly": "npm run build",
"test-bin": "rimraf ./out && node ./bin -v 2.0.1 -o ./out -t ts"
"test-bin": "rimraf ./out && node ./bin -v latest -o ./out -t ts"
},

@@ -16,0 +16,0 @@ "keywords": [

@@ -26,3 +26,3 @@ # Dictionaries Package

- `VERSION` is the version of downloaded dictionaries. [Find the version you need here](https://github.com/Azuro-protocol/public-config/tree/main/dictionaries).
- `VERSION` is the version of downloaded dictionaries. [Check versions](https://github.com/Azuro-protocol/public-config/tree/main/dictionaries).
- `OUTPUT_DIR` is the directory where to put downloaded files.

@@ -32,7 +32,15 @@ - `FILES_TYPE` is the extension of downloaded files. Accepts `ts`, `js`, `maps`, `arrays`. `maps` and `arrays` are

**Examples**
```bash
dictionaries -o ./dist -v 2.0.0 -t ts # will download v2.0.0 typescript files to ./dist directory
dictionaries -o ./dist -v 2.0.3 -t ts # will download v2.0.3 typescript files to ./dist directory
```
Use `latest` value for the version param to download the latest dictionaries update.
```bash
dictionaries -o ./dist -v latest -t js # will download latest javascript files to ./dist directory
```
## Helpers

@@ -39,0 +47,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc