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

scope-tags

v0.3.8

Published

Output human readable test scope report for QA

Downloads

4

Readme

npm version Auto test and deploy

Currently in internal beta tests

Scope Tags

Command line tool for doing change impact analysis in large TypeScript projects.

  • Supports integration with JIRA using a local server (1 POST endpoint required).
  • Generates detailed HTML logs with every commit details
  • Commits can be verified (eg. by a git hook) to prevent those without saved metadata
  • Can be configured by the user

Architecture diagram

Alt text

How to install

From the repository you want to test the package run

npm i scope-tags -D

Make sure your Git configuration has case-sensitivity enabled

git config --global core.ignorecase false

How to run

From the repository you want to test the package run

npx scope

You can list available commands using

npx scope --help

Configuration

Scope tags support some option configurable by the user. This enables you to modify the script behaviour and set some global data which is used by the report generator. Available options are:

  • projects: Object[] - Array with project details in following format:

| Parameter name | Type | Description | |-----------------------|----------|-------------------------------------------------------------------------------------------------- | | name | string | Name of the project | | location | string | Path to the project tsconfig.json file | | useExternalImportMap? | string | Path to import map file which can be used to find references to other types than .ts or .tsx - see Externral Import Map below | | supportedFiles? | string[] | Array of files supported by the external import map |

  • gitCommitCountLimit: number - It is the maximum number of commits to search for when doing rev walk on git push hook - used just on the user side while running commands --verify-unpushed-commits or --skip. It this number is reached you'll get a warning and ignoring it may result in some files being ommited from tag verification.

  • updateIssueURL?: string - URL used for the POST endpoint with generated report for JIRA issues

  • ignoredExtensions: string[] - List of file extensions ignored by the script

  • viewIssueURL?: string - URL used to link from generated HTML logs to Jira issues

  • logsURL?: string - Location of the generated HTML logs while running --report-for-commit-list. Used to link to logs directly from generated reports - makes it easier to see all changes which were made to that build. It is optional, if not present the link won't be added to reports. The URL should contain build tag ("buildTag" specified in build metadata file) somewhere.

  • Option --report-for-commit-list buildData.json ./logs.html is used to do a bunch of stuff - generate reports, logs, and update Jira issues. It requires additional metadata file buildData.json in the following format:

{
    "buildTag": "build-123",
    "commitsAndIssues": [
        {
            "hash": "commit hash in long format",
            "issue": "JIRA-KEY"
        },
        {
            "hash": "commit hash in long format",
            "issue": "JIRA-KEY"
        }
        ...
    ]
}

./logs.html is the destination path of generated HTML logs.

Eternal import map

  • Option projects.externalImportMap requires additional metadata in this format:
[
    {
        "file": "/path/to/file",
        "imports": [
            "path/to/imported/file"
        ]
    }
]

To use multiple files use a file name with {x} specifying current import map chunk.

Local development

  1. Clone this repository using git clone --recurse-submodules https://github.com/matiduda/scope-tags
  2. Make sure you're using the correct verion of Node - v12.16.1 (npm v6.13.4)
  3. Run npm install (preffered Node/NPM version: v12.16.3 / 6.14.4)
  4. Run npm link
  5. Use the local version of the script using scope (without the npx prefix) (if it doesn't work - restart the terminal)
  6. npx scope runs version installed in the current repository (as a dependency), scope runs locally builded version

To run test suite use npm run test

Publishing

For unit testing there is a separate mock repository, which should be keeped up-to-date

Publishing is made automatically by pushing a commit to the main branch, see github action

The mock repo can be updated automatically by running ./pushTestRepo.sh

Features to do in order of importance

  • [ ] Find a way to clone test repository locally - this will make unit testing much quicker
  • [ ] Unit tests for:
    • [ ] The basic actions which can be performed on files - adding, deleting, modifying, renaming. After initial database entry the script should automatically handle all cases.
    • [ ] Testing if files are correstly updated in database depending on changes in git
    • [ ] On loading tags.json assert that all parents exist in database, if not then these modules won't be displayed
  • [ ] Add unit tests for even the basic stuff - reading and parsing JSON files, synchronization between the database and repository, etc.
  • [ ] Add unit tests for the basic actions which can be performed on files - adding, deleting, modifying, renaming. After initial database entry the script should automatically handle all cases.
  • [ ] Add adf-validator which would give more specific errors (right now comments are just not being posted)
  • [ ] Add remove hanging tags option to tag manager - search for tags not assigned to any module and ask the user if they want to delete them
  • [ ] Add keyboard shortcut hints when selecting tags and files -> https://github.com/enquirer/enquirer#select-choices

Special thanks