<commit_before>/*jshint node:true*/

var fs          = require('fs');
var path        = require('path');
var walkSync    = require('walk-sync');
var stringUtil  = require('../../lib/utilities/string');
var uniq        = require('lodash/array/uniq');
var Blueprint   = require('../../lib/models/blueprint');
var SilentError = require('../../lib/errors/silent');
var date        = new Date();

module.exports = {
  description: 'The default blueprint for ember-cli addons.',

  generatePackageJson: function() {
    var packagePath = path.join(this._appBlueprint.path, 'files', 'package.json');
    var contents    = JSON.parse(fs.readFileSync(packagePath, { encoding: 'utf8' }));

    delete contents.private;
    contents.name = this.project.name();
    contents.description = this.description;
    contents.keywords = contents.keywords || [];
    contents.dependencies = contents.dependencies || {};

    // npm doesn't like it when we have something in both deps and devDeps
    // and dummy app still uses it when in deps
    contents.dependencies['ember-cli-babel'] = contents.devDependencies['ember-cli-babel'];
    delete contents.devDependencies['ember-cli-babel'];

    if (contents.keywords.indexOf('ember-addon') === -1) {
      contents.keywords.push('ember-addon');
    }

    // add `ember-disable-prototype-extensions` to addons by default
    contents.devDependencies['ember-disable-prototype-extensions'] = '^1.0.0';

    // add `ember-try` to addons by default
    contents.devDependencies['ember-try'] = '0.0.4';
    contents.scripts.test = "ember try:testall";

    contents['ember-addon'] = contents['ember-addon'] || {};
    contents['ember-addon'].configPath = 'tests/dummy/config';

    fs.writeFileSync(path.join(this.path, 'files', 'package.json'), JSON.stringify(contents, null, 2));
  },

  generateBowerJson: function() {
    var bowerPath = path.join(this._appBlueprint.path, 'files', 'bower.json');
    var contents  = JSON.parse(fs.readFileSync(bowerPath, { encoding: 'utf8' }));<commit_msg>Upgrade ember-try dependency in addon blueprint<commit_after>/*jshint node:true*/

var fs          = require('fs');
var path        = require('path');
var walkSync    = require('walk-sync');
var stringUtil  = require('../../lib/utilities/string');
var uniq        = require('lodash/array/uniq');
var Blueprint   = require('../../lib/models/blueprint');
var SilentError = require('../../lib/errors/silent');
var date        = new Date();

module.exports = {
  description: 'The default blueprint for ember-cli addons.',

  generatePackageJson: function() {
    var packagePath = path.join(this._appBlueprint.path, 'files', 'package.json');
    var contents    = JSON.parse(fs.readFileSync(packagePath, { encoding: 'utf8' }));

    delete contents.private;
    contents.name = this.project.name();
    contents.description = this.description;
    contents.keywords = contents.keywords || [];
    contents.dependencies = contents.dependencies || {};

    // npm doesn't like it when we have something in both deps and devDeps
    // and dummy app still uses it when in deps
    contents.dependencies['ember-cli-babel'] = contents.devDependencies['ember-cli-babel'];
    delete contents.devDependencies['ember-cli-babel'];

    if (contents.keywords.indexOf('ember-addon') === -1) {
      contents.keywords.push('ember-addon');
    }

    // add `ember-disable-prototype-extensions` to addons by default
    contents.devDependencies['ember-disable-prototype-extensions'] = '^1.0.0';

    // add `ember-try` to addons by default
    contents.devDependencies['ember-try'] = '0.0.6';
    contents.scripts.test = "ember try:testall";

    contents['ember-addon'] = contents['ember-addon'] || {};
    contents['ember-addon'].configPath = 'tests/dummy/config';

    fs.writeFileSync(path.join(this.path, 'files', 'package.json'), JSON.stringify(contents, null, 2));
  },

  generateBowerJson: function() {
    var bowerPath = path.join(this._appBlueprint.path, 'files', 'bower.json');
    var contents  = JSON.parse(fs.readFileSync(bowerPath, { encoding: 'utf8' }));
{'fraction_non_alphanumeric': 0.1630701324178519, 'fraction_numerical': 0.004904364884747425, 'mean_word_length': 3.672394043528064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7454256', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1203, 'n_words': 261}