docs: function generatePackageJson (config) {
  
  	// Read the user's package.json
  	var user_file;
  	try {
  		// Read from current file
  		user_file = fs.readFileSync('./package.json').toString();
  	} catch (e) {
  		user_file = null;
  	}
  
  	// Parse the user's package.json
  	var user_json = null;
  	if (user_file) {
  		try {
  			user_json = JSON.parse(user_file);
  		} catch (e) {
  			console.log(colors.bold.red('Your package.json was invalid!\n\
  	We skipped the merging of your package.json with template.'));
  			console.log(user_json);
  			return null;
  		}
  	} else {
  		user_json = {};
  	}
  
  	// Read the template package.json
  	var tmpl_file = fs.readFileSync(__dirname + '/../templates/package.json.tmpl').toString();
  
  	// Replace the placeholders (e.g. %deviceType%) of whole of template
  	for (var config_key in config) {
  		tmpl_file = tmpl_file.replace(new RegExp('\\%' + config_key + '\\%', 'g'), config[config_key]);
  	}
  	tmpl_file = tmpl_file.replace(new RegExp('\\%libVersion\\%', 'g'), helper.getPackageInfo().version);
  
  	// Parse the template package.json
  	var tmpl_json = null;
  	try {
  		tmpl_json = JSON.parse(tmpl_file);
  	} catch (e) {
  		console.error('Could not parse the template file:\n' + tmpl_file + '\n' + e.stack.toString());
  		process.exit(0);
  	}
  
  	// Merge the fields with template package.json
  	for (var key in tmpl_json) {
  		if (user_json[key] == null) {
  			user_json[key] = tmpl_json[key];
  		} else if (helper.isType(user_json[key], 'Object')) {
  			for (var key_ in tmpl_json[key]) {
  				if (user_json[key][key_] == null) user_json[key][key_] = tmpl_json[key][key_];
  			}
  		}
  	}
  
  	// Done
  	return JSON.stringify(user_json,  null, '  ');
  
  }