2014-01-10 17:20:35 -07:00
|
|
|
module.exports = function(grunt) {
|
2014-03-17 19:04:10 -06:00
|
|
|
require('load-grunt-tasks')(grunt);
|
2015-10-07 17:11:26 -04:00
|
|
|
var path = require('path');
|
|
|
|
|
|
2014-01-10 17:20:35 -07:00
|
|
|
grunt.initConfig({
|
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2014-03-17 19:05:46 -06:00
|
|
|
pkgMeta: grunt.file.readJSON('config/meta.json'),
|
|
|
|
|
dest: grunt.option('target') || 'dist',
|
|
|
|
|
basePath: path.join('<%= dest %>', 'App_Plugins', '<%= pkgMeta.name %>'),
|
2014-01-17 00:12:29 -07:00
|
|
|
|
2015-10-07 17:11:26 -04:00
|
|
|
'string-replace': {
|
|
|
|
|
version: {
|
|
|
|
|
files: {
|
|
|
|
|
"app/controllers/controller_versioned.js": "app/controllers/controller.js",
|
2015-10-07 17:34:35 -04:00
|
|
|
"app/less/archetype_versioned.less": "app/less/archetype.less",
|
|
|
|
|
"app/views/archetype.config.developer.dialog_versioned.html": "app/views/archetype.config.developer.dialog.html",
|
|
|
|
|
"app/views/archetype.config.stylescript.dialog_versioned.html": "app/views/archetype.config.stylescript.dialog.html",
|
|
|
|
|
"app/views/archetype.config.fieldset.dialog_versioned.html": "app/views/archetype.config.fieldset.dialog.html",
|
|
|
|
|
"app/views/archetype.config_versioned.html": "app/views/archetype.config.html",
|
|
|
|
|
"app/views/archetype_versioned.html": "app/views/archetype.html",
|
2016-01-04 15:02:02 -05:00
|
|
|
"app/views/archetype.default_versioned.html": "app/views/archetype.default.html"
|
2015-10-07 17:11:26 -04:00
|
|
|
},
|
|
|
|
|
options: {
|
|
|
|
|
replacements: [{
|
|
|
|
|
pattern: /{{VERSION}}/g,
|
|
|
|
|
replacement: '/* Version <%= pkgMeta.version %> */'
|
2015-10-07 17:34:35 -04:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
pattern: /{{VERSION_HTML}}/g,
|
|
|
|
|
replacement: '<!-- Version <%= pkgMeta.version %> -->'
|
2015-10-07 17:11:26 -04:00
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2014-01-10 17:20:35 -07:00
|
|
|
watch: {
|
2014-03-17 19:04:10 -06:00
|
|
|
options: {
|
2014-03-17 19:05:46 -06:00
|
|
|
spawn: false,
|
|
|
|
|
atBegin: true
|
2014-03-17 19:04:10 -06:00
|
|
|
},
|
|
|
|
|
|
2014-01-10 17:20:35 -07:00
|
|
|
less: {
|
2014-03-17 19:05:46 -06:00
|
|
|
files: ['app/**/*.less'],
|
2015-10-07 17:11:26 -04:00
|
|
|
tasks: ['string-replace', 'less:dist']
|
2014-01-10 17:20:35 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
js: {
|
2014-03-17 19:05:46 -06:00
|
|
|
files: ['app/**/*.js'],
|
2015-10-08 08:43:08 -04:00
|
|
|
tasks: ['string-replace', 'concat:dist']
|
2014-01-12 03:26:08 -07:00
|
|
|
},
|
|
|
|
|
|
2014-03-17 19:05:46 -06:00
|
|
|
html: {
|
|
|
|
|
files: ['app/**/*.html'],
|
2015-10-08 08:43:08 -04:00
|
|
|
tasks: ['string-replace', 'copy:html']
|
2014-03-17 19:05:46 -06:00
|
|
|
},
|
|
|
|
|
|
2014-03-17 19:04:10 -06:00
|
|
|
dll: {
|
|
|
|
|
files: ['app/Umbraco/**/*.dll'],
|
2014-03-17 19:05:46 -06:00
|
|
|
tasks: ['copy:dll']
|
2015-10-08 08:56:48 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
assets: {
|
|
|
|
|
files: ['assets/*.*'],
|
|
|
|
|
tasks: ['copy:assets']
|
2014-03-17 19:05:46 -06:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
less: {
|
|
|
|
|
dist: {
|
|
|
|
|
options: {
|
|
|
|
|
paths: ["app/less", "lib/less", "vendor"],
|
|
|
|
|
},
|
|
|
|
|
files: {
|
2015-10-07 17:11:26 -04:00
|
|
|
'<%= basePath %>/css/archetype.css': 'app/less/archetype_versioned.less',
|
2014-03-17 19:05:46 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
concat: {
|
|
|
|
|
options: {
|
|
|
|
|
stripBanners: false
|
|
|
|
|
},
|
|
|
|
|
dist: {
|
|
|
|
|
src: [
|
2015-10-07 17:11:26 -04:00
|
|
|
'app/controllers/controller_versioned.js',
|
2014-03-17 19:05:46 -06:00
|
|
|
'app/controllers/config.controller.js',
|
2015-10-07 12:20:09 -04:00
|
|
|
'app/controllers/config.dialog.controller.js',
|
2017-09-06 12:20:52 -04:00
|
|
|
'app/controllers/config.global.controller.js',
|
2014-03-17 19:05:46 -06:00
|
|
|
'app/directives/archetypeproperty.js',
|
2015-04-04 21:57:49 +02:00
|
|
|
'app/directives/archetypesubmitwatcher.js',
|
2014-06-16 11:06:59 -04:00
|
|
|
'app/directives/archetypecustomview.js',
|
2015-06-01 12:12:33 -04:00
|
|
|
'app/directives/archetypeLocalize.js',
|
2015-08-19 11:57:13 +02:00
|
|
|
'app/directives/archetypeclickoutside.js',
|
2015-06-01 12:12:33 -04:00
|
|
|
'app/services/archetypeLocalizationService.js',
|
|
|
|
|
'app/helpers/sampleLabelHelpers.js',
|
|
|
|
|
'app/resources/archetypePropertyEditorResource.js',
|
2015-06-01 09:45:10 -04:00
|
|
|
'app/services/archetypeService.js',
|
2015-06-01 10:13:29 -04:00
|
|
|
'app/services/archetypeLabelService.js',
|
2017-09-06 12:20:52 -04:00
|
|
|
'app/services/archetypeCacheService.js',
|
|
|
|
|
'app/services/archetypeGlobalConfigService.js'
|
2014-03-17 19:05:46 -06:00
|
|
|
],
|
|
|
|
|
dest: '<%= basePath %>/js/archetype.js'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
copy: {
|
|
|
|
|
html: {
|
|
|
|
|
cwd: 'app/views/',
|
2015-10-07 17:34:35 -04:00
|
|
|
src: [
|
|
|
|
|
'archetype_versioned.html',
|
|
|
|
|
'archetype.default_versioned.html',
|
|
|
|
|
'archetype.config_versioned.html',
|
|
|
|
|
'archetype.config.fieldset.dialog_versioned.html',
|
|
|
|
|
'archetype.config.stylescript.dialog_versioned.html',
|
|
|
|
|
'archetype.config.developer.dialog_versioned.html'
|
|
|
|
|
],
|
|
|
|
|
dest: '<%= basePath %>/views/',
|
|
|
|
|
expand: true,
|
|
|
|
|
rename: function(dest, src) {
|
|
|
|
|
return dest + src.replace('_versioned','');
|
|
|
|
|
}
|
2014-03-17 19:05:46 -06:00
|
|
|
},
|
2015-10-07 16:11:15 -04:00
|
|
|
assets: {
|
|
|
|
|
cwd: 'assets/',
|
2015-10-08 07:52:30 -04:00
|
|
|
src: ['*.*'],
|
2015-10-07 16:11:15 -04:00
|
|
|
dest: '<%= basePath %>/assets',
|
|
|
|
|
expand: true
|
|
|
|
|
},
|
2014-03-17 19:05:46 -06:00
|
|
|
dll: {
|
2016-03-20 12:08:23 +01:00
|
|
|
cwd: 'app/Umbraco/Umbraco.Archetype/bin/Release/',
|
2014-05-07 15:10:25 +01:00
|
|
|
src: 'Archetype.dll',
|
2014-03-17 19:05:46 -06:00
|
|
|
dest: '<%= dest %>/bin/',
|
|
|
|
|
expand: true
|
|
|
|
|
},
|
|
|
|
|
config: {
|
|
|
|
|
files: [
|
|
|
|
|
{
|
|
|
|
|
cwd: 'app/langs/',
|
|
|
|
|
src: ['**'],
|
|
|
|
|
dest: '<%= basePath %>/langs',
|
|
|
|
|
expand: true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
nuget: {
|
|
|
|
|
files: [
|
|
|
|
|
{
|
|
|
|
|
cwd: '<%= dest %>',
|
|
|
|
|
src: ['**/*', '!bin', '!bin/*'],
|
|
|
|
|
dest: 'tmp/nuget/content',
|
|
|
|
|
expand: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cwd: '<%= dest %>/bin',
|
|
|
|
|
src: ['*.dll'],
|
2016-01-04 15:02:02 -05:00
|
|
|
dest: 'tmp/nuget_binaries/lib/net40',
|
2014-03-17 19:05:46 -06:00
|
|
|
expand: true
|
2016-01-05 08:35:35 -05:00
|
|
|
},
|
|
|
|
|
{
|
2016-01-13 12:26:19 +00:00
|
|
|
cwd: 'app/Umbraco/Archetype.Courier/bin/Release/',
|
2016-01-05 08:35:35 -05:00
|
|
|
src: ['Archetype.Courier.dll'],
|
|
|
|
|
dest: 'tmp/nuget_courier/lib/net40',
|
|
|
|
|
expand: true
|
2014-03-17 19:05:46 -06:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
umbraco: {
|
|
|
|
|
cwd: '<%= dest %>',
|
|
|
|
|
src: '**/*',
|
|
|
|
|
dest: 'tmp/umbraco',
|
|
|
|
|
expand: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
nugetpack: {
|
2015-10-08 08:43:08 -04:00
|
|
|
dist: {
|
|
|
|
|
src: 'tmp/nuget/package.nuspec',
|
|
|
|
|
dest: 'pkg'
|
2016-01-04 15:02:02 -05:00
|
|
|
},
|
|
|
|
|
dist_binaries: {
|
|
|
|
|
src: 'tmp/nuget_binaries/package_binaries.nuspec',
|
|
|
|
|
dest: 'pkg'
|
2016-01-05 08:35:35 -05:00
|
|
|
},
|
|
|
|
|
dist_courier: {
|
|
|
|
|
src: 'tmp/nuget_courier/package_courier.nuspec',
|
|
|
|
|
dest: 'pkg'
|
2015-10-08 08:43:08 -04:00
|
|
|
}
|
2014-03-17 19:05:46 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
template: {
|
2015-10-08 08:43:08 -04:00
|
|
|
'nuspec': {
|
|
|
|
|
'options': {
|
|
|
|
|
'data': {
|
|
|
|
|
name: '<%= pkgMeta.name %>',
|
|
|
|
|
version: '<%= pkgMeta.version %>',
|
|
|
|
|
url: '<%= pkgMeta.url %>',
|
|
|
|
|
license: '<%= pkgMeta.license %>',
|
|
|
|
|
licenseUrl: '<%= pkgMeta.licenseUrl %>',
|
|
|
|
|
author: '<%= pkgMeta.author %>',
|
2016-01-04 15:02:02 -05:00
|
|
|
authorUrl: '<%= pkgMeta.authorUrl %>'
|
2015-10-08 08:43:08 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'files': {
|
|
|
|
|
'tmp/nuget/package.nuspec': ['config/package.nuspec']
|
|
|
|
|
}
|
2016-01-04 15:02:02 -05:00
|
|
|
},
|
|
|
|
|
'nuspec_binaries': {
|
|
|
|
|
'options': {
|
|
|
|
|
'data': {
|
|
|
|
|
name: '<%= pkgMeta.name %>.Binaries',
|
|
|
|
|
version: '<%= pkgMeta.version %>',
|
|
|
|
|
url: '<%= pkgMeta.url %>',
|
|
|
|
|
license: '<%= pkgMeta.license %>',
|
|
|
|
|
licenseUrl: '<%= pkgMeta.licenseUrl %>',
|
|
|
|
|
author: '<%= pkgMeta.author %>',
|
|
|
|
|
authorUrl: '<%= pkgMeta.authorUrl %>'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'files': {
|
|
|
|
|
'tmp/nuget_binaries/package_binaries.nuspec': ['config/package_binaries.nuspec']
|
|
|
|
|
}
|
2016-01-05 08:35:35 -05:00
|
|
|
},
|
|
|
|
|
'nuspec_courier': {
|
|
|
|
|
'options': {
|
|
|
|
|
'data': {
|
|
|
|
|
name: '<%= pkgMeta.name %>.Courier',
|
|
|
|
|
version: '<%= pkgMeta.version %>',
|
|
|
|
|
url: '<%= pkgMeta.url %>',
|
|
|
|
|
license: '<%= pkgMeta.license %>',
|
|
|
|
|
licenseUrl: '<%= pkgMeta.licenseUrl %>',
|
|
|
|
|
author: '<%= pkgMeta.author %>',
|
|
|
|
|
authorUrl: '<%= pkgMeta.authorUrl %>'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'files': {
|
|
|
|
|
'tmp/nuget_courier/package_courier.nuspec': ['config/package_courier.nuspec']
|
|
|
|
|
}
|
2015-10-08 08:43:08 -04:00
|
|
|
}
|
2014-03-17 19:05:46 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
umbracoPackage: {
|
2015-11-24 21:54:01 -08:00
|
|
|
dist: {
|
|
|
|
|
src: 'tmp/umbraco',
|
|
|
|
|
dest: 'pkg',
|
|
|
|
|
options: {
|
|
|
|
|
name: "<%= pkgMeta.name %>",
|
|
|
|
|
version: '<%= pkgMeta.version %>',
|
|
|
|
|
url: '<%= pkgMeta.url %>',
|
|
|
|
|
license: '<%= pkgMeta.license %>',
|
|
|
|
|
licenseUrl: '<%= pkgMeta.licenseUrl %>',
|
|
|
|
|
author: '<%= pkgMeta.author %>',
|
|
|
|
|
authorUrl: '<%= pkgMeta.authorUrl %>',
|
|
|
|
|
readme: '<%= grunt.file.read("config/readme.txt") %>'
|
|
|
|
|
}
|
2014-03-17 19:05:46 -06:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
clean: {
|
|
|
|
|
build: '<%= grunt.config("basePath").substring(0, 4) == "dist" ? "dist/**/*" : "null" %>',
|
2015-10-08 08:43:08 -04:00
|
|
|
tmp: ['tmp'],
|
|
|
|
|
html: [
|
|
|
|
|
'app/views/*.html',
|
|
|
|
|
'!app/views/archetype.html',
|
|
|
|
|
'!app/views/archetype.default.html',
|
|
|
|
|
'!app/views/archetype.config.html',
|
|
|
|
|
'!app/views/archetype.config.fieldset.dialog.html',
|
|
|
|
|
'!app/views/archetype.config.stylescript.dialog.html',
|
|
|
|
|
'!app/views/archetype.config.developer.dialog.html'
|
|
|
|
|
],
|
|
|
|
|
js: [
|
|
|
|
|
'app/controllers/*.js',
|
|
|
|
|
'!app/controllers/controller.js',
|
|
|
|
|
'!app/controllers/config.controller.js',
|
2017-09-06 12:20:52 -04:00
|
|
|
'!app/controllers/config.dialog.controller.js',
|
|
|
|
|
'!app/controllers/config.global.controller.js'
|
2015-10-08 08:43:08 -04:00
|
|
|
],
|
|
|
|
|
less: [
|
|
|
|
|
'app/less/*.less',
|
|
|
|
|
'!app/less/archetype.less'
|
|
|
|
|
]
|
2014-03-17 19:05:46 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
assemblyinfo: {
|
|
|
|
|
options: {
|
2016-01-23 14:55:11 +01:00
|
|
|
files: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj', 'app/Umbraco/Archetype.Courier/Archetype.Courier.csproj'],
|
2014-03-17 19:05:46 -06:00
|
|
|
filename: 'VersionInfo.cs',
|
|
|
|
|
info: {
|
2015-04-02 23:24:54 -06:00
|
|
|
version: '<%= (pkgMeta.version.indexOf("-") > 0 ? pkgMeta.version.substring(0, pkgMeta.version.indexOf("-")) : pkgMeta.version) %>',
|
2014-03-17 19:05:46 -06:00
|
|
|
fileVersion: '<%= pkgMeta.version %>'
|
|
|
|
|
}
|
2014-03-17 19:04:10 -06:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
touch: {
|
|
|
|
|
webconfig: {
|
|
|
|
|
src: ['<%= grunt.option("target") %>\\Web.config']
|
2014-01-10 17:20:35 -07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2014-01-17 02:54:36 -07:00
|
|
|
msbuild: {
|
2014-03-17 19:05:46 -06:00
|
|
|
options: {
|
|
|
|
|
stdout: true,
|
|
|
|
|
verbosity: 'quiet',
|
|
|
|
|
maxCpuCount: 4,
|
2015-10-08 08:43:08 -04:00
|
|
|
version: 4.0,
|
2014-03-17 19:05:46 -06:00
|
|
|
buildParameters: {
|
|
|
|
|
WarningLevel: 2,
|
|
|
|
|
NoWarn: 1607
|
2014-01-17 02:54:36 -07:00
|
|
|
}
|
2014-03-17 19:05:46 -06:00
|
|
|
},
|
|
|
|
|
dist: {
|
2015-04-29 08:08:08 -04:00
|
|
|
src: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj','app/Umbraco/Archetype.Courier/Archetype.Courier.csproj'],
|
2014-03-17 19:05:46 -06:00
|
|
|
options: {
|
2016-01-13 12:26:19 +00:00
|
|
|
projectConfiguration: 'Release',
|
2014-03-17 19:05:46 -06:00
|
|
|
targets: ['Clean', 'Rebuild'],
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-16 23:30:38 -07:00
|
|
|
}
|
2014-01-10 17:20:35 -07:00
|
|
|
});
|
|
|
|
|
|
2015-10-08 13:42:19 -04:00
|
|
|
grunt.registerTask('default', ['clean', 'string-replace', 'less', 'concat', 'assemblyinfo', 'msbuild:dist', 'copy:dll', 'copy:assets', 'copy:html', 'copy:config', 'clean:html', 'clean:js', 'clean:less']);
|
2016-01-05 08:35:35 -05:00
|
|
|
grunt.registerTask('nuget', ['copy:nuget', 'template:nuspec', 'template:nuspec_binaries', 'template:nuspec_courier', 'nugetpack']);
|
|
|
|
|
grunt.registerTask('umbraco', ['copy:umbraco', 'umbracoPackage']);
|
|
|
|
|
grunt.registerTask('package', ['clean:tmp', 'default', 'nuget', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']);
|
2017-09-13 17:15:11 -04:00
|
|
|
grunt.registerTask('assets', ['clean', 'string-replace', 'less', 'concat', 'assemblyinfo', 'copy:assets', 'copy:html', 'copy:config', 'clean:html', 'clean:js', 'clean:less']);
|
2014-03-17 19:05:46 -06:00
|
|
|
};
|