Socket
Socket
Sign inDemoInstall

amd-conversion-analyser

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amd-conversion-analyser

This tool helps you analyse the status of your AMD conversion.


Version published
Weekly downloads
42
increased by281.82%
Maintainers
1
Weekly downloads
 
Created
Source

AMD conversion analyser

This tool helps you analyse the status of your AMD conversion.

build-status

Installation

npm install -g bitbucket:atlassian/amd-conversion-analyser

Run

amd /your/source/dir <options>

Options

--globals           // Show information about used globals in code
--globals-summary   // Show total information about used globals in code
--no-utf8           // Don't do pretty print
--no-summary        // Don't show the conversion summary
--no-files          // Don't list the files
--no-ok             // Don't show already converted files
--config <file>     // Use this config file (absolute path only)
--idea              // Show a link to open the file directly in IntelliJ IDEA
--idea-globals      // Show a link to open the file directly in IntelliJ IDEA at the position of the found global
--file-log-level    // Set log level for amd conversion status (debug, info, warn, error); default: info

Example output

./my-plugin/src/main/resources/content/js
    ⚠ Application.js: Globals detected
            49:20 jQuery 
            50:17 _.extend
            230:87 _.extend
    ✗ Trigger.js: Not an AMD module 
./my-plugin/src/main/resources/content/js/base
    ✓ DarkFeatures.js
    ✓ IssueLoaderService.js
    ✗ init.js: Not an AMD module 
    ✓ LinksCapturer.js
    ✓ MetadataService.js        
    ⚠ ModelUtils.js: Globals detected
            137:16 $ 
            140:16 _.extend
            143:16 _.clone
=====================================
Files identified as AMD modules: 6
Files not converted: 2
Illegal globals found: 6
75% converted

Configuration file

The configuration file is a JS file that helps you exclude files, folders and variables and set various other configuration options.

If not set using --config <file>, the default config.js is used.

Example configuration

This is the actual content from the default config.js file.

module.exports = {
    "patterns": ["**/*.js"],
    "exclude": {
        "patterns": [
            "**/**-min.js",
            "**/**.min.js",
            "**/target/**",
            "**/dist/**"
        ],
        "variables": []
    },
    "variableDisplaySize": 128,
    "env": {
        "browser": true,
        "amd": true,
        "qunit": true
    }
};

Configuration options

The following properties can be set on the configuration object.

patterns

Type: Array

Default value: ['**/*.js']

An array of strings, glob patterns, that is used to determine which files will be analysed.

exclude.patterns

Type: Array

Default value: []

An array of strings, glob patterns, that is used to determine which files will not be analysed.

exclude.variables

Type: Array

Default value: []

An array of strings that is used to filter global variables that will be excluded.

env

Type: Object

Default value: {}

An object of identifiers from different JavaScript environments. Please see the globals package for a full list.

variableDisplaySize

Type: Integer

Default value: 128

An integer that is used to set the maximum variable length of a found global.

Development

git clone git@bitbucket.org:atlassian/amd-conversion-analyser.git

cd amd-conversion-analyser

npm install
npm run compile

./bin/amd.js /your/source/dir <options>

Tips

Open the IDEA link to a file by pressing CMD + double click.

FAQs

Package last updated on 28 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc