npm

Need private packages and team management tools?Check out npm Orgs. »

@drugscom/ddcjsmodules

5.6.11 • Public • Published

DDC JS Modules

Shared Javascript modules as an npm package.

Release New Update

Note: The production staging process depends on the creation of a new project Tag to get the latest version of the ddcjsmodules project.

To create a new tag, first ensure all changes are committed (and tested), then use the command npm version specifying a version of patch or minor or major (the choice being dependent on the nature of the changes involved). Then push the change to GitHub, being sure to include tags with your push.

git status
npm version [patch|minor|major]
git push --tags origin master
npm publish

On the next npm update from within other projects, the latest version "compatible" of @drugscom/ddcjsmodules will be pulled.

See http://semver.npmjs.com/ and package.json entry for which versions are compatible.

Project Include

To install this module in your project:

npm install --save-dev @drugscom/ddcjsmodules

Note: For a specific version, append the tag/version number to the path (e.g. @drugscom/ddcjsmodules@1.0.1).

Add (or update) the browser section of your project's package.json file:

"browser": {
   "ddc-agent": "./node_modules/@drugscom/ddcjsmodules/src/agent",
   "ddc-analytics": "./node_modules/@drugscom/ddcjsmodules/src/analytics",
   "ddc-config": "./node_modules/@drugscom/ddcjsmodules/src/config",
   "ddc-debug": "./node_modules/@drugscom/ddcjsmodules/src/debug",
   "ddc-error": "./node_modules/@drugscom/ddcjsmodules/src/error",
   "ddc-helper": "./node_modules/@drugscom/ddcjsmodules/src/helper",
   "ddc-timing": "./node_modules/@drugscom/ddcjsmodules/src/timing",
   //etc.
}

These modules can then be required in a browserify bundle process:

var Debug = require('ddc-debug');

Link Dev Version

To reference a "live" version of the ddcjsmodules package, define an npm link to the working directory.

  1. Setup a node modules link for the live version (only need to do this once per node environment):
cd /home/
git clone git@github.com:drugscom/ddcjsmodules.git
cd ddcjsmodules/
npm install
npm link
  1. Set your project to use the linked version rather than an installed package:
cd /home/ddcwww/
npm link @drugscom/ddcjsmodules

Any changes made in /home/ddcjsmodules/ will be immediately reflected in /home/ddcwww/node_modules/@drugscom/ddcjsmodules/.

Repeat this process for any other projects (sub folders) that require a "live" version of ddcjsmodules:

cd /home/ddcwww/public_html/mednotes/
npm link @drugscom/ddcjsmodules
cd /home/ddcwww/public_html/compare/
npm link @drugscom/ddcjsmodules

To switch back to an installed package: npm install @drugscom/ddcjsmodules or npm update @drugscom/ddcjsmodules Note: if you run npm run deploy or npm run ddcjsmodules it will automatically switch back.

Link Dev Version - Option 2

If the server files are a simple copy of your development code (i.e. not a github repository), then an npm link can be setup as follows:

cd /home/ddcwww/public_html/node_modules/@drugscom/ddcjsmodules/
rm -rf *
npm link /home/ddcjsmodules/

Debugging

Return the current debug configuration (JSON string):

> DDC.Debug.get();

Set the current debug configuration (overrides any existing configuration):

> DDC.Debug.set({options});

Configuration

The {options} parameter should follow this structure:

{
   show: ['DDC.Class.method', 'DDC.Class2.method2', ...], // Array of strings;
   mark: ['DDC.Class.method', ...]  // Array of strings;
}

Console logging the Debug.trace data will uses the logic:

  1. if the trace method name starts with a value in the [mark] array, log to console (important color)
  2. if the trace method name starts with a value in the [show] array, log to console (standard color)
  3. else, do not log

Examples

Show all debugging:

> DDC.Debug.set({show: ['']})

Show debugging for methods starting with "Mednotes.Page":

> DDC.Debug.set({show: ['Mednotes.Page']})

Show debugging for methods starting with "DDC.Ads" and "DDC.Page"; highlight methods starting with "DDC.Ads.buildAd":

> DDC.Debug.set({show: ['DDC.Ads', 'DDC.Page'], mark: ['DDC.Ads.buildAd']})

Stop all debugging:

> DDC.Debug.set({show: [], mark: []})

Keywords

none

install

npm i @drugscom/ddcjsmodules

Downloadsweekly downloads

49

version

5.6.11

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability