@connectiv-ms/webresource-uploader
v1.3.6
Published
Upload Webresources based on connection.config files
Downloads
19
Keywords
Readme
Webresource Uploader
Usage
The JavaScriptUploader compares the content of a folder with the webresources in the CRM, updates webresources that are outdated and can optionally create webresources that are missing in the CRM. The tool supports the following extensions:
- .html, .htm
- .js
- .css
- .svg, .gif, .jpg, .png, .ico
- .xml
- .xap, .xsl, .xslt
- .resx
The connection to the CRM is established via a connections.config
file.
If webresources need to be created, the tool will also put them into the proper
solution. If there are patches for the specified solution, the latest patch
is targeted instead.
Executing
How to call it depends on your way of installation. All options in the table
below can be appended. You can also execute the tool with the --help
option to
show the available options.
Executing via NPX
npx @connectiv-ms/webresource-uploader
downloads and executes the tool in your
current working directory.
Executing after Global NPM Install
After installing the package with the -g
flag (See Installation), you can
run the tool via the upload-webresources
command in the terminal.
Running the executable directly
You can also run the executable directly if you know where to find it. This is
only recommended for pure JS projects via the uploadScripts.bat
and debugging.
The executable takes your current directory
Arguments
The tool does not necessarily need arguments to run, but if you need to override the default behavior, you can do so by supplying the arguments in the order as described below. Arguments are passed directly without any dashes or option indicators.
Example
upload-webresources TypeScripts/bin --option optionValue
| Argument | Position | Required | Description | Default |
| - | - | - | - | - |
| <ScriptsDirectory>
| 1 | Optional | Path to folder where the built script files are located. | <reporoot>/Scripts/bin/Debug/Debug
|
Options
The tool does not necessarily need options to run, but if you need to override
the default behavior, you can do so by supplying the options described in the
table below. Some options offer a shorthand alternative, which can be used via
-x <value>
. The full option name can be supplied with double dashes --fullName <value>
.
For boolean options, also called flags, the value can be omitted.
Example
upload-webresources --performance --create -p Development
|Option|Shorthand|Description|Default|
|-|-|-|-|
|connection|c|Absolute or relative path to a connection.config file. Relative paths are resolved according to the git repository root folder.|If this option is not provided, the tool will look for a connections.config file in the following locations: <reporoot>/connections.config
<reporoot>/.buildconfig/connections/connection.config.<branchname>
where <branchname>
is the currently active git branch and <reporoot>
is the root folder of the current git repository.|
|profile|p|The name of the profile in the connection config file that should be used.|First profile found in connections.config file
|create|-|This flag controls if webresources that cannot be found in the CRM will be created automatically.|false
|solution|-|Enter the unique solution name that webresources should be added to. If there is a patch for the target solution, the webresource will be added to this patch instead. Required if --create
flag is passed and no SolutionName tag has been added to the connections.config file.|The solution that is specified in the connections.config file.|
|watch|w|Watch the scripts folder for changes and deploy automatically.|false
|
|performance|-|Print performance measurements for each pipeline step after execution.|false
|
Pipeline Configuration
In case you want to change the way the uploader behaves, you can change change out pipeline phases, by using these options.
|Option|Shorthand|Description|Available|Default|
|-|-|-|-|-|
|localloader|-|Changes the way your local files are discovered and read.|default
: Loads all available files with any of the supported extensions from the specified folder.debug
| debugging
: Loads all available files with any of the supported extensions up to a certain number (specified in code) from the specified folder, but swaps the content with random bytes to force updates. Will also creates a certain number (specified in code) of new random files in memory that need to be created as Webresources in the CRM. Useful for performance measurements.|default
|
|uploader|-|Changes the way webresources are uploaded.|default
| iterative
: Updates webresources and creates new webresources one by one.parallel
: Experimental! Updates webresources and creates new webresources using as many parallel connections, as the CRM and your PC can handle.|default
| iterative
|
|publisher|-|Changes the way webresources are uploaded.|default
| bulk
: Publishes webresources all at once. (Not via PublishAll, but a constructed PublishXML Request)iterative
: The legacy way. Publish webresources one after the other.|default
| bulk
|
Installation
Install either via npm i -D @connectiv-ms/webresource-uploader
as a
Dev-Dependency in your project, or install it globally via npm i -g
@connectiv-ms/webresource-uploader
. Alternatively, this can also be executed
via npx @connectiv-ms/webresource-uploader
, which installs the package and
executes it immediately but will not add it to the Dev-Dependencies.
If you cannot use the npm
commands, you can also copy the output of the C#
project to your project folder and run the executable from there.
Contribution
- If you want to add features to this tool, please use the GitFlow workflow.
- For now, publishing a new version is a manual task. Adjust the versions of the following files: (Make sure that the versions match up!)
JavaScriptUploader.Cli/package.json
JavaScriptUploader/Properties/AssemblyInfo.cs
- Add your changes to the Changelog.
- Make sure behavioral changes are incorporated in the README.
- Make sure new options and arguments are described properly in the README.
- Create a new release branch when you are happy with all the new shiny features.
- Clean
JavaScriptUploader.Cli/bin
before you publish, and run a fresh build in RELEASE configuration. - Run the
copy-markdown
NPM script inJavaScriptUploader.Cli
and make sure that the newest changelog and readme files are in this folder. - Run
npm publish
. (You will need to runnpm adduser
first and be a member of@connectiv-ms
on npmjs.)