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

nuxt-workspace

v0.0.3

Published

A Nuxt module integrating workspace paths into Nuxt config of monorepo

Downloads

4

Readme

Nuxt Workspace

npm version npm downloads License Nuxt

A Nuxt module integrating workspace paths into Nuxt config of monorepo

[!NOTE] This project is in beta. Use under your own risk, but feel free to test, make pull request and improve this project.

Features

  • Seamless integration of #workspace in any path of the Nuxt config
  • Customizable placeholder option to suit your needs
  • Ability to selectively exclude specific configurations from being replaced

Why

Nuxt originally provides a typescript.includeWorkspace config, but it only includes all workspace files. This can cause interference between different packages in a monorepo, preventing the completion of typecheck.

After using this nuxt-workspace module, you can use #workspace/*.d.ts in the typescript.tsConfig.include configuration to customize the workspace pattern you want to include and also you can also use it in all other Nuxt configuration areas.

Setup

# Using pnpm
pnpm add -D nuxt-workspace

# Using yarn
yarn add --dev nuxt-workspace

# Using npm
npm install --save-dev nuxt-workspace

Usage

After adding nuxt-workspace to your nuxt config modules, you can use #workspace as path in your nuxt.config.ts. It will auto replace the placeholder with the workspaceDir.

export default defineNuxtConfig({
  modules: [
    'nuxt-workspace'
  ],
  typescript: {
    tsConfig: {
      include: [
        '#workspace/*.d.ts'
      ],
    },
  },
  components: [
    { path: '#workspace/packages/foo/components' }
  ]
})

Configuration

You can configure Nuxt Workspace with the workspace property in your nuxt.config file.

placeholder

  • Type: string
  • Default: #workspace

Allows you to customize the placeholder used for workspace path substitution.

export default defineNuxtConfig({
  workspace: {
    placeholder: '@my-workspace'
  },
  // Now you can use to `@my-workspace` in your config
  typescript: {
    tsConfig: {
      include: [
        '@my-workspace/*.d.ts'
      ]
    }
  }
})

ignoreObjectPaths

  • Type: string[]
  • Default: []

Allows you to selectively exclude specific configurations from being replaced.

export default defineNuxtConfig({
  workspace: {
    ignoreObjectPaths: [
      'app.head.title'
    ]
  },
  app: {
    head: {
      title: '#workspace' // this config will not been replaced
    }
  }
})

Ignore object paths with Object or Array

export default defineNuxtConfig({
  workspace: {
    ignoreObjectPaths: [
      'foo.someArray[1]',
      'foo.someObject',
    ]
  },
  foo: {
    someArray: [
      '#workspace/foo',
      '#workspace/bar', // ignore replacement
    ],

    // ignore replacement for all configs in this object
    someObject: {
      'foo': '#workspace',
      'bar': '#workspace',
    }
  },
})

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release