Skip to main content

@carry0987/plugin-manager

Organize front-end assets with rules instead of hand-written copy scripts

Organize front-end packages and static assets with declarative rules.

  • Supports scoped packages and micromatch filtering
  • Blocks path escapes and destination overwrite conflicts
  • Covers reset, copy, filter, and cleanup steps
Typical workflow
1PluginManager.emptyDir('public/vendor');
2
3PluginManager.copyPackages('node_modules', 'public/vendor', [
4 {
5 name: 'bootstrap',
6 from: 'dist',
7 include: ['**/bootstrap.bundle.min.js', '**/bootstrap.min.css'],
8 },
9]);
10
11PluginManager.copyFiles('src/assets', 'public/vendor', {
12 exclude: ['**/*.map'],
13});

Output is always constrained to targetDir/<package-name>/...

Turn repetitive asset copying into reviewable rules

Rule Driven

Describe asset sources with rules

Define package names, source folders, included files, and excluded files directly in code so the asset pipeline stays readable and maintainable.

Safe Output

Constrain output and block overwrites

Package output is always confined to targetDir/<package-name>/..., and conflicting rules fail fast instead of silently replacing files.

Mixed Sources

Assemble package and local files together

Copy third-party assets from node_modules, merge in local templates or overrides, and finish with cleanup steps in one workflow.

Workflow

Recommended sequence

01

Reset the output directory

Use emptyDir() to keep the root directory in place while removing old output before each build.

02

Copy package and local files

Run copyPackages() first, then use copyFiles() for local templates, overrides, and extra assets.

03

Clean and verify output

Finish with clearUnnecessaryFiles() and clearEmptyDirs() to remove unwanted files and empty folders.