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

ucpem

v2.9.0

Published

UCPeM is used to import packages into projects. A package is defined in using a port which is a special type of package, that exports resources. In a project these resources can be imported into resource links, which are folder junctions to the cloned rep

Downloads

61

Readme

UCPeM Testing

UCPeM is used to import packages into projects. A package is defined in using a port which is a special type of package, that exports resources. In a project these resources can be imported into resource links, which are folder junctions to the cloned repositories of ports.

Config

To create a project run:

ucpem init

If you have a .gitignore file, it will be updated.

A project contains an ucpem.js file, defining resources and their dependencies.

Port is a repository path (for git clone). Resource names should be [a-zA-Z0-9_]+ and cannot contain whitespace.

Port must be a git clone URL. All cloned repos will be placed into a ucpem_ports folder in the root of the project. Don't worry about source control, a .gitignore file will be generated automatically.

To define a resource write:

const { project } = require("ucpem")

project.res("resource")

To define a port and dependency write:

const { project, git, github } = require("ucpem")

const port = git("https://github.com/bt7s7k7/UCPeM")
// OR
const port = github("bt7s7k7/UCPeM")

project.res("resource",
    port.res("dependency")
)

Resources can have a preparation script. It's run when the port is cloned, updated or manually using ucpem prepare.

const { project, prepare } = require("ucpem")

project.res("resource",
    prepare(async () => {
        // ...
    })
)

Scripts have access to context information in the constants object.

const { project, prepare, constants } = require("ucpem")

project.res("resource",
    prepare(async () => {
        /** Path of the resource the callback is executed for */
        constants.resourcePath
        /** Path to this project */
        constants.projectPath
        /** Path to the install path, eq. to project path if not port */
        constants.installPath
        /** Is this project being installed as a port */
        constants.isPort
        /** Name of this project */
        constants.projectName
        /** Name of the project this port is being installed into */
        constants.installName
    })
)

There are utility function you can use in prepare scripts:

const { project, prepare, link, join, run } = require("ucpem")

project.res("resource",
    prepare(async () => {
        /** Creates a symlink / junction, relative to resource */
        link(link: string, target: string): void
        /** Joins paths together */
        join(...paths: string[]): string
        /** Runs a command, cwd is resource path */
        run(command: string): Promise<void>
    })
)

If your resources files are offset from the config folder (i.e. in a src folder) you can prefix the project path:

const { project, prepare } = require("ucpem")

const srcFolder = project.prefix("./src")

srcFolder.res("resource")

You can also specify a unique path for a resource:

const { project, path } = require("ucpem")

project.res("resourceName",
    path("./path/to/resource/resourceName")
)

Sometimes you just want to import a resource to use during development, like testing util scripts:

const { project, git } = require("ucpem")

const port = git("../port")

project.prefix("test").use(port.res("testUtil"))

Local linking

During project development it is often beneficial to develop a dependency along with a project. To synchronize an imported port with it's source you can use local linking.

To publish a port for local linking run:

ucpem sync

This will create a symlink in a global ucpem folder, from which the port can be linked into a project:

ucpem sync with <port name>

You can use all as port name to made all installed ports synced if their ports are published for local linking.

The global folder is ~/.ucpem by default but it can be modified with the UCPEM_LOCAL_PORTS environmental variable.

By default during ucpem install, local ports are used before cloning a remote copy, to install remote ports only run ucpem install remote.

Local linking requires node version ^12.10.0

Installation

  1. Install globally
git clone https://github.com/bt7s7k7/UCPeM.git
npm install
npm run build
npm link
  1. Run once
curl -L https://github.com/bt7s7k7/UCPeM/releases/latest/download/ucpem.js | node - <arguments>

Usage

Usage:
  ucpem <operation>

Commands:
  info           - Displays information about the current project
  install        - Installs all missing ports
  install remote - Install all missing ports without using local ports
  prepare        - Runs prepare scripts for all resources
  update         - Updates all installed ports
  link           - Links dependencies to resources
  init           - Creates a ucpem project
  sync           - Publishes this project for local linking
  unsync         - Removes this project from local linking
  sync with      - Syncs with a port that was published for local linking :: Arguments: <name>
  unsync with    - Removes a local linked port that was synced with :: Arguments: <name>
  run            - Runs a run script :: Arguments: <name> (...)

Run ucpem without arguments to view help.