Skip to content

Commit

Permalink
now uses web-module-linker, please re-run npm install to solve depend…
Browse files Browse the repository at this point in the history
…encies
  • Loading branch information
shaack committed Aug 1, 2018
1 parent a1641af commit bfa42d3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 34 deletions.
4 changes: 1 addition & 3 deletions .gitignore
@@ -1,5 +1,3 @@
/.idea
/node_modules
/src/**
!/src/cm-chessboard
!/src/cm-chessboard/**
/lib
12 changes: 9 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -30,6 +30,7 @@
},
"devDependencies": {
"browser-es-module-loader": "^0.4.1",
"svjs-test": "^1.3.3"
"svjs-test": "^1.3.5",
"web-module-linker": "^1.0.4"
}
}
28 changes: 3 additions & 25 deletions postinstall.js
@@ -1,27 +1,5 @@
const fs = require("fs")
const process = require("process")
const path = require("path")
const WebModuleLinker = require("web-module-linker")

// link dependencies
process.chdir('./src')
symlinkModuleSrc("svjs-svg")
const linker = new WebModuleLinker(__dirname)


function symlinkModuleSrc(moduleName) {
try {
fs.symlinkSync(resolveModulePath(moduleName), moduleName, "dir")
} catch (e) {
console.log(e.message)
}
}

function resolveModulePath(moduleName) {
try {
const pathToMainJs = require.resolve(moduleName)
console.log("pathToMainJs", pathToMainJs)
return pathToMainJs.substr(0, pathToMainJs.lastIndexOf(moduleName) + moduleName.length)
} catch (e) {
console.warn(e)
return null
}
}
linker.symlinkModuleSrc("svjs-svg")
2 changes: 1 addition & 1 deletion src/cm-chessboard/ChessboardMoveInput.js
Expand Up @@ -4,7 +4,7 @@
* License: MIT, see file 'LICENSE'
*/

import {Svg} from "../svjs-svg/Svg.js"
import {Svg} from "../../lib/svjs-svg/Svg.js"
import {MOVE_INPUT_MODE, MARKER_TYPE} from "./Chessboard.js"

const STATE = {
Expand Down
2 changes: 1 addition & 1 deletion src/cm-chessboard/ChessboardView.js
Expand Up @@ -4,7 +4,7 @@
* License: MIT, see file 'LICENSE'
*/

import {Svg} from "../svjs-svg/Svg.js"
import {Svg} from "../../lib/svjs-svg/Svg.js"
import {SQUARE_COORDINATES} from "./ChessboardState.js"
import {ChessboardMoveInput} from "./ChessboardMoveInput.js"
import {COLOR, MOVE_INPUT_MODE, INPUT_EVENT_TYPE} from "./Chessboard.js"
Expand Down

0 comments on commit bfa42d3

Please sign in to comment.