crownpeakgruntupload

0.1.12 • Public • Published

CrownpeakGruntUpload

Upload files to the Crownpeak CMS through grunt plugin

Getting Started

This plugin requires Grunt

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install crownpeakgruntupload --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('crownpeakgruntupload');

The "CrownpeakGruntUpload" task

Overview

In your project's Gruntfile, add a section named crownpeakgruntupload to the data object passed into grunt.initConfig().

grunt.initConfig({
  crownpeakgruntupload: {
   {
     default_options: {
       options: {
        "username":Your Username,
        "password":Your Password,
        "apikey": Your API Key,
        "host": The url of the cms, usually cms.crownpeak.net,
        "instance":The name of your instance,
        "srcFolder":The location of your site in your local machine,
        "cmsFolder":The location you want this site to be uploaded on the cms ,
        "model":A model containing the desired workflow, overrides the workflow setting,
        "workflow":The workflow id if you did not set a model,
        "siteUrls":[List of site urls that will be replaced.],
        "allowDelete":Delete files that are in the cms, but not locally, default to false,
        "skipUpload":[list of files to skip when uploading. Can be local path or cms path],
        "skipDelete":[list of files to skip when deleting. Can be local path or cms path],
        "branch":If true, assets will be branched and the new data put there, otherwise it will replace the current, defaults to false,
        "route":Can either be the state id you wish it to go to or set to "model" for the models state to be used,
        "verbose":true if you want additional logging
       }
     }
  }
  },
});

Usage Examples

grunt.initConfig({
  crownpeakgruntupload: {
      default_options: {
          options:{
          username:"testuser",
          password:"hello",
          apikey: "279f53423a0456883c5",
          host: "cms2.crownpeak.net",
          instance:"Sandbox5",
          srcFolder:"D:\\Documents\\Example Websites\\space-science\\space-science\\upload",
          cmsFolder:"/test/",
          model:18445,
          workflow:11,
          siteUrls:["www.test.com"],
          allowDelete:false,
          skipUpload:["D:\\Documents\\Example Websites\\space-science\\space-science\\upload\\test.aspx","test.aspx","/test/test"],
          skipDelete:["D:\\Documents\\Example Websites\\space-science\\space-science\\upload\\test.aspx","test.aspx","/test/test"],
          branch:true,
          route:785,
          verbose:false
        }
      }
    },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

4/16/19 v0.1.2 Fixed bug for local folders 4/16/19 v0.1.3 Added deletion of assets on the server that are not available locally 4/17/19 v0.1.4 - Added support for ..,./,and file name in path Fixed bug where uploaded js and css files did not output the path to js/css on rendering Added support for exlusion from upload and deletion Added support for routing assets Upload creates branches and updates those instead of parent 4/19/19 Added Workflow to API Added Missing Commands to API 4/23/19 v0.1.7 Fixed issues with /./. files Fixed issue with changing url of files with no path 4/23/19 v0.1.9 Fixed issue with adding additional / when dealing with ../ 4/24/19 v0.1.10 Fixed issue with query becoming null 4/24/19 v0.1.11 Changed code so that uploaded files now have backup links in case the file is not uploaded Fixed bug preventing branch from working 4/25/19 v0.1.11-beta-2 Added @include to list of urls that are replaced Fixed links without base paths to be get their path from the root 4/25/19 v0.1.11-beta-3 Fixed issue linked to pure urls not ending with / not being updated to / 4/25/19 v0.1.11-beta-5 Fixed issue with regex getting src from javascript code Fixed issue with url((data:) 4/26/19 v0.1.12 Added additional code to wrap assets that do not have " or ' with ' if it has a bad link character

Readme

Keywords

Package Sidebar

Install

npm i crownpeakgruntupload

Homepage

y

Weekly Downloads

40

Version

0.1.12

License

none

Unpacked Size

144 kB

Total Files

13

Last publish

Collaborators

  • playercontinue