Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .docs to .gitignore #644

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/gasket-plugin-docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `@gasket/plugin-docs`

- Add the default docs directory `.docs` to `.gitignore` on project creation.

### 6.37.0

- Jest refactor ([#504])
Expand Down
5 changes: 5 additions & 0 deletions packages/gasket-plugin-docs/lib/create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { defaultConfig } = require('./configure');

module.exports = function create(_gasket, { gitignore }) {
gitignore?.add(defaultConfig.outputDir, 'Documentation');
};
2 changes: 2 additions & 0 deletions packages/gasket-plugin-docs/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const create = require('./create');
const configure = require('./configure');
const getCommands = require('./get-commands');
const metadata = require('./metadata');
Expand All @@ -7,6 +8,7 @@ module.exports = {
name: require('../package').name,
hooks: {
configure,
create,
getCommands,
metadata,
docsSetup
Expand Down
17 changes: 17 additions & 0 deletions packages/gasket-plugin-docs/test/create.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { hooks: { create } } = require('../lib/index');

describe('the create hook', () => {
it('should add a gitignore entry for the .docs directory', () => {
const context = { gitignore: { add: jest.fn() } };

create({}, context);

expect(context.gitignore.add).toHaveBeenCalledWith('.docs', 'Documentation');
});

it('should handle when no `gitignore` is present in the create context', () => {
const context = {};

expect(() => create({}, context)).not.toThrow(Error);
});
});
1 change: 1 addition & 0 deletions packages/gasket-plugin-docs/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('Plugin', function () {
it('has expected hooks', () => {
const expected = [
'configure',
'create',
'getCommands',
'metadata',
'docsSetup'
Expand Down