Permalink
Browse files

Reorganization for publishing as NPM module and adding Browserify sup…

…port
  • Loading branch information...
timdown committed Aug 21, 2014
1 parent 527a167 commit 4f940b7cbb9cc648c964af902f02a9cea4947b74
Showing with 6,396 additions and 12,119 deletions.
  1. +2 −0 .idea/jsLibraryMappings.xml
  2. +1 −2 .idea/rangy_github.iml
  3. +10 −0 .npmignore
  4. +46 −5 builder/build.js
  5. +1 −1 demos/bold.html
  6. +1 −1 demos/bookmark.html
  7. +1 −1 demos/commands.html
  8. +1 −1 demos/commands_new.html
  9. +1 −1 demos/events.html
  10. +1 −1 demos/highlighter-old.html
  11. +1 −1 demos/highlighter.html
  12. +1 −1 demos/position.html
  13. +1 −1 demos/position2.html
  14. +1 −1 demos/scopedhighlights.html
  15. +15 −15 {lib → external}/jshashtable.js
  16. +6,177 −6,177 {lib → external}/log4javascript.js
  17. +22 −22 {lib → external}/log4javascript_stub.js
  18. +2 −0 fiddlings/browserify/main.js
  19. +10 −0 fiddlings/browserify/test.html
  20. +1 −1 { → fiddlings}/spec/innerText.htm
  21. 0 { → fiddlings}/spec/innerText_files/dfn.js
  22. +0 −5,814 lib/log4javascript-1.4.1.js
  23. +31 −0 package.json
  24. +1 −5 src/js/core/core.js
  25. +21 −21 src/js/modules/rangy-classapplier.js
  26. +4 −4 src/js/modules/rangy-highlighter.js
  27. +1 −1 src/js/modules/rangy-selectionsaverestore.js
  28. +1 −1 src/js/modules/rangy-serializer.js
  29. +1 −1 src/js/modules/rangy-textrange.js
  30. +1 −1 src/js/modules/rangy-util.js
  31. +1 −1 test/boldifier.html
  32. +1 −1 test/classapplier.html
  33. +2 −2 test/classappliertests.html
  34. +2 −2 test/commandnewtests.html
  35. +1 −1 test/commandtests.html
  36. +1 −1 test/controlrange.html
  37. +1 −1 test/controlrange2.html
  38. +1 −1 test/domrange.html
  39. +1 −1 test/extend.html
  40. +2 −2 test/featuretests.html
  41. +2 −2 test/highlightertests.html
  42. +1 −1 test/html5.html
  43. +1 −1 test/mutator.html
  44. +1 −1 test/mylib.html
  45. +2 −2 test/rangetests.html
  46. +1 −1 test/saverestore.html
  47. +2 −2 test/selectionsaverestoretests.html
  48. +2 −2 test/selectiontests.html
  49. +1 −1 test/serializer.html
  50. +2 −2 test/serializertests.html
  51. +1 −1 test/textareatests.html
  52. +1 −1 test/textinputs_jquery.html
  53. +2 −2 test/textrangeperformance.html
  54. +2 −2 test/textrangeperformancetests.html
  55. +1 −1 test/textranges.html
  56. +2 −2 test/textrangetests-old.html
  57. +2 −2 test/textrangetests.html
@@ -2,6 +2,8 @@
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$/builder" libraries="{Node.js Globals, Node.js v0.10.24 Core Modules}" />
<file url="file://$PROJECT_DIR$/demos" libraries="{HTML5 / EcmaScript 5}" />
<file url="file://$PROJECT_DIR$/fiddlings/browserify" libraries="{Node.js v0.10.24 Core Modules}" />
<file url="PROJECT" libraries="{Node.js v0.10.24 Core Modules}" />
</component>
</project>
View
@@ -2,8 +2,7 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/builder/node_modules" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
View
@@ -0,0 +1,10 @@
roadmap.txt
/.idea
/build
/builder
/demos
/fiddlings
/lib
/spec
/src
/test
View
@@ -15,7 +15,7 @@ var buildSpec = {
gitBranch: "master"
};
var buildDir = "build/";
var buildDir = "dist/";
var gitDir = buildDir + "repository/", srcDir = gitDir + "src/js/";
var zipDir;
@@ -41,6 +41,7 @@ function concat(fileList, destPath) {
fs.writeFileSync(destPath, out.join("\n"), FILE_ENCODING);
}
/*
function copyFileSync(srcFile, destFile) {
var BUF_LENGTH, buff, bytesRead, fdr, fdw, pos;
BUF_LENGTH = 64 * 1024;
@@ -57,6 +58,43 @@ function copyFileSync(srcFile, destFile) {
fs.closeSync(fdr);
return fs.closeSync(fdw);
}
*/
function copyFileSync(srcFile, destFile, preserveTimestamps) {
var contents = fs.readFileSync(srcFile);
fs.writeFileSync(destFile, contents);
var stat = fs.lstatSync(srcFile);
fs.chmodSync(destFile, stat.mode);
if (preserveTimestamps) {
fs.utimesSync(destFile, stat.atime, stat.mtime)
}
}
function copyFilesRecursive(srcDir, destDir) {
if (fs.existsSync(destDir)) {
if (!fs.statSync(destDir).isDirectory()) {
throw new Error("Destination exists and is not a directory");
}
} else {
fs.mkdirSync(destDir, fs.statSync(srcDir).mode);
}
var files = fs.readdirSync(srcDir);
Array.prototype.forEach.call(files, function(fileName) {
var srcFilePath = path.join(srcDir, fileName);
var destFilePath = path.join(destDir, fileName);
var srcFileInfo = fs.lstatSync(srcFilePath);
if (srcFileInfo.isDirectory()) {
copyFilesRecursive(srcFilePath, destFilePath);
} else if (srcFileInfo.isSymbolicLink()) {
throw new Error("Symbolic links are not supported");
} else {
copyFileSync(srcFilePath, destFilePath);
}
});
}
function deleteBuildDir() {
// Delete the old build directory
@@ -140,11 +178,9 @@ function copyModuleScripts() {
' if (typeof define == "function" && define.amd) {',
' // AMD. Register as an anonymous module with a dependency on Rangy.',
' define(' + dependencies + ', factory);',
' /*',
' } else if (typeof exports == "object") {',
' } else if (typeof module != "undefined" && typeof exports == "object") {',
' // Node/CommonJS style for Browserify',
' module.exports = factory;',
' */',
' } else {',
' // No AMD or CommonJS support so we use the rangy global variable',
' factory(global.rangy);',
@@ -339,6 +375,10 @@ var tarGz = createArchiver("tar.gz", function() {
});
});
function copyToLib() {
copyFilesRecursive(uncompressedBuildDir, "lib/");
}
/*--------------------------------------------------------------------------------------------------------------------*/
// Start the build
@@ -356,7 +396,8 @@ var actions = [
lint,
minify,
zip,
tarGz
tarGz,
copyToLib
];
View
@@ -14,7 +14,7 @@
color: red;
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
<script type="text/javascript" src="../src/js/core/domrange.js"></script>
View
@@ -3,7 +3,7 @@
<head>
<title>Rangy Core Demo</title>
<link href="demo.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
<script type="text/javascript" src="../src/js/core/domrange.js"></script>
View
@@ -21,7 +21,7 @@
margin-right: 5px;
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript">
var appender = new log4javascript.PopUpAppender();
log4javascript.getRootLogger().addAppender(appender);
View
@@ -21,7 +21,7 @@
margin-right: 5px;
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript">
var appender = new log4javascript.PopUpAppender();
log4javascript.getRootLogger().addAppender(appender);
View
@@ -29,7 +29,7 @@
font-weight: bold;
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
@@ -12,7 +12,7 @@
background-color: limegreen;
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
<script type="text/javascript" src="../src/js/core/domrange.js"></script>
View
@@ -16,7 +16,7 @@
border: dotted orange 1px;
}
</style>
<script type="text/javascript" src="../lib/log4javascript_stub.js"></script>
<script type="text/javascript" src="../external/log4javascript_stub.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
<script type="text/javascript" src="../src/js/core/domrange.js"></script>
View
@@ -34,7 +34,7 @@
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
<script type="text/javascript" src="../src/js/core/domrange.js"></script>
View
@@ -34,7 +34,7 @@
}
</style>
<script type="text/javascript" src="../lib/log4javascript.js"></script>
<script type="text/javascript" src="../external/log4javascript.js"></script>
<script type="text/javascript">
var appender = new log4javascript.PopUpAppender();
log4javascript.getRootLogger().addAppender(appender);
@@ -8,7 +8,7 @@
background-color: yellow;
}
</style>
<script type="text/javascript" src="../lib/log4javascript_stub.js"></script>
<script type="text/javascript" src="../external/log4javascript_stub.js"></script>
<script type="text/javascript" src="../src/js/core/core.js"></script>
<script type="text/javascript" src="../src/js/core/dom.js"></script>
<script type="text/javascript" src="../src/js/core/domrange.js"></script>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 4f940b7

Please sign in to comment.