Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

changelog-view

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

changelog-view - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

3

package.json
{
"name": "changelog-view",
"version": "1.2.0",
"version": "1.2.1",
"description": "Tool to view changelog of package in console",

@@ -13,2 +13,3 @@ "bin": {

"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-external-helpers": "^6.22.0",

@@ -15,0 +16,0 @@ "babel-plugin-transform-builtin-extend": "^1.1.2",

@@ -79,3 +79,3 @@ Changelog view

### Features
## Features
The package checks on github if a file named `CHANGELOG.md` or `HISTORY.md` is present.

@@ -87,8 +87,13 @@

### To be done
## Automatic langage / dependency management package detection
* [x] read npm / yarn lockfiles to guess the package url
* [x] read npm / yarn lockfiles to guess the current version
* [x] read composer lockfiles to guess the package url
* [x] read composer lockfiles to guess the current version
* [x] [JavaScript] Automatically guess package informations from JavaScript projects
* [x] [PHP] Automatically guess package informations from composer.lock
* [ ] [Python] Automatically guess package informations from Pipfile.lock (help wanted, does not seems easy to gets the github url as it relies on pypi). Can eventually rely on `pip freeze` command but seems to be "the old way"
* [ ] [Go] Automatically guess package informations from Gopkg.lock (help wanted, but maybe easy because dependencies seems to be only github links in Go)
* [ ] [Ruby] Automatically guess package informations from Gemfile.lock (help wanted, I did not really understand the Gemfile.lock principle)
* [ ] Other languages: feel free to contribute, I just listed languages that came to my mind :)
## To be done
* [ ] make `npx` work

@@ -8,10 +8,11 @@ import fs from 'fs';

export default function getPackageInfo(packageString) {
return getPackageInfoFromString(packageString)
|| getPackageInfoFromComposer(packageString)
|| getPackageInfoFromPackage(packageString)
;
return (
getPackageInfoFromString(packageString) ||
getPackageInfoFromComposer(packageString) ||
getPackageInfoFromPackage(packageString)
);
}
function getRepoNameFromUrl(url) {
const repo = url.match(GITHUB_REPO_REGEX);
const repo = url.match(GITHUB_REPO_REGEX);

@@ -23,4 +24,9 @@ return repo && repo[1];

try {
const packageInfo = require(`${packageString}/package.json`);
const packageJsonRaw = fs.readFileSync(
path.join(process.cwd(), 'node_modules', packageString, 'package.json'),
{ encoding: 'utf8' }
);
const packageInfo = JSON.parse(packageJsonRaw);
if (packageInfo) {

@@ -64,3 +70,5 @@ const repository = packageInfo.repository;

const packageInfo = composerInfo.packages.find(packageDetail => packageDetail.name === packageString);
const packageInfo = composerInfo.packages.find(
packageDetail => packageDetail.name === packageString
);

@@ -73,3 +81,2 @@ if (packageInfo) {

}
} catch (e) {

@@ -76,0 +83,0 @@ return null;

@@ -17,13 +17,37 @@ jest.mock('fs');

// complete repository info
jest.mock(
'fullrepo/package.json',
() => ({
version: '2.0.0',
repository: {
url: 'git+https://github.com/fullrepo/foo.git',
},
}),
{ virtual: true }
const fullRepoPackageFile = {
version: '2.0.0',
repository: {
url: 'git+https://github.com/fullrepo/foo.git',
},
};
const stringRepoPackageFile = {
version: '2.0.0',
repository: 'git+https://github.com/stringrepo/foo',
};
const shortRepoPackageFile = {
version: '2.0.0',
repository: 'github:shortrepo/foo',
};
const fullrepoPath = path.join(
process.cwd(),
'node_modules/fullrepo/package.json'
);
const stringrepoPath = path.join(
process.cwd(),
'node_modules/stringrepo/package.json'
);
const shortrepoPath = path.join(
process.cwd(),
'node_modules/shortrepo/package.json'
);
fs.__setMockFiles({
[fullrepoPath]: JSON.stringify(fullRepoPackageFile),
[stringrepoPath]: JSON.stringify(stringRepoPackageFile),
[shortrepoPath]: JSON.stringify(shortRepoPackageFile),
});
// string repository info

@@ -35,11 +59,2 @@ expect(getPackageInfo('fullrepo')).toEqual({

jest.mock(
'stringrepo/package.json',
() => ({
version: '2.0.0',
repository: 'git+https://github.com/stringrepo/foo',
}),
{ virtual: true }
);
expect(getPackageInfo('stringrepo')).toEqual({

@@ -56,11 +71,2 @@ packageName: 'stringrepo/foo',

jest.mock(
'shortrepo/package.json',
() => ({
version: '2.0.0',
repository: 'github:shortrepo/foo',
}),
{ virtual: true }
);
expect(getPackageInfo('shortrepo')).toEqual({

@@ -67,0 +73,0 @@ packageName: 'shortrepo/foo',

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