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

@websublime/vtx-cli

v0.0.18

Published

Vtx is an wrapper on vite cli tool to manage multi apps, libs and custom packages on monorepo style focus only with typescript support.

Downloads

95

Readme

VTX Workspace manager for vite

Vtx is an wrapper on vite cli tool to manage multi apps, libs and custom packages on monorepo style focus only with typescript support.

Dependencies

  • Node > 12
  • yarn

Install

Start to install cli as a globals package on your system. Monorepo is managed by yarn so it is mandatory using yarn as your dependency manager. Install as:

yarn global add @websublime/vtx-cli

After this you will have binary vtx available as your cli tool.

Setup

Vtx cli tool can create, serve and build apps or libs. Run vtx --help for more info on the cli tool.

Usage:
  $ vtx [root]

Commands:
  [root]
  create-workspace
  create-app
  create-lib

For more info, run any command with the `--help` flag:
  $ vtx --help
  $ vtx create-workspace --help
  $ vtx create-app --help
  $ vtx create-lib --help

Options:
  --host [host]           [string] specify hostname
  --port <port>           [number] specify port
  --https                 [boolean] use TLS + HTTP/2
  --open [path]           [boolean | string] open browser on startup
  --cors                  [boolean] enable CORS
  --strictPort            [boolean] exit if specified port is already in use
  --force                 [boolean] force the optimizer to ignore the cache and re-bundle
  -b, --lib <lib>         [string] use specified lib to build
  -p, --app <app>         [string] use specified app to run
  -c, --config <file>     [string] use specified config file
  --base <path>           [string] public base path (default: /)
  -l, --logLevel <level>  [string] info | warn | error | silent
  --clearScreen           [boolean] allow/disable clear screen when logging
  -d, --debug [feat]      [string | boolean] show debug logs
  -f, --filter <filter>   [string] filter debug logs
  -m, --mode <mode>       [string] set env mode
  -h, --help              Display this message
  -v, --version           Display version number

Workspace

Start to create a workspace for your apps. Just run:

vtx create-workspace

And answer to the questions from the cli to config your workspace. Vite config produced will have a config to resolve every entry from your workspace and also will automatic resolve alias for your apps and libs that are created with this tool.

Vue App

After creating your workspace you are ready to add as many apps as you want. Inside your workspace directory run:

vtx create-app

And answer the questions to perform your app config. Then perform install.

yarn

Lib

Inside your workspace directory run:

vtx create-lib

Run

By default your first app will be the default app to serve. If you want to run a different app just define the name the app you want to run.

vtx dev --app my-app

Or you can adjust your package.json script to run different apps like:

"scripts": {
  "dev": "vtx dev --config ./vite.config.js --debug",
  "dev:ready": "vtx dev --config ./vite.config.js --debug --app ready",
  "build": "vtx build",
  "preview": "vtx preview"
}

Vtx supports all options from vite-cli plus --app and --lib.

Build

To build just run:

vtx build --app todo

For type application will produce dist normally. The particular case goes for lib as:

vtx build --lib services

When your lib as created, is package.json as config entry for rollupOptions where you can pass vite rollupOtions as vite documentation describe. The lib will be created with the name that to you gave it and get necessary options from workspace package.json.

It is mandatory to indicate which type and name you are building.

Config

Vtx saves the configuration on root of your workspace in package.json. You can review it there.

"config": {
  "packages": {
    "todo": {
      "name": "todo",
      "namespace": "@workspace/todo",
      "dir": "/workspace/vtx/temp/my-awesome/apps/todo",
      "type": "application"
    },
    "services": {
      "name": "services",
      "namespace": "@lib/services",
      "dir": "/workspace/vtx/temp/my-awesome/libs/services",
      "type": "lib"
    }
  },
  "default": "todo",
  "namespace": "@workspace",
  "root": "/workspace/vtx/temp/my-awesome"
}

You can then manually perform config on your app to resolve and include a lib. On package.json of your app you can add the lib as dependency:

"dependencies": {
  "@lib/services": "^1.0.0"
}

And on the tsconfig you can resolve typings and imports:

"paths": {
  "@workspace/todo/*": [
    "./src/*"
  ],
  "@lib/services": [
    "../../libs/services/src/index.ts"
  ]
}

yarn workspace will resolve your dependency and perform the necessary link to it.

TODO

More info about the tool

Publish

  • Run yarn changeset on branch
  • Request PR