New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@scalar/build-tooling

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scalar/build-tooling

Build tooling and helpers

  • 0.1.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
730
increased by92.61%
Maintainers
0
Weekly downloads
 
Created
Source

@scalar/build-tooling

Helpers for package management within the @scalar monorepo

By default all dependencies are externalized and we don't bundle anything for internal modules.

For deployed web apps alternative build methods should be used to provide a client bundle.

In all cases package.json files should have:

"scripts": {
  "build": "scalar-build-rollup",
  "types:check": "scalar-types-check",
  "types:build": "scalar-types-build",
  "format": "scalar-format-js",
  "lint:check": "eslint .",
  "lint:fix": "eslint . --fix",
}

For Vue/Vite we need a different build command that leverages vite and vue-tsc:

"scripts": {
  "build": "scalar-build-vite",
  "types:check": "scalar-types-check-vue",
  "types:build": "scalar-types-build-vue",
  "format": "scalar-format-js",
  "lint:check": "eslint .",
  "lint:fix": "eslint . --fix",
}

Rollup

For non Vue projects we use Rollup for builds. Generally speaking rollup has better management of treeshaking.

Our rollup config support json, yaml, and css import by default. Static files can be copied over by supplying entries to the copy parameter

A basic rollup.config.ts file looks like:

import type { RollupOptions } from 'rollup'

import { createRollupConfig } from './src/rollup-options'

const options: RollupOptions = {
  input: ['./src/index.ts'],
  // OR for nested exports with ts support
  // input: await findEntryPoints({ allowCss: true }),
  ...createRollupConfig({
    // Needed to enable explicit typescript (which Vite does not need)
    typescript: true,
  }),
}

export default options

Vite

For Vue projects we use Vite to build production code. All the same rollup options can be passed through.

A basic Vite implementation might look like:

import {
  alias,
  createViteBuildOptions,
  findEntryPoints,
} from '@scalar/build-tooling'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vitest/config'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    // Provides @ -> './src' and @test -> './test' aliases
    alias: alias(),
  },
  server: {
    port: 5000,
  },
  build: createViteBuildOptions({
    entry: await findEntryPoints({ allowCss: true }),
  }),
})

FAQs

Package last updated on 10 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc