-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module use): update use to single function
reduced exports to a single function createDocs, and allowing the build options to be passed as parameters. moving to a single function breaks any use-cases of previous versions, since the module is imported and used very differently.
- Loading branch information
1 parent
5564aa4
commit bd1cff8
Showing
6 changed files
with
61 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ branches: | |
notifications: | ||
email: false | ||
node_js: | ||
- '9' | ||
- '7' | ||
- '6' | ||
- '4' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
var createDocs = require('../app/index.js').createDocs; | ||
var buildOptions = require('../app/index.js').buildOptions; | ||
var createDocs = require('../app/index.js'); | ||
|
||
// Test on OSX and Linux | ||
// buildOptions.buildDir = '~/' | ||
// createDocs('~/') | ||
|
||
// Test on Windows | ||
// '~' converts to home directory in Windows too | ||
// buildOptions.buildDir = '~\\My Documents' | ||
// createDocs('~\\My Documents') | ||
|
||
// Test version change | ||
buildOptions.buildVersion = '4.4.0'; | ||
buildOptions.buildName = 'apidoc'; | ||
|
||
// Use this to overwrite existing API documents | ||
// buildOptions.updateApi = true; | ||
|
||
createDocs(); | ||
createDocs('./', 'api-docs', '9.2.1'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
var expect = require('chai').expect; | ||
var fs = require('fs'); | ||
var fsx = require('fs-extra'); | ||
var buildOptions = require('../app/index.js').buildOptions; | ||
|
||
buildOptions.buildDir = process.cwd(); | ||
buildOptions.buildName = 'node-docs'; | ||
var createDocs = require('../app/index'); | ||
|
||
describe('node-offline-api', () => { | ||
it('should create files', () => { | ||
var createDocs = require('../app/index').createDocs; | ||
createDocs(); | ||
const build = fs.stat(`${buildOptions.buildDir}`, (err, out) => { | ||
it('should create files', async () => { | ||
const docs = await createDocs() | ||
|
||
const build = await fs.stat('node-documents', (err, out) => { | ||
expect(build).to.satisfy; | ||
expect(out).to.satisfy; | ||
}); | ||
}) | ||
it('should change options', () => { | ||
buildOptions.version = '4.4.0'; | ||
|
||
expect(buildOptions.version).to.equal('4.4.0'); | ||
it('should change options from function', async () => { | ||
let targetDir = process.cwd() | ||
let version = '9.2.1' | ||
let folderName = 'test2' | ||
const docs = await createDocs(targetDir, folderName, version, false) | ||
|
||
const build = await fs.stat(targetDir + folderName, (err, out) => { | ||
expect(err).not.toBe('ENONT') | ||
expect(build).to.satisfy; | ||
expect(out).to.satisfy; | ||
}); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters