{"id":18185,"library":"build-workflow","title":"build-workflow","description":"A Gruntfile helper that breaks monolithic Gruntfiles into manageable modules. Current stable version is 7.0.1, with maintenance-level updates as needed. It organizes configs, custom tasks, and workflow aliases into separate files under 'grunt-deps/' and automatically loads them. Unlike alternatives like load-grunt-configs, it uses plain JavaScript (not YAML) for aliases and passes grunt/pkg objects to config functions. Primarily useful for legacy Grunt projects; the author recommends npm scripts for new projects.","status":"maintenance","version":"7.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/royriojas/build-workflow","tags":["javascript","grunt","workflow","build","tasks","management","gruntfile"],"install":[{"cmd":"npm install build-workflow","lang":"bash","label":"npm"},{"cmd":"yarn add build-workflow","lang":"bash","label":"yarn"},{"cmd":"pnpm add build-workflow","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CJS-only and does not provide ESM exports.","wrong":"import buildWorkflow from 'build-workflow';","symbol":"buildWorkflow","correct":"const buildWorkflow = require('build-workflow');"},{"note":"The module exports a single function. Invoke it immediately with the grunt instance.","wrong":"import buildWorkflow from 'build-workflow';\nbuildWorkflow(grunt);","symbol":"default","correct":"require('build-workflow')(grunt);"},{"note":"Alias files must export a function that registers tasks; plain objects are not supported.","wrong":"module.exports = { 'default': ['task1'] };","symbol":"aliases","correct":"// In grunt-deps/workflows/aliases.js:\nmodule.exports = function(grunt) { grunt.registerTask('default', ['task1']); };"}],"quickstart":{"code":"mkdir -p grunt-deps/configs grunt-deps/tasks grunt-deps/workflows\ncat > Gruntfile.js << 'EOF'\nmodule.exports = function(grunt) {\n  'use strict';\n  require('build-workflow')(grunt);\n};\nEOF\ncat > grunt-deps/workflows/aliases.js << 'EOF'\nmodule.exports = function(grunt) {\n  grunt.registerTask('default', ['hello']);\n};\nEOF\ncat > grunt-deps/tasks/hello.js << 'EOF'\nmodule.exports = function(grunt) {\n  grunt.registerTask('hello', function() {\n    grunt.log.writeln('Hello from build-workflow!');\n  });\n};\nEOF\nnpm init -y && npm install --save-dev grunt build-workflow\ngrunt","lang":"javascript","description":"Shows minimal setup: folder structure, Gruntfile, alias, custom task, and execution with grunt."},"warnings":[{"fix":"For new projects, use npm scripts (scripts in package.json) or a modern build tool like webpack/vite.","message":"Package author recommends using npm scripts instead of Grunt for new projects.","severity":"deprecated","affected_versions":"*"},{"fix":"Ensure every file in grunt-deps/configs exports a function: module.exports = function(grunt) { return { ... }; };","message":"Config files must export a function that returns an object, not just an object. Otherwise configs won't load.","severity":"gotcha","affected_versions":"*"},{"fix":"Create the file with module.exports = function(grunt) { grunt.registerTask('default', [...]); };","message":"Aliases file must be in grunt-deps/workflows/aliases.js and export a function that registers tasks.","severity":"gotcha","affected_versions":"*"},{"fix":"Name your files exactly as the task (e.g., hello.js for task 'hello').","message":"Custom tasks in grunt-deps/tasks are automatically loaded, but their filenames must match the task name.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure the task file exists in grunt-deps/tasks or that the task is registered via grunt.registerTask.","cause":"The task name in aliases or command line doesn't match any loaded task.","error":"Warning: Task \"<task>\" not found. Use --force to continue."},{"fix":"Change module.exports = {...} to module.exports = function(grunt) { grunt.registerTask(...); };","cause":"Aliases.js exports an object instead of a function that receives grunt.","error":"TypeError: grunt.task.registerTask is not a function"},{"fix":"Run: npm install --save-dev grunt","cause":"Grunt is not installed as a dev dependency.","error":"Cannot find module 'grunt'"},{"fix":"Create a Gruntfile.js in the project root (see quickstart).","cause":"Current directory doesn't contain a Gruntfile.js.","error":"Fatal error: Unable to find Gruntfile.js"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}