Socket
Socket
Sign inDemoInstall

license.js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

license.js - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

.eslintignore

2

.vscode/settings.json
{
"eslint.enable": false
"eslint.enable": true
}

@@ -6,5 +6,7 @@ const { resolve } = require('path')

const licenseFile = name => resolve(__dirname, '..', 'licenses', name + '.txt')
const licenseFile = name => resolve(__dirname, '..', 'licenses', `${name}.txt`)
const readFile = pify(fs.readFile)
function getLicenseSync(name) {

@@ -18,6 +20,6 @@ if (!indexFile[name]) {

header: indexFile[name].header
? fs.readFileSync(licenseFile(name + '-header')).toString()
? fs.readFileSync(licenseFile(`${name}-header`)).toString()
: null,
warranty: indexFile[name].header
? fs.readFileSync(licenseFile(name + '-warranty')).toString()
? fs.readFileSync(licenseFile(`${name}-warranty`)).toString()
: null,

@@ -37,15 +39,13 @@ }

indexFile[name].header
? readFile(licenseFile(name + '-header'))
? readFile(licenseFile(`${name}-header`))
: null,
indexFile[name].header
? readFile(licenseFile(name + '-warranty'))
: null
? readFile(licenseFile(`${name}-warranty`))
: null,
])
.then(([ text, header, warranty ]) => {
return {
.then(([text, header, warranty]) => ({
text: text ? text.toString() : null,
header: header ? header.toString() : null,
warranty: warranty ? warranty.toString() : null,
}
})
}))
}

@@ -57,4 +57,4 @@

Object.keys(markers)
.forEach(marker => {
result = result.replace('{{ ' + marker + ' }}', markers[marker])
.forEach((marker) => {
result = result.replace(`{{ ${marker} }}`, markers[marker])
})

@@ -75,11 +75,13 @@ return result

return getLicense(name)
.then(license => {
return {
text: replaceMarkers(license.text, options),
header: replaceMarkers(license.header, options),
warranty: replaceMarkers(license.warranty, options),
}
})
.then(license => ({
text: replaceMarkers(license.text, options),
header: replaceMarkers(license.header, options),
warranty: replaceMarkers(license.warranty, options),
}))
}
function availableLicenses() {
return Object.keys(indexFile).map(key => indexFile[key].name)
}
module.exports = {

@@ -90,2 +92,3 @@ getLicense,

makeLicenseSync,
availableLicenses,
}
{
"name": "license.js",
"version": "2.0.0",
"version": "2.1.0",
"description": "Get SPDX license template text",
"main": "lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "eslint .",
"build": "node scripts/build"

@@ -15,3 +15,3 @@ },

"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},

@@ -35,3 +35,7 @@ "keywords": [

"pify": "^3.0.0"
},
"devDependencies": {
"eslint": "^4.11.0",
"eslint-config-atomix-base": "^4.6.0"
}
}

@@ -5,2 +5,4 @@ const fs = require('fs')

/* eslint-disable no-console */
const list = fs.readdirSync('./licenses')

@@ -20,5 +22,5 @@ .filter(f => !f.includes('.json'))

let json = {}
const json = {}
licenses.forEach(license => {
licenses.forEach((license) => {
json[license] = {

@@ -32,10 +34,7 @@ name: license,

console.log(chalk.yellow('Found licenses:'))
console.log(
Object.values(json)
.map(license => '- ' + chalk.green(license.name)
+ chalk.cyan(license.header ? (' ' + 'header') : '')
+ chalk.cyan(license.warranty ? (' ' + 'warranty') : '')
)
.join('\r\n')
)
console.log(Object.values(json)
.map(license => `- ${chalk.green(license.name)
}${chalk.cyan(license.header ? (' header') : '')
}${chalk.cyan(license.warranty ? (' warranty') : '')}`)
.join('\r\n'))

@@ -50,2 +49,2 @@ const indexFile = path.resolve(__dirname, '..', 'licenses', 'index.json')

console.log(chalk.bold.white('Saved list to ' + indexFile + '!'))
console.log(chalk.bold.white(`Saved list to ${indexFile}!`))

Sorry, the diff of this file is not supported yet

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