- Umbraco version 7.6.3 assembly: 1.0.6361.21154
- NodeJs
- Grunt
1. Install Node.js
2. Install Grunt
> npm install grunt
> npm install grunt-cli
Optional : -g install grunt globally (will modified windows environment parameter )
3. Install 'grunt-umbraco-package'
> npm install grunt-umbraco-package --save-dev
Remarks : if you are not install globally, for install all grunt dependencies, you need to execute the command under the your project folder.
4. Create the folder structure like
{Project Name}
|-- config
| `-- meta.json
|-- files
|-- node_modules
|-- releases
| |-- github
| `-- umbraco
|-- src
| `-- App_Plugins
| `-- {Project Name}
| |-- assets
| |-- css
| |-- js
| |-- langs
| |-- views
| `-- package.manifest
|-- Gruntfile.js
|-- LICENSE
|-- package.xml
|-- package.json
`-- README.md
Gruntfile.js
module.exports = function(grunt) {
// Load the package JSON file
var pkg = grunt.file.readJSON('package.json');
// get the root path of the project
var projectRoot = 'src/App_Plugins/' + pkg.name + '/';
var destRoot = 'files/';
// Load information about the assembly
var assembly = grunt.file.readJSON('config/meta.json');
// Get the version of the package
var version = assembly.informationalVersion ? assembly.informationalVersion : assembly.version;
grunt.initConfig({
pkg: pkg,
clean: {
files: [
destRoot + '**/*.*'
]
},
copy: {
release: {
files: [
{
expand: true,
cwd: projectRoot,
src: ['**/*.*'],
dest: destRoot
}
]
}
},
zip: {
release: {
cwd: destRoot,
src: [
destRoot + '**/*.*'
],
dest: 'releases/github/' + pkg.name + '.v' + version + '.zip'
}
},
umbracoPackage: {
dist: {
src: destRoot,
dest: 'releases/umbraco',
options: {
name: pkg.name,
version: version,
url: pkg.url,
license: pkg.license.name,
licenseUrl: pkg.license.url,
author: pkg.author.name,
authorUrl: pkg.author.url,
readme: pkg.readme,
outputName: pkg.name + '.v' + version + '.zip',
manifest: 'package.xml'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-nuget');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-umbraco-package');
grunt.registerTask('dev', ['clean', 'copy', 'umbracoPackage']);
grunt.registerTask('default', ['dev']);
};
Package.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<umbPackage>
<files>
<file>
<guid>package.manifest</guid>
<orgPath>/App_Plugins/Pairs</orgPath>
<orgName>package.manifest</orgName>
</file>
<file>
<guid>CmsUser.png</guid>
<orgPath>/App_Plugins/Pairs/assets</orgPath>
<orgName>CmsUser.png</orgName>
</file>
<file>
<guid>cs_code.png</guid>
<orgPath>/App_Plugins/Pairs/assets</orgPath>
<orgName>cs_code.png</orgName>
</file>
<file>
<guid>logo.png</guid>
<orgPath>/App_Plugins/Pairs/assets</orgPath>
<orgName>logo.png</orgName>
</file>
<file>
<guid>propertyeditor.png</guid>
<orgPath>/App_Plugins/Pairs/assets</orgPath>
<orgName>propertyeditor.png</orgName>
</file>
<file>
<guid>pairs.css</guid>
<orgPath>/App_Plugins/Pairs/css</orgPath>
<orgName>pairs.css</orgName>
</file>
<file>
<guid>pairs.controller.js</guid>
<orgPath>/App_Plugins/Pairs/js</orgPath>
<orgName>pairs.controller.js</orgName>
</file>
<file>
<guid>pairs.prevalue.controller.js</guid>
<orgPath>/App_Plugins/Pairs/js</orgPath>
<orgName>pairs.prevalue.controller.js</orgName>
</file>
<file>
<guid>pairs.html</guid>
<orgPath>/App_Plugins/Pairs/views</orgPath>
<orgName>pairs.html</orgName>
</file>
<file>
<guid>pairs.prevalue.html</guid>
<orgPath>/App_Plugins/Pairs/views</orgPath>
<orgName>pairs.prevalue.html</orgName>
</file>
</files>
<info>
<package>
<name>Pairs</name>
<version>0.1.0</version>
<iconUrl />
<license url="http://opensource.org/licenses/MIT">MIT License</license>
<url>https://github.com/samsam321/umbraco-Pairs</url>
<requirements type="strict">
<major>7</major>
<minor>6</minor>
<patch>3</patch>
</requirements>
</package>
<author>
<name>SamAY</name>
<website>https://www.linkedin.com/in/threewood/</website>
</author>
<readme><![CDATA[
<p>Thank you for installing Threewood Umbraco Pairs - the tool that makes you can create simple key value pairs property editor.</p>
]]></readme>
</info>
<DocumentTypes />
<Templates />
<Stylesheets />
<Macros />
<DictionaryItems />
<Languages />
<DataTypes />
</umbPackage>
Package.json
{
"name": "Pairs",
"url": "https://github.com/samsam321/umbraco-Pairs",
"license": {
"name": "MIT",
"url": "https://github.com/samsam321/umbraco-Pairs/blob/master/LICENSE"
},
"repository": {
"type": "git",
"url": "git+https://github.com/samsam321/umbraco-Pairs.git"
},
"author": {
"name": "SamAY",
"url": "https://www.linkedin.com/in/threewood/"
},
"readme": "Threewood.Umbraco.Pairs is a small package with key value pair property editor.",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^0.4.1",
"grunt-nuget": "^0.1.7",
"grunt-umbraco-package": "1.0.0",
"grunt-zip": "^0.17.1"
}
}
P.S create or copy from the package file ( created manually via Umbraco backoffice )
meta.json
{
"title": "Threewood.Umbraco.Pairs",
"description": "Threewood.Umbraco.Pairs is a small package with key value pair property editor.",
"company": "",
"product": "Threewood.Umbraco.Pairs",
"copyright": "Copyright © 2017",
"version": "0.1.0",
"informationalVersion": "0.1.0",
"fileVersion": "0.1.0"
}
5. Open Command Prompt and goto the folder same level as Gruntfile.js
6. $>grunt
7.

沒有留言:
張貼留言