liferay-npm-build-tools-common
raw JSON → 2.32.2 verified Sat Apr 25 auth: no javascript
Utility library for Liferay NPM Build Tools, version 2.32.2, maintained by Liferay. It provides shared utilities across Liferay's frontend build toolchain, including npm-scripts, liferay-theme-tasks, and eslint-plugin. It is part of the liferay-frontend-projects monorepo and follows irregular release cadence alongside other packages. Key differentiator: tightly coupled with Liferay portal ecosystem, intended for use within Liferay workspace projects, not a general-purpose npm build tool.
Common errors
error Error: Cannot find module 'liferay-npm-build-tools-common' ↓
cause Package not installed or not in node_modules.
fix
Run npm install liferay-npm-build-tools-common --save-dev
error SyntaxError: Cannot use import statement outside a module ↓
cause Using ESM import in a CommonJS context (e.g., Node without type:module).
fix
Add 'type': 'module' to package.json or use .mjs extension.
error TypeError: getProjectDependencies is not a function ↓
cause Incorrect import style (default import instead of named import).
fix
Use import { getProjectDependencies } from 'liferay-npm-build-tools-common'
Warnings
breaking Package moved from 'liferay-npm-build-tools-common' to 'liferay-npm-build-tools-common' (same name) but internal API may have changed; check v2 migration guide. ↓
fix Update to v2.0.0 or later and refactor imports to use named exports.
deprecated Project constructor expects a rootDir string; if passed undefined, it may throw or return unexpected results. ↓
fix Always provide a valid directory path to new Project().
gotcha Package does not support CommonJS; using require() will throw Module not found error. ↓
fix Use import syntax or configure bundler to handle ESM.
gotcha FileUtil methods assume a Liferay workspace structure; using outside Liferay context may yield incorrect results. ↓
fix Only use within a Liferay workspace project.
Install
npm install liferay-npm-build-tools-common yarn add liferay-npm-build-tools-common pnpm add liferay-npm-build-tools-common Imports
- getProjectDependencies wrong
const { getProjectDependencies } = require('liferay-npm-build-tools-common');correctimport { getProjectDependencies } from 'liferay-npm-build-tools-common'; - getProjectDependencies wrong
import getProjectDependencies from 'liferay-npm-build-tools-common';correctimport { getProjectDependencies } from 'liferay-npm-build-tools-common'; - Project wrong
import { Project } from 'liferay-npm-build-tools-common/lib/Project';correctimport { Project } from 'liferay-npm-build-tools-common'; - FileUtil
import { FileUtil } from 'liferay-npm-build-tools-common';
Quickstart
import { getProjectDependencies, Project } from 'liferay-npm-build-tools-common';
// Instantiate a Project instance with the current working directory
const project = new Project('/path/to/project');
// Get dependencies of the project
const deps = getProjectDependencies(project);
console.log(deps); // Array of dependency names