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

pixel-pulse-v2

v0.0.7

Published

This package is the Vue 2 version of your library. It can

Downloads

1

Readme

Vue 2 Compat Build Package

This package is the Vue 2 version of your library. It can

  • test
  • build
  • publish

the code symlinked from /lib-vue3/src as a Vue 2 plugin library.

Things to be aware of.

  • The src folder is just a symlink to /lib-vue3/src. So both packages share the same source.
  • You need to synchronize the dependencies between both packages. if you add a new dependency to /lib-vue3, you likely also want to install it here. pnpm can help doing that in a single command: running i.e. pnpm add lodash-es --filter="example-*" in the project root will add the package lodash-es as a dependencies to both /lib-vue2 and /lib-vue3 packages, as their package names both start with example-*.

Alternative Publishing Strategy

This template is preconfigured to publish the Vue 2 and Vue 3 versions in individual packages. This is generally the recommended approach so you don't have to mix dependencies for Vue 2 and Vue 3 in package.json.

However, you can alternatively decide to publish just one package, including both the Vue 2 and Vue 3 bundles. Just be aware that you might encounter trouble if you need different versions of a dependency for each version.

Here's what you would have to change for that:

/lib-vue2/package.json

  • give a distinct name
  • make it private so it won't be published.
  • Optionally remove module exports & entry points
{
 "name": "some-name-different-from-lib-vue3",
+ "private": "false",
 "type": "module",
- "main": "dist/index.cjs.cjs",
- "module": "dist/index.es.js",
- "typings": "index.vue2.d.ts",
-  "exports": {
-    ".": {
--      "script": "dist/index.iife.js",
-      "import": "dist/index.es.js",
-      "require": "dist/index.cjs.cjs"
-    },
-  },
-  "files": [
-    "dist",
-    "src",
-    "index.vue2.d.ts",
-    "README.md",
-  ]
}

/lib-vue2/vite.config.ts

change build output to ../lib-vue3/dist:

// ...
  build: buildConfig({
-    outDir: "./dist",
+    outDir: "../lib-vue3/dist-vue2",
  }),
//...

Setup src folder

Right now, /lib-vue2 is a symlink to /lib-vue3/src. For types, we need to publish the src folder with out package, not just a symlink. so instead, we need an actual copy of the source folder

  1. Remove symlink - just delete the /lib-vue2/src folder.
  2. install rimraf && cpy-cli
# in /lib-vue2
pnpm add -D cpy-cli
  1. Adjust these scripts in package.json - we don't need the copy script anymore:
"script": {
  "dev": "vite build --watch",
-  "build": "pnpm prepare-src && copy-src",
+  "build": "vite build",
-  "copy-src: "cpy ../lib-vue3/src/* ./dist/src/"
   # ....
}

index.vue2.d.ts

Move /lib-vue2/index.d.ts to /lib-vue3/index.vue2.d.ts and make it export the src directory there.

module exports in /lib-vue3

{
  "main": "dist/index.cjs.cjs",
  "module": "dist/index.es.js",
  "jsdelivr": "dist/index.iife.js",
  "unpkg": "dist/index.iife.js",
  "typings": "./typings/main.d.ts",
  "exports": {
    ".": {
      "types": "./typings/main.d.ts",
      "script": "./dist/index.iife.js",
      "import": "./dist/index.es.js",
      "require": "./dist/index.cjs.cjs",
      "default": "./dist/index.es.js"
    },
    "./vue3": {
      "types": "./typings/main.d.ts",
      "script": "./dist/index.iife.js",
      "import": "./dist/index.es.js",
      "require": "./dist/index.cjs.cjs",
      "default": "./dist/index.es.js"
    },
    "./vue2": {
      "types": "./index.vue2.d.ts",
      "script": "./dist-vue2/index.iife.js",
      "import": "./dist-vue2/index.es.js",
      "require": "./dist-vue2/index.cjs.cjs",
      "default": "./dist-vue2/index.es.js"
    },
    "./style.css": "./dist/style.css",
    "./src/": "./src/",
    "./package.json": "./package.json"
  }
}

That's it!

Now you can run pnpm release and pnpm will test, build and publish both version in one package!