npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-webresource

v1.3.0

Published

This is designed to be used as a gulp task for working with Dynamics 365 web resources.

Downloads

35

Readme

gulp-webresource for Dynamics 365

This is designed to be used as a gulp task for working with Dynamics 365 web resources.

Currently there is support for upload and publish, this can be used to automate your client development work flow of CRM web resources.

The gulp task takes configuration information that provides mapping from file to CRM web resoure.

For authentication the gulp task can use either user/password or ClientId/Secret via the new Server to Server authentication (https://msdn.microsoft.com/en-us/library/mt790168.aspx). Or you can provide your own access token, it doesn't care how you got it. So you can use https://xrm.tools/Accesstoken to get it, or use adal.js to do it from within your gulp flow

When used in combination with watch and a cache task - you can configure the gulpfile to watch for changes in web resources and only upload those that have changed. Look at the gulp file in ./tests for an example

Upload function can now optionally create the web resource if not already in the target. Use Update(config,true) instead of update(config,false) to enable registration of any newly configured web resources. If you are using this option you need to include DisplayName and Type

All feedback is welcome!

####To use install via npm

npm install gulp-webresource --save-dev

####Step By Step

  1. Create a new folder for your project

  2. Install gulp, gulp-cached and gulp-webresource

npm install gulp --save-dev
npm install gulp-cached --save-dev
npm install gulp-webresource --save-dev
  1. Create a gulfile.js with the following contents
var webresource = require('gulp-webresource')
var gulp = require('gulp')
var cache = require('gulp-cached');

var config = {
    Server:process.env.crmserver,
    User:process.env.crmuser,
    Password:process.env.crmpassword,
    AccessToken:null,
    WebResources:[
     { Path:'TestWebResource\\TestWebResource1.js',UniqueName:'ctc_TestWebResource1.js' },
     { Path:'TestWebResource\\TestWebResource2.js',UniqueName:'ctc_TestWebResource2.js' },
    ]
}

gulp.task('cachecurrent', function(){
    gulp.src('./**/*.js')
    .pipe(cache('uploadwr'))
});

gulp.task('upload', function(){
    gulp.src('./**/*.js')
    .pipe(cache('uploadwr'))
    .pipe(webresource.Upload(config));
});

gulp.task('watch', function() {
    gulp.watch('./**/*.js', ['upload']);
});

gulp.task('default', ['cachecurrent','watch']);
  1. Customize gulpfile.js WebResources list to include your web resources

  2. Set environment variables for crmserver,crmuser,crmpassword

set crmserver=https://orgname.crm.dynamics.com
set crmuser=useremail
set crmpassword=userpwd
  1. Administrator must consent to allowing the task to talk to CRM - navigate to the following link, this will prompt for administrator login and then will ask it to agree to allow gulp-webresource to talk to your CRM
 http://bit.ly/1Vpj6O2
  1. Run gulp, and then go change a file and watch it upload it

Example of config if you are using Server to Server authentication

var config = {
    Server:process.env.crmserver,
    Tenant:'<name>.onmicrosoft.com',
    ClientID:'<clientid>',
    ClientSecret:'<clientsecret>',
    AccessToken:null,
    WebResources:[
     { Path:'calc\\calc.js',UniqueName:'dave_calc.js', DisplayName:'Calc.js file', Type:'JavaScript' }
    ]
}

Permissions if you are using Server to Server authenticationread, write entity

In order to Update -read,write web resource In order to Publish

  • read, write field
  • read, write relationship
  • read, write customizations
  • read ,write view
  • publish