rlsbl v0.40.1 /rlsbl.targets.npm
On this page

npm release target managing version tracking in package.json, CI scaffolding, package manager detection, asset builds, and dev-install.

#rlsbl.targets.npm

#rlsbl.targets.npm

npm release target that manages version tracking in package.json and scaffolds CI workflows for automated publishing to the npm registry.

#NpmTarget

Release target for npm/Node.js projects (package.json).

#name

python
def name(self)

#detect

python
def detect(self, dir_path)

#read_name

python
def read_name(self, dir_path)

Read the package name from package.json.

#read_metadata

python
def read_metadata(self, dir_path)

Read license and description from package.json.

#_detect_package_manager

python
def _detect_package_manager(self, dir_path)

Detect the package manager by walking up from dir_path to the git root.

Checks each directory for lock files in priority order:

  • pnpm-lock.yaml -> "pnpm"
  • yarn.lock -> "yarn"
  • package-lock.json -> "npm"

Stops at the git root (.git directory) or filesystem root. Returns "npm" as fallback if no lock file is found.

#read_version

python
def read_version(self, dir_path)

Read the version from package.json in the given directory.

#write_version

python
def write_version(self, dir_path, version)

Write a new version to package.json, preserving formatting.

Returns a list of relative file paths that were modified.

#version_file

python
def version_file(self)

#tag_format

python
def tag_format(self, version)

#template_dir

python
def template_dir(self)

#template_vars

python
def template_vars(self, dir_path)

Extract template variables from the target project's package.json.

#template_mappings

python
def template_mappings(self)

#build_assets

python
def build_assets(self, dir_path, version, dist_dir)

Pack a tarball for GH Release upload.

#publish

python
def publish(self, dir_path, version)

Publish to npm based on per-target config and NPM_TOKEN availability.

#check_project_exists

python
def check_project_exists(self, dir_path)

#get_project_init_hint

python
def get_project_init_hint(self)

#dev_install_command

python
def dev_install_command(self, project_dir)