metapak-sencrop
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,11 @@ | ||
<a name="1.1.1"></a> | ||
## [1.1.1](https://github.com/sencrop/metapak-sencrop/compare/v1.1.0...v1.1.1) (2017-07-27) | ||
### Bug Fixes | ||
* **Hooks:** Ensure git hooks fail when errors are raised ([658191f](https://github.com/sencrop/metapak-sencrop/commit/658191f)) | ||
<a name="1.1.0"></a> | ||
@@ -2,0 +12,0 @@ # [1.1.0](https://github.com/sencrop/metapak-sencrop/compare/v1.0.0...v1.1.0) (2017-07-20) |
{ | ||
"name": "metapak-sencrop", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A `metapak` plugin for Sencrop projects", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
'use strict'; | ||
const PRE_COMMIT_ARCHITECTURE = | ||
'npm run architecture && git add ARCHITECTURE.md || exit 1'; | ||
module.exports = (hooks) => { | ||
hooks['pre-commit'] = hooks['pre-commit'] || []; | ||
hooks['pre-commit'].push('npm run architecture && git add ARCHITECTURE.md'); | ||
hooks['pre-commit'].push(PRE_COMMIT_ARCHITECTURE); | ||
return hooks; | ||
}; |
'use strict'; | ||
const PRE_COMMIT_ARCHITECTURE = | ||
'npm run architecture && git add ARCHITECTURE.md || exit 1'; | ||
const assert = require('assert'); | ||
const hooksTransformer = require('./hooks'); | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
'npm run architecture && git add ARCHITECTURE.md', | ||
], | ||
} | ||
); | ||
}); | ||
describe('Architecture', () => { | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
PRE_COMMIT_ARCHITECTURE, | ||
], | ||
} | ||
); | ||
}); | ||
it('should leave existing pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({ | ||
'pre-commit': [ | ||
'npm t', | ||
], | ||
}), | ||
{ | ||
'pre-commit': [ | ||
'npm t', | ||
'npm run architecture && git add ARCHITECTURE.md', | ||
], | ||
} | ||
); | ||
it('should leave existing pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({ | ||
'pre-commit': [ | ||
'npm t', | ||
], | ||
}), | ||
{ | ||
'pre-commit': [ | ||
'npm t', | ||
PRE_COMMIT_ARCHITECTURE, | ||
], | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
@@ -5,13 +5,15 @@ 'use strict'; | ||
describe('Package transformer for jsdocs', () => { | ||
it('should work with an empty package.json', () => { | ||
expect(packageTransformer({ | ||
metapak: { | ||
data: { | ||
files: 'yolo.js', | ||
describe('Architecture', () => { | ||
describe('Package transformer for jsdocs', () => { | ||
it('should work with an empty package.json', () => { | ||
expect(packageTransformer({ | ||
metapak: { | ||
data: { | ||
files: 'yolo.js', | ||
}, | ||
}, | ||
}, | ||
})) | ||
.toMatchSnapshot(); | ||
})) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
'use strict'; | ||
const PRE_COMMIT_DOC = | ||
'npm run doc && git add .readme/API.md'; | ||
module.exports = (hooks) => { | ||
hooks['pre-commit'] = hooks['pre-commit'] || []; | ||
hooks['pre-commit'].push('npm run doc && git add .readme/API.md'); | ||
hooks['pre-commit'].push(PRE_COMMIT_DOC); | ||
return hooks; | ||
}; |
'use strict'; | ||
const PRE_COMMIT_DOC = | ||
'npm run doc && git add .readme/API.md'; | ||
const assert = require('assert'); | ||
const hooksTransformer = require('./hooks'); | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
'npm run doc && git add .readme/API.md', | ||
], | ||
} | ||
); | ||
}); | ||
describe('JSDocs', () => { | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
PRE_COMMIT_DOC, | ||
], | ||
} | ||
); | ||
}); | ||
it('should leave existing pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({ | ||
'pre-commit': [ | ||
'npm t', | ||
], | ||
}), | ||
{ | ||
'pre-commit': [ | ||
'npm t', | ||
'npm run doc && git add .readme/API.md', | ||
], | ||
} | ||
); | ||
it('should leave existing pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({ | ||
'pre-commit': [ | ||
'npm t', | ||
], | ||
}), | ||
{ | ||
'pre-commit': [ | ||
'npm t', | ||
PRE_COMMIT_DOC, | ||
], | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
@@ -5,13 +5,15 @@ 'use strict'; | ||
describe('Package transformer for jsdocs', () => { | ||
it('should work with an empty package.json', () => { | ||
expect(packageTransformer({ | ||
metapak: { | ||
data: { | ||
files: 'yolo.js', | ||
describe('JSDocs', () => { | ||
describe('Package transformer for jsdocs', () => { | ||
it('should work with an empty package.json', () => { | ||
expect(packageTransformer({ | ||
metapak: { | ||
data: { | ||
files: 'yolo.js', | ||
}, | ||
}, | ||
}, | ||
})) | ||
.toMatchSnapshot(); | ||
})) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
@@ -6,25 +6,27 @@ 'use strict'; | ||
describe('Assets transformer', () => { | ||
it('should fill author in the LICENCE file', () => { | ||
expect( | ||
assetsTransformer({ | ||
name: 'LICENSE', | ||
data: 'The MIT License (MIT)\nCopyright © 2017 <copyright holders>\n', | ||
}, {}) | ||
) | ||
.toMatchSnapshot(); | ||
}); | ||
describe('Main', () => { | ||
describe('Assets transformer', () => { | ||
it('should fill author in the LICENCE file', () => { | ||
expect( | ||
assetsTransformer({ | ||
name: 'LICENSE', | ||
data: 'The MIT License (MIT)\nCopyright © 2017 <copyright holders>\n', | ||
}, {}) | ||
) | ||
.toMatchSnapshot(); | ||
}); | ||
it('should let pass other files', () => { | ||
assert.deepEqual( | ||
assetsTransformer({ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
}, {}), | ||
{ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
} | ||
); | ||
it('should let pass other files', () => { | ||
assert.deepEqual( | ||
assetsTransformer({ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
}, {}), | ||
{ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
@@ -14,4 +14,4 @@ 'use strict'; | ||
fi`; | ||
const PRE_COMMIT_QUALITY_CHECK = 'npm run lint'; | ||
const PRE_COMMIT_METAPAK_RUN = 'npm run metapak'; | ||
const PRE_COMMIT_QUALITY_CHECK = 'npm run lint || exit 1'; | ||
const PRE_COMMIT_METAPAK_RUN = 'npm run metapak || exit 1'; | ||
@@ -18,0 +18,0 @@ module.exports = (hooks) => { |
@@ -17,20 +17,22 @@ 'use strict'; | ||
fi`; | ||
const PRE_COMMIT_METAPAK_RUN = 'npm run metapak'; | ||
const PRE_COMMIT_QUALITY_CHECK = 'npm run lint'; | ||
const PRE_COMMIT_QUALITY_CHECK = 'npm run lint || exit 1'; | ||
const PRE_COMMIT_METAPAK_RUN = 'npm run metapak || exit 1'; | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
PRE_COMMIT_METAPAK_RUN, | ||
PRE_COMMIT_QUALITY_CHECK, | ||
], | ||
'commit-msg': [ | ||
COMMIT_MSG_COMMITIZEN_CHECK, | ||
], | ||
} | ||
); | ||
describe('Main', () => { | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
PRE_COMMIT_METAPAK_RUN, | ||
PRE_COMMIT_QUALITY_CHECK, | ||
], | ||
'commit-msg': [ | ||
COMMIT_MSG_COMMITIZEN_CHECK, | ||
], | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
@@ -5,13 +5,15 @@ 'use strict'; | ||
describe('Package transformer', () => { | ||
test('should work with an empty package.json', () => { | ||
expect(packageTransformer({ | ||
metapak: { | ||
data: { | ||
files: 'lol.js', | ||
describe('Main', () => { | ||
describe('Package transformer', () => { | ||
test('should work with an empty package.json', () => { | ||
expect(packageTransformer({ | ||
metapak: { | ||
data: { | ||
files: 'lol.js', | ||
}, | ||
}, | ||
}, | ||
})) | ||
.toMatchSnapshot(); | ||
})) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
@@ -7,48 +7,50 @@ 'use strict'; | ||
describe('Assets transformer for www configs', () => { | ||
it('should build the README.md file', (done) => { | ||
const fs = { | ||
readFileAsync: sinon.stub(), | ||
}; | ||
const PROJECT_DIR = '/lol/'; | ||
const log = { | ||
error: sinon.stub, | ||
}; | ||
describe('Readme', () => { | ||
describe('Assets transformer for www configs', () => { | ||
it('should build the README.md file', (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')); | ||
fs.readFileAsync.onSecondCall().returns(Promise.resolve('')); | ||
fs.readFileAsync.onFirstCall().returns(Promise.resolve('## Usage\nJust require me\n')); | ||
fs.readFileAsync.onSecondCall().returns(Promise.resolve('')); | ||
assetsTransformer({ | ||
name: 'README.md', | ||
data: '<!-- something -->\n', | ||
}, { | ||
name: 'module', | ||
description: 'A great module!', | ||
devDependencies: {}, | ||
license: 'MIT', | ||
}, { | ||
PROJECT_DIR, | ||
fs, | ||
log, | ||
}) | ||
.then((file) => { | ||
expect(file) | ||
.toMatchSnapshot(); | ||
}) | ||
.then(done) | ||
.catch(done); | ||
}); | ||
assetsTransformer({ | ||
name: 'README.md', | ||
data: '<!-- something -->\n', | ||
}, { | ||
name: 'module', | ||
description: 'A great module!', | ||
devDependencies: {}, | ||
license: 'MIT', | ||
}, { | ||
PROJECT_DIR, | ||
fs, | ||
log, | ||
}) | ||
.then((file) => { | ||
expect(file) | ||
.toMatchSnapshot(); | ||
}) | ||
.then(done) | ||
.catch(done); | ||
}); | ||
it('should let pass other files', () => { | ||
assert.deepEqual( | ||
assetsTransformer({ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
}, {}, {}), | ||
{ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
} | ||
); | ||
it('should let pass other files', () => { | ||
assert.deepEqual( | ||
assetsTransformer({ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
}, {}, {}), | ||
{ | ||
name: 'YOLO', | ||
data: 'Carpe diem\n', | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
'use strict'; | ||
const PRE_COMMIT_TEST_CHECK = 'npm run test'; | ||
const PRE_COMMIT_TEST_CHECK = 'npm run test || exit 1'; | ||
@@ -5,0 +5,0 @@ module.exports = (hooks) => { |
@@ -5,15 +5,17 @@ 'use strict'; | ||
const hooksTransformer = require('./hooks'); | ||
const PRE_COMMIT_TEST_CHECK = 'npm run test'; | ||
const PRE_COMMIT_TEST_CHECK = 'npm run test || exit 1'; | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
PRE_COMMIT_TEST_CHECK, | ||
], | ||
} | ||
); | ||
describe('Tests', () => { | ||
describe('Hooks transformer', () => { | ||
it('should add pre-commit hooks', () => { | ||
assert.deepEqual( | ||
hooksTransformer({}), | ||
{ | ||
'pre-commit': [ | ||
PRE_COMMIT_TEST_CHECK, | ||
], | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
@@ -5,7 +5,9 @@ 'use strict'; | ||
describe('Package transformer', () => { | ||
it('should work with an empty package.json', () => { | ||
expect(packageTransformer({})) | ||
.toMatchSnapshot(); | ||
describe('Tests', () => { | ||
describe('Package transformer', () => { | ||
it('should work with an empty package.json', () => { | ||
expect(packageTransformer({})) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33460
573