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

metapak-sencrop

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metapak-sencrop - npm Package Compare versions

Comparing version 6.2.0 to 6.3.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

<a name="6.3.0"></a>
# [6.3.0](https://github.com/sencrop/metapak-sencrop/compare/v6.2.0...v6.3.0) (2018-09-28)
<a name="6.2.0"></a>

@@ -2,0 +7,0 @@ # [6.2.0](https://github.com/sencrop/metapak-sencrop/compare/v6.1.0...v6.2.0) (2018-09-28)

2

package.json
{
"name": "metapak-sencrop",
"version": "6.2.0",
"version": "6.3.0",
"description": "A `metapak` plugin for Sencrop projects",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -47,3 +47,6 @@ <!--

# Useful resources
- [Changelog](./CHANGELOG.md)
# License
[MIT](https://github.com/sencrop/metapak-sencrop/blob/master/LICENSE.md)

@@ -8,3 +8,2 @@ 'use strict';

lastNode: '10.11.0',
apiPath: 'API.md',
};
'use strict';
// It is safe to run metapak here to add the API
// to the readme file since it should fail upfront
// if other changes were detected
const PRE_COMMIT_DOC = 'npm run doc && npm run metapak && git add README.md';
const PRE_COMMIT_DOC = 'npm run doc && git add API.md';

@@ -8,0 +5,0 @@ module.exports = hooks => {

'use strict';
const PRE_COMMIT_DOC = 'npm run doc && npm run metapak && git add README.md';
const PRE_COMMIT_DOC = 'npm run doc && git add API.md';

@@ -5,0 +5,0 @@ const assert = require('assert');

'use strict';
const path = require('path');
const { apiPath } = require('../config.js');
const ORGANISATION_NAME = 'sencrop';

@@ -11,2 +10,4 @@ const README_CONTENTS_START_TAG = `[//]: # (::contents:start)`;

module.exports = (file, packageConf, { PROJECT_DIR, fs, log }) => {
const metapakConfigs =
(packageConf.metapak && packageConf.metapak.configs) || [];
// Simple README templating system

@@ -21,6 +22,3 @@ if ('README.md' === file.name) {

return Promise.all([
_getReadmeContents({ PROJECT_DIR, fs, log }),
_getAPIContents({ PROJECT_DIR, fs, log }),
]).then(([readme, api]) => {
return _getReadmeContents({ PROJECT_DIR, fs, log }).then(readme => {
file.data += '\n\n' + README_CONTENTS_START_TAG + '\n\n';

@@ -31,5 +29,10 @@ if (readme) {

file.data += '\n' + README_CONTENTS_END_TAG + '\n\n';
if (api) {
file.data += api + '\n';
file.data += '# Useful resources\n';
if (metapakConfigs.includes('jsdocs')) {
file.data += '- [API documentation](./API.md)\n';
}
if (metapakConfigs.includes('jsarch')) {
file.data += '- [Architecture Notes](./ARCHITECTURE.md)\n';
}
file.data += '- [Changelog](./CHANGELOG.md)\n\n';
file.data +=

@@ -65,11 +68,1 @@ '# License\n' +

}
function _getAPIContents({ PROJECT_DIR, fs, log }) {
const filePath = path.join(PROJECT_DIR, apiPath);
return fs.readFileAsync(filePath, 'utf8').catch(err => {
log('debug', 'Cannot read the API.md file contents:', filePath);
log('debug', err.stack);
return '';
});
}

@@ -21,3 +21,2 @@ 'use strict';

.returns(Promise.resolve('## Usage\nJust require me\n'));
fs.readFileAsync.onSecondCall().returns(Promise.resolve(''));

@@ -48,2 +47,40 @@ assetsTransformer(

it('should build the README.md file with links', done => {
const fs = {
readFileAsync: sinon.stub(),
};
const PROJECT_DIR = '/lol/';
const log = {
error: sinon.stub,
};
fs.readFileAsync
.onFirstCall()
.returns(Promise.resolve('## Usage\nJust require me\n'));
assetsTransformer(
{
name: 'README.md',
data: '<!-- something -->\n',
},
{
name: 'module',
description: 'A great module!',
metapak: { configs: ['jsarch', 'jsdocs'] },
devDependencies: {},
license: 'MIT',
},
{
PROJECT_DIR,
fs,
log,
},
)
.then(file => {
expect(file).toMatchSnapshot();
})
.then(done)
.catch(done);
});
it('should let pass other files', () => {

@@ -50,0 +87,0 @@ assert.deepEqual(

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