module.exports = function(grunt) {
  var target = grunt.option('target') || '{%= name %}_test'
  var title = '{%= title %} Test'
  if (target == '{%= name %}') {
    title = '{%= title %}'
  }

  var modinfoProcessor = function(target, title) {
    return function(content, srcpath) {
      var info = JSON.parse(content)
      info.date = require('dateformat')(new Date(), 'yyyy/mm/dd')
      info.display_name = title || info.display_name
      if (target) {
        info.id = target
        info.identifier = "pa.wondible." + target
      }
      for (var scene in info.scenes) {
        if (info.scenes[scene][0].match('require.js')) {
          info.scenes[scene].shift()
        }
        info[scene] = info.scenes[scene]
      }
      console.log(info.id, info.version, info.date)
      return JSON.stringify(info, null, 2)
    }
  }

  // Project configuration.
  grunt.initConfig({
    target: target,
    requirejs: {
      target: {
        options: {
          baseUrl: 'ui/mods',
          mainConfigFile: 'ui/mods/{%= name %}/bootstrap.js',
          skipDirOptimize: true,
          optimize: 'none',
          stubModules: ['text'],

          //name: 'lib/ext/almond',
          name: '{%= name %}/main',
          out: '../<%= target %>/ui/mods/{%= name %}/bootstrap.js',

          skipModuleInsertion: true,
          onBuildWrite: function( name, path, contents ) {
            return require('amdclean').clean({
              code: contents,
              globalObject: true,
              globalObjectName: '{%= name %}',
            });
          },
        }
      }
    },
    copy: {
      simple: {
        files: [
          {
            src: [
              'LICENSE.txt',
              'README.md',
              'CHANGELOG.md',
              'ui/mods/{%= name %}/*.css'],
            dest: '../<%= target %>/',
          },
        ],
      },
      modinfo: {
        files: [
          {
            src: 'modinfo.dev.json',
            dest: '../<%= target %>/modinfo.json',
          },
        ],
        options: {
          process: function(content, srcpath) {
            var info = JSON.parse(content)
            info.date = require('dateformat')(new Date(), 'yyyy/mm/dd')
            info.display_name = title
            info.id = target
            info.identifier = "pa.wondible." + target
            for (var scene in info.scenes) {
              if (info.scenes[scene][0].match('require.js')) {
                info.scenes[scene].shift()
              }
              info[scene] = info.scenes[scene]
            }
            console.log(info.id, info.version, info.date)
            return JSON.stringify(info, null, 2)
          }
        }
      },
      dev: {
        files: [
          {
            src: 'modinfo.dev.json',
            dest: 'modinfo.json',
          },
        ],
        options: {
          process: function(content, srcpath) {
            var info = JSON.parse(content)
            info.date = require('dateformat')(new Date(), 'yyyy/mm/dd')
            for (var scene in info.scenes) {
              info[scene] = info.scenes[scene]
            }
            console.log(info.id, info.version, info.date)
            return JSON.stringify(info, null, 2)
          }
        }
      }
    },
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-contrib-copy');

  // Default task(s).
  grunt.registerTask('default', ['requirejs', 'copy:simple', 'copy:modinfo']);

};

@@ -2502,55 +2502,8 @@
   %7D%0A
-              info%5Bscene%5D = info.scenes%5Bscene%5D%0A
     
@@ -2791,425 +2791,8 @@
  %5D,%0A
-        options: %7B%0A          process: function(content, srcpath) %7B%0A            var info = JSON.parse(content)%0A            info.date = require('dateformat')(new Date(), 'yyyy/mm/dd')%0A            for (var scene in info.scenes) %7B%0A              info%5Bscene%5D = info.scenes%5Bscene%5D%0A            %7D%0A            console.log(info.id, info.version, info.date)%0A            return JSON.stringify(info, null, 2)%0A          %7D%0A        %7D%0A
     

remove coping scenes to top level