cm-web-modules
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "cm-web-modules", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Collection of clean and small ES6 modules for the web", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,13 +33,13 @@ /** | ||
* Add a module to the library | ||
* @param moduleName Name of the module | ||
* @param moduleSourceRoot The source root inside the module folder | ||
* @param moduleSource The module source folder or file inside the 'moduleSourceRoot' | ||
* @param projectName Name of the project | ||
* @param projectSourceRoot The source root inside the module folder | ||
* @param subfolder The module source folder or file inside the 'moduleSourceRoot' | ||
*/ | ||
addModule(moduleName, moduleSourceRoot = "src", moduleSource = moduleName) { | ||
addProject(projectName, projectSourceRoot = "src", subfolder = projectName) { | ||
let type = "dir" | ||
if (moduleSource.endsWith(".js")) { | ||
if (subfolder.endsWith(".js")) { | ||
type = "file" | ||
} | ||
try { | ||
const fromAbsolute = this.props.nodeModulesPath + "/" + moduleName + "/" + moduleSourceRoot + "/" + moduleSource | ||
const fromAbsolute = this.props.nodeModulesPath + "/" + projectName + "/" + projectSourceRoot + "/" + subfolder | ||
if (!fs.existsSync(fromAbsolute)) { | ||
@@ -49,3 +49,3 @@ console.error("Not found: " + fromAbsolute) | ||
const fromRelative = path.relative(this.projectRoot + "/" + this.props.projectLibFolder, fromAbsolute) | ||
const toRelative = "./" + this.props.projectLibFolder + "/" + moduleSource | ||
const toRelative = "./" + this.props.projectLibFolder + "/" + subfolder | ||
console.log("Adding", fromRelative, "=>", toRelative, "(" + type + ")") | ||
@@ -52,0 +52,0 @@ if (fs.existsSync(toRelative)) { |
55322