![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@netlify/cli-utils
Advanced tools
netlify-cli's @oclif/command baseclass.
Provides a unified way to load and persist global and site level cli config and authenticated api. Also allows commands to program against a consistent base-class api to enable changes down the road.
const Command = require('@netlify/cli-utils')
class OpenCommand extends Command {
async run() {
await this.authenticate()
const api = this.netlify.api
// authenticated api
}
}
OpenCommand.description = `A description`
OpenCommand.examples = [
'netlify open:admin',
'netlify open:site'
]
OpenCommand.hidden = true
module.exports = OpenCommand
Import the the base class and extend it, the same way you do with @oclif/command
.
Commands that extend this base class get access to the same api as @oclif/command
plus a few extra properties:
this.netlify.globalConfig
Provides access to configuration stored in the users home folder under ~/.netlify
.
See global-config.
this.netlify.state
Provides access to site-level state relative to the process.cwd
. (e.g. project/.netlify/config.json
)
See site-config
this.netlify.api
An instance of the netlify
api client. If access tokens are found in global config, then this client will automatically be authenticated.
this.netlify.site
get current site context including root, configPath, and id (with getter and setter).
this.netlify.config
Get the configuration from netlify.[toml/yml]
.
this.authenticate()
A method that will log the user in if they are not already logged in. If the user is already logged in, this is a noop.
FAQs
Netlify CLI utilities for configuration and API access
The npm package @netlify/cli-utils receives a total of 315 weekly downloads. As such, @netlify/cli-utils popularity was classified as not popular.
We found that @netlify/cli-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.