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

amd-conversion-analyser

v1.8.0

Published

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

Downloads

18

Readme

AMD conversion analyser

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

build-status

Installation

npm install -g 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
--save <file>       // Save results to file
--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 [email protected]: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.