Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Move npm dependencies inside src and add CodeMirror to them
Browse files Browse the repository at this point in the history
  • Loading branch information
ficristo authored and ficristo committed Dec 7, 2016
1 parent 973cf51 commit 30fdf93
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Thumbs.db
/node_modules
/npm-debug.log

# ignore node_modules inside src
/src/node_modules

# ignore compiled files
/dist
/src/.index.html
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "src/thirdparty/CodeMirror"]
path = src/thirdparty/CodeMirror
url = https://github.com/adobe/CodeMirror2.git
[submodule "src/thirdparty/path-utils"]
path = src/thirdparty/path-utils
url = https://github.com/jblas/path-utils.git
Expand Down
23 changes: 16 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ module.exports = function (grunt) {
cwd: 'src/',
src: [
'nls/{,*/}*.js',
'package.json',
'npm-shrinkwrap.json',
'xorigin.js',
'dependencies.js',
'thirdparty/requirejs/require.js',
Expand Down Expand Up @@ -278,11 +280,6 @@ module.exports = function (grunt) {
vendor : [
'test/polyfills.js', /* For reference to why this polyfill is needed see Issue #7951. The need for this should go away once the version of phantomjs gets upgraded to 2.0 */
'src/thirdparty/jquery-2.1.3.min.js',
'src/thirdparty/CodeMirror/lib/codemirror.js',
'src/thirdparty/CodeMirror/lib/util/dialog.js',
'src/thirdparty/CodeMirror/lib/util/searchcursor.js',
'src/thirdparty/CodeMirror/addon/edit/closetag.js',
'src/thirdparty/CodeMirror/addon/selection/active-line.js',
'src/thirdparty/less-2.5.1.min.js'
],
helpers : [
Expand All @@ -298,7 +295,19 @@ module.exports = function (grunt) {
'spec' : '../test/spec',
'text' : 'thirdparty/text/text',
'i18n' : 'thirdparty/i18n/i18n'
}
},
map: {
"*": {
"thirdparty/CodeMirror2": "thirdparty/CodeMirror"
}
},
packages: [
{
name: "thirdparty/CodeMirror",
location: "node_modules/codemirror",
main: "lib/codemirror"
}
]
}
}
}
Expand All @@ -323,7 +332,7 @@ module.exports = function (grunt) {
});

// task: install
grunt.registerTask('install', ['write-config', 'less', 'npm-install-extensions']);
grunt.registerTask('install', ['write-config', 'less', 'npm-install-source']);

// task: test
grunt.registerTask('test', ['eslint', 'jasmine', 'nls-check']);
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"branch": "",
"SHA": ""
},
"dependencies": {
"anymatch": "1.3.0",
"chokidar": "1.6.0",
"lodash": "4.15.0"
},
"devDependencies": {
"glob": "7.0.6",
"grunt": "0.4.5",
Expand Down
5 changes: 0 additions & 5 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
"branch": "",
"SHA": ""
},
"dependencies": {
"anymatch": "1.3.0",
"chokidar": "1.6.0",
"lodash": "4.15.0"
},
"devDependencies": {
"glob": "7.0.6",
"grunt": "0.4.5",
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<!-- Warn about failed cross origin requests in Chrome -->
<script type="application/javascript" src="xorigin.js"></script>

<link rel="stylesheet" type="text/css" href="thirdparty/CodeMirror/lib/codemirror.css">
<link rel="stylesheet" type="text/css" href="node_modules/codemirror/lib/codemirror.css">
<!--(if target dev)><!-->
<link rel="stylesheet/less" type="text/css" href="styles/brackets.less">
<!--<!(endif)-->
Expand Down
11 changes: 9 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ require.config({
map: {
"*": {
"thirdparty/CodeMirror2": "thirdparty/CodeMirror",
"thirdparty/react": "react"
"thirdparty/react": "react"
}
}
},
packages: [
{
name: "thirdparty/CodeMirror",
location: "node_modules/codemirror",
main: "lib/codemirror"
}
]
});

if (window.location.search.indexOf("testEnvironment") > -1) {
Expand Down
50 changes: 27 additions & 23 deletions npm-shrinkwrap.json → src/npm-shrinkwrap.json

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

9 changes: 9 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "brackets-src",
"dependencies": {
"anymatch": "1.3.0",
"chokidar": "1.6.0",
"codemirror": "5.21.0",
"lodash": "4.15.0"
}
}
1 change: 0 additions & 1 deletion src/thirdparty/CodeMirror
Submodule CodeMirror deleted from 40210a
21 changes: 13 additions & 8 deletions tasks/npm-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,18 @@ module.exports = function (grunt) {
}

grunt.registerTask("npm-install", "Install node_modules to the dist folder so it gets bundled with release", function () {
var npmShrinkwrapJSON = grunt.file.readJSON("npm-shrinkwrap.json");
common.writeJSON(grunt, "dist/npm-shrinkwrap.json", npmShrinkwrapJSON);

var packageJSON = grunt.file.readJSON("package.json");
delete packageJSON.devDependencies;
delete packageJSON.scripts; // we don't want to run post-install scripts in dist folder
common.writeJSON(grunt, "dist/package.json", packageJSON);

var done = this.async();
runNpmInstall("dist", function (err) {
return err ? done(false) : done();
});
});

grunt.registerTask("npm-install-src", "Install node_modules to the src folder", function () {
var done = this.async();
runNpmInstall("src", function (err) {
return err ? done(false) : done();
});
});

grunt.registerTask("npm-install-extensions", "Install node_modules for default extensions which have package.json defined", function () {
var _done = this.async();
Expand All @@ -80,4 +79,10 @@ module.exports = function (grunt) {
});
});

grunt.registerTask(
"npm-install-source",
"Install node_modules for src folder and default extensions which have package.json defined",
["npm-install-src", "npm-install-extensions"]
);

};
12 changes: 10 additions & 2 deletions test/SpecRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,17 @@ require.config({
},
map: {
"*": {
"thirdparty/react": "react"
"thirdparty/CodeMirror2": "thirdparty/CodeMirror",
"thirdparty/react": "react"
}
}
},
packages: [
{
name: "thirdparty/CodeMirror",
location: "node_modules/codemirror",
main: "lib/codemirror"
}
]
});

define(function (require, exports, module) {
Expand Down

0 comments on commit 30fdf93

Please sign in to comment.