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

Create config.json based on task run #12778

Merged
merged 1 commit into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Thumbs.db
# ignore .disabled file for default extensions
/src/extensions/default/*/.disabled

# generate through grunt
/src/config.json

#OSX .DS_Store files
.DS_Store

Expand Down
5 changes: 3 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,19 @@ module.exports = function (grunt) {
});

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

// task: test
grunt.registerTask('test', ['eslint', 'jasmine', 'nls-check']);
// grunt.registerTask('test', ['eslint', 'jasmine', 'jasmine_node', 'nls-check']);

// task: set-release
// Update version number in package.json and rewrite src/config.json
grunt.registerTask('set-release', ['update-release-number', 'write-config']);
grunt.registerTask('set-release', ['update-release-number', 'write-config:dev']);

// task: build
grunt.registerTask('build', [
'write-config:dist',
'eslint:src',
'jasmine',
'clean',
Expand Down
3 changes: 3 additions & 0 deletions src/brackets.config.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"healthDataServerURL" : "https://healthdev.brackets.io/healthDataLog"
}
3 changes: 3 additions & 0 deletions src/brackets.config.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"healthDataServerURL" : "https://health.brackets.io/healthDataLog"
}
3 changes: 1 addition & 2 deletions src/brackets.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"extension_registry" : "https://s3.amazonaws.com/extend.brackets/registry.json",
"extension_url" : "https://s3.amazonaws.com/extend.brackets/{0}/{0}-{1}.zip",
"linting.enabled_by_default" : true,
"build_timestamp" : "",
"healthDataServerURL" : "https://health.brackets.io/healthDataLog"
"build_timestamp" : ""
}
}
16 changes: 14 additions & 2 deletions tasks/write-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@ module.exports = function (grunt) {

// task: write-config
grunt.registerTask("write-config", "Merge package.json and src/brackets.config.json into src/config.json", function () {
var packageJSON = grunt.file.readJSON("package.json"),
appConfigJSON = grunt.file.readJSON("src/brackets.config.json");
var name = "dev";
if (this.flags.dist === true) {
name = "dist";
}

var appConfigJSON = grunt.file.readJSON("src/brackets.config.json"),
appConfigEnvJSON = grunt.file.readJSON("src/brackets.config." + name + ".json"),
key;
for (key in appConfigEnvJSON) {
if (appConfigEnvJSON.hasOwnProperty(key)) {
appConfigJSON.config[key] = appConfigEnvJSON[key];
}
}

var packageJSON = grunt.file.readJSON("package.json");
Object.keys(packageJSON).forEach(function (key) {
if (appConfigJSON[key] === undefined) {
appConfigJSON[key] = packageJSON[key];
Expand Down