forked from mizzao/meteor-sharejs
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch CodeMirror to peer dependency
Fix mizzao#87 by allowing user to include any version of CodeMirror they like via `meteor npm install codemirror`. Also makes it easy to include addons and themes.
- Loading branch information
Showing
11 changed files
with
118 additions
and
137 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
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 |
---|---|---|
|
@@ -3,14 +3,17 @@ | |
# 'meteor add' and 'meteor remove' will edit this file for you, | ||
# but you can also edit it by hand. | ||
|
||
autopublish | ||
insecure | ||
autopublish@1.0.7 | ||
insecure@1.0.7 | ||
standard-app-packages | ||
stylus | ||
stylus@=2.513.8 | ||
mizzao:sharejs | ||
mizzao:sharejs-codemirror | ||
mizzao:sharejs-ace | ||
twbs:bootstrap | ||
standard-minifiers | ||
modules | ||
ecmascript | ||
[email protected] | ||
[email protected] | ||
standard-minifier-css | ||
standard-minifier-js | ||
shell-server | ||
dynamic-import |
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 +1 @@ | ||
METEOR@1.4.2.3 | ||
METEOR@1.7.0.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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,61 +1,10 @@ | ||
Package.describe({ | ||
name: "mizzao:sharejs-codemirror", | ||
summary: "ShareJS with the CodeMirror Editor", | ||
version: "5.22.0", | ||
version: "5.39.2", | ||
git: "https://github.com/mizzao/meteor-sharejs.git" | ||
}); | ||
|
||
Npm.depends({ | ||
codemirror: "5.22.0" | ||
}); | ||
|
||
|
||
// Ugly-ass function stolen from http://stackoverflow.com/a/20794116/586086 | ||
// TODO make this less ugly in future | ||
function getFilesFromFolder(packageName, folder){ | ||
// local imports | ||
var _ = Npm.require("underscore"); | ||
var fs = Npm.require("fs"); | ||
var path = Npm.require("path"); | ||
// helper function, walks recursively inside nested folders and return absolute filenames | ||
function walk(folder){ | ||
var filenames = []; | ||
// get relative filenames from folder | ||
var folderContent = fs.readdirSync(folder); | ||
// iterate over the folder content to handle nested folders | ||
_.each(folderContent, function(filename) { | ||
// build absolute filename | ||
var absoluteFilename = path.join(folder, filename); | ||
// get file stats | ||
var stat = fs.statSync(absoluteFilename); | ||
if(stat.isDirectory()){ | ||
// directory case => add filenames fetched from recursive call | ||
filenames = filenames.concat(walk(absoluteFilename)); | ||
} | ||
else{ | ||
// file case => simply add it | ||
filenames.push(absoluteFilename); | ||
} | ||
}); | ||
return filenames; | ||
} | ||
// save current working directory (something like "/home/user/projects/my-project") | ||
var cwd = process.cwd(); | ||
|
||
var isRunningFromApp = fs.existsSync(path.resolve("packages")); | ||
var packagePath = isRunningFromApp ? path.resolve("packages", packageName) : ""; | ||
console.log(packagePath); | ||
|
||
packagePath = path.resolve(packagePath); | ||
// chdir to our package directory | ||
process.chdir(path.join(packagePath)); | ||
// launch initial walk | ||
var result = walk(folder); | ||
// restore previous cwd | ||
process.chdir(cwd); | ||
return result; | ||
} | ||
|
||
Package.onUse(function (api) { | ||
api.versionsFrom("1.3.2"); | ||
|
||
|
@@ -64,10 +13,6 @@ Package.onUse(function (api) { | |
api.use("mizzao:[email protected]"); | ||
api.imply("mizzao:sharejs"); | ||
|
||
// Add Ace files as assets that can be loaded by the client later | ||
var codemirrorData = getFilesFromFolder("mizzao:sharejs-codemirror", ".npm/package/node_modules/codemirror"); | ||
api.addAssets(codemirrorData, 'client'); | ||
|
||
api.mainModule('client.js', 'client'); | ||
api.addFiles([ | ||
'templates.html' | ||
|