![Introducing Dashboard Analytics](https://cdn.sanity.io/images/cgdhsj6q/production/af327c5bd94708db501516a75da6870aef894c64-2286x1522.png?w=400&fit=max&auto=format)
Product
Introducing Dashboard Analytics
We're introducing a new Analytics feature in the Socket dashboard so you can view changes in your organization's and repositories' alerts over time.
@sanity/pkg-utils
Advanced tools
Simple utilities for modern npm packages.
npm install @sanity/pkg-utils -D
# Initialize a new package
pnpx @sanity/pkg-utils@latest init my-package
# In a Node.js package directory with `package.json` present
# Check the package
pkg-utils check
# Build the package
pkg-utils build
# Watch the package
pkg-utils watch
Run pkg-utils -h
for more information on CLI usage.
@sanity/pkg-utils
reads most of its configuration from package.json
. But sometimes you need more
control. You may then add a configuration file named package.config.ts
(or .js
, .cjs
, or
.mjs
).
// package.config.ts
import {defineConfig} from '@sanity/pkg-utils'
export default defineConfig({
extract: {
rules: {
// do not require internal members to be prefixed with `_`
'ae-internal-missing-underscore': 'off',
},
},
// the path to the tsconfig file for distributed builds
tsconfig: 'tsconfig.dist.json',
})
bundles
PkgBundle[]
undefined
An array of entry points to bundle. This is useful if you want to bundle something that should not be exported by the package, e.g. CLI scripts or Node.js workers.
define
Record<string, string | number | boolean | null | undefined>
{}
An object defining globals within the package.
dist
string
'./dist'
The path to the directory to which bundle and chunk files should be written.
exports
PkgConfigProperty<PkgExports>
"exports"
in package.json
Override or modify the value of the exports
before it’s parsed internally.
extract
{
rules?: {
'ae-forgotten-export'?: PkgRuleLevel
'ae-incompatible-release-tags'?: PkgRuleLevel
'ae-internal-missing-underscore'?: PkgRuleLevel
'ae-missing-release-tag'?: PkgRuleLevel
}
}
undefined
Configure the level of reporting of API Extractor (which is used to bundle the type definitions, as well as lint the TSDoc of the package).
external
string[]
[]
Packages to exclude from bundles.
jsx
'transform' | 'preserve' | 'automatic'
'automatic'
Strategy for bundling JSX.
jsxFactory
string
'createElement'
The name of the function that creates JSX elements.
jsxFragment
string
'Fragment'
The name of JSX fragment elements.
jsxImportSource
string
'react'
The name of the library from which to import JSX factory and fragment names.
legacyExports
boolean
false
Build package with support for legacy exports (writes root <export>.js
files). Use this if you
need to support older bundlers.
minify
boolean
false
Whether to minify the bundled JavaScript.
rollup.plugins
PkgConfigProperty<RollupPlugin[]>
[]
Rollup plugins to load when bundling.
runtime
'*' | 'browser' | 'node'
'*'
Default runtime of package exports
sourcemap
boolean
true
Whether to include source map files.
src
string
'./src'
The path to the directory in which source code is located.
tsconfig
string
'tsconfig.json'
The path to the TypeScript configuration file.
MIT
FAQs
Simple utilities for modern npm packages.
The npm package @sanity/pkg-utils receives a total of 3,174 weekly downloads. As such, @sanity/pkg-utils popularity was classified as popular.
We found that @sanity/pkg-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 56 open source maintainers collaborating on the project.
Did you know?
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.
Product
We're introducing a new Analytics feature in the Socket dashboard so you can view changes in your organization's and repositories' alerts over time.
Security News
A new OpenSSF report uncovers critical gaps in secure software training, with 75% of new developers unfamiliar with secure practices, highlighting urgent educational needs.
Security News
The 2023 Python Developers Survey reveals key trends in packaging, web frameworks, and developer demographics, highlighting a shift toward innovative tools as the Python community diversifies and grows among less experienced developers.