docworks-wix-media
Advanced tools
Comparing version 1.6.4 to 1.8.4
{ | ||
"name": "docworks-wix-media", | ||
"version": "1.6.4", | ||
"version": "1.8.4", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"build": "babel src --out-dir dist", | ||
"prepublish": "babel src --out-dir dist", | ||
"test": "mocha --compilers js:babel-core/register --require babel-polyfill ./test/**/*.spec.js" | ||
"lint": "echo \"--- running lint ---\" && eslint src test", | ||
"build": "npm run lint", | ||
"prepublish": "npm run build", | ||
"test": "mocha ./test/**/*.spec.js --compilers js:babel-core/register --require babel-polyfill" | ||
}, | ||
@@ -15,2 +16,3 @@ "author": "Yoav Abrahami", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-polyfill": "^6.24.1", | ||
@@ -22,9 +24,11 @@ "babel-preset-es2015": "^6.24.1", | ||
"chai-subset": "^1.5.0", | ||
"docworks-jsdoc2spec": "^1.6.4", | ||
"eslint": "^6.0.1", | ||
"mocha": "^3.3.0" | ||
}, | ||
"dependencies": { | ||
"docworks-jsdoc2spec": "^1.8.4", | ||
"fs-extra": "^7.0.0", | ||
"tmp-promise": "^1.0.5" | ||
} | ||
}, | ||
"gitHead": "af20090fc0d9b22e9b504b26e3b2f025ddb05af9" | ||
} |
@@ -0,23 +1,28 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
let logger = console | ||
const {copy, ensureDir} = require('fs-extra') | ||
let path = require('path'); | ||
let fs = require('fs'); | ||
let logger = console; | ||
import {copy, ensureDir} from 'fs-extra'; | ||
exports.setMediaDir = function(value) { | ||
const setMediaDir = function(value) { | ||
// jsdoc with requizzle loads the modules twice - so the only way to move config between the two runs is using global | ||
global.wixJsDocPluginMediaDir = value; | ||
}; | ||
global.wixJsDocPluginMediaDir = value | ||
} | ||
exports.setLogger = function(value) { | ||
logger = value; | ||
}; | ||
const setLogger = function(value) { | ||
logger = value | ||
} | ||
exports.init = function(param) { | ||
exports.setMediaDir(param); | ||
}; | ||
const init = function(param) { | ||
setMediaDir(param) | ||
} | ||
export async function ecpAfterMerge(workingDir, projectSubdir) { | ||
await ensureDir(`${workingDir}/media`); | ||
return copy(global.wixJsDocPluginMediaDir, `${workingDir}/media`); | ||
} | ||
async function ecpAfterMerge(workingDir) { | ||
await ensureDir(`${workingDir}/media`) | ||
return copy(global.wixJsDocPluginMediaDir, `${workingDir}/media`) | ||
} | ||
module.exports = { | ||
ecpAfterMerge, | ||
init, | ||
setLogger, | ||
setMediaDir | ||
} |
@@ -1,15 +0,14 @@ | ||
require("babel-polyfill") | ||
import chai from 'chai'; | ||
import chaiSubset from 'chai-subset'; | ||
import tmp from 'tmp-promise'; | ||
import {pathExists} from 'fs-extra'; | ||
const expect = chai.expect; | ||
chai.use(chaiSubset); | ||
import chai from 'chai' | ||
import chaiSubset from 'chai-subset' | ||
import tmp from 'tmp-promise' | ||
import {pathExists} from 'fs-extra' | ||
const expect = chai.expect | ||
chai.use(chaiSubset) | ||
import {setMediaDir, setLogger, ecpAfterMerge} from '../src/index'; | ||
import {setMediaDir, setLogger, ecpAfterMerge} from '../src/index' | ||
let log = []; | ||
let log = [] | ||
const logger = { | ||
error: (_) => log.push(_), | ||
}; | ||
} | ||
@@ -20,25 +19,26 @@ | ||
beforeEach(async () => { | ||
setMediaDir('./test/project'); | ||
setLogger(logger); | ||
log = []; | ||
}); | ||
setMediaDir('./test/project') | ||
setLogger(logger) | ||
log = [] | ||
}) | ||
it('should copy all files from the project dir to the working dir / media directory', async function() { | ||
const tempDir = await tmp.dir(); | ||
const workingDir = tempDir.path; | ||
const tempDir = await tmp.dir() | ||
const workingDir = tempDir.path | ||
await ecpAfterMerge(workingDir); | ||
await ecpAfterMerge(workingDir) | ||
const group10Exists = await pathExists(`${workingDir}/media/group-10@3x.png`); | ||
const menuButtonExists = await pathExists(`${workingDir}/media/menu-button.png`); | ||
const minusExists = await pathExists(`${workingDir}/media/minus@3x.png`); | ||
const plusExists = await pathExists(`${workingDir}/media/plus@3x.png`); | ||
const group10Exists = await pathExists(`${workingDir}/media/group-10@3x.png`) | ||
const menuButtonExists = await pathExists(`${workingDir}/media/menu-button.png`) | ||
const minusExists = await pathExists(`${workingDir}/media/minus@3x.png`) | ||
const plusExists = await pathExists(`${workingDir}/media/plus@3x.png`) | ||
expect(group10Exists).to.be.true; | ||
expect(menuButtonExists).to.be.true; | ||
expect(minusExists).to.be.true; | ||
expect(plusExists).to.be.true; | ||
expect(group10Exists).to.be.true | ||
expect(menuButtonExists).to.be.true | ||
expect(minusExists).to.be.true | ||
expect(plusExists).to.be.true | ||
// eslint-disable-next-line no-console | ||
console.log(workingDir) | ||
}); | ||
}); | ||
}) | ||
}) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
3
14383
3
10
9
76
1
+ Addeddocworks-jsdoc2spec@^1.8.4
+ Addedacorn@3.3.0(transitive)
+ Addedacorn-jsx@3.0.1(transitive)
+ Addedbluebird@3.4.7(transitive)
+ Addedcatharsis@0.8.11(transitive)
+ Addeddocworks-jsdoc2spec@1.10.8(transitive)
+ Addeddocworks-model@1.10.8(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedespree@3.1.7(transitive)
+ Addedintercept-stdout@0.1.2(transitive)
+ Addedjs2xmlparser@1.0.0(transitive)
+ Addedjsdoc@3.4.3(transitive)
+ Addedklaw@1.3.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlodash._arraycopy@3.0.0(transitive)
+ Addedlodash._basevalues@3.0.0(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
+ Addedlodash.keys@3.1.2(transitive)
+ Addedlodash.toarray@3.0.2(transitive)
+ Addedmarked@0.3.19(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedrequizzle@0.2.4(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedtaffydb@2.6.2(transitive)
+ Addedunderscore@1.8.3(transitive)