Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@rollup-extras/plugin-copy
Advanced tools
Rollup plugin to copy assets during build.
Points:
assetFileNames
from rollup)Uses @niceties/logger
to log messages, can be configured through @niceties/logger
API.
Next examples are equivalent:
copy('assets/*')
copy(['assets/*'])
copy({ src: 'assets/*' })
copy([{ src: 'assets/*' }])
copy({ targets: 'assets/*' })
copy({ targets: ['assets/*'] })
copy({ targets: [{ src: 'assets/*' }] })
all of them will trigger a copy (through emitFile) of all files in assets in each output directory.
To copy files on every rebuild in watch mode use copyOnce
= false
:
copy({ src: 'assets/*', copyOnce: false })
// or
copy({ targets: ['assets/*'], copyOnce: false })
To stop triggering on changes in files use watch
= false
:
copy({ src: 'assets/*', watch: false })
// or
copy({ targets: ['assets/*'], watch: false })
To display more information in console use verbose
= true
:
copy({ src: 'assets/*', verbose: true })
// or
copy({ targets: ['assets/*'], verbose: true })
By default plugin uses glob-parent
to preserve directory structure of assets (relative to glob parent path). To flattern files in assets directory use flattern
= true
:
copy({ src: 'assets/*', flattern: true })
// or
copy({ targets: ['assets/*'], flattern: true })
To add hashes to file names use exactFileNames
= false
, tweek assetFileNames
option in rollup config if needed. Files with same content will be deduplicated by rollup
in this mode.
copy({ src: 'assets/*', exactFileNames: false })
// or
copy({ targets: ['assets/*'], exactFileNames: false })
To work as output plugin use outputPlugin
= false
option (watch mode will be disabled because of rollup
limitations):
copy({ src: 'assets/*', outputPlugin: false })
// or
copy({ targets: ['assets/*'], outputPlugin: false })
To stop files being emitted through rollup pipeline use can use emitFiles
= false
. Please note that you need to specify dest
and it will not be relative to output directory, also file will not be copied into each output directory.
copy({ src: 'assets/*', dest: 'public', emitFiles: false })
// or
copy({ targets: [{ src: 'assets/*', dest: 'public' }], emitFiles: false })
dest
and exclude
Use dest
option to put assets into subfolder in assets directory. As an example if we have assets
as a directory for assets and public
as an output directory and we specify 'dest'
= 'fonts'
assets will be copied into public/assets/fonts
preserving assets directory structure.
Use exclude
option to filter out files in assets (passed to ignore option of glob options). For example *.json
will filter out json files.
copy({ src: 'assets/*', dest: 'fonts', exclude: '*.json' })
// or
copy({ targets: [{ src: 'assets/*', dest: 'fonts', exclude: '*.json' }] })
type SingleTargetDesc = {
src: string,
exclude?: string | string[],
dest?: string;
};
type MultipleTargetsDesc = string | string[] | SingleTargetDesc | SingleTargetDesc[];
type CopyPluginOptions = {
targets?: MultipleTargetsDesc,
pluginName?: string, // defaults to '@rollup-extras/plugin-copy'
copyOnce?: boolean, // true by default
watch?: boolean, // true by default
verbose?: boolean, // false by default
flattern?: boolean, // false by default
exactFileNames?: boolean, // true by default
outputPlugin?: boolean, // false by default
emitFiles?: boolean // true by default
} | MultipleTargetsDesc;
FAQs
Rollup plugin to copy assets during build.
The npm package @rollup-extras/plugin-copy receives a total of 90 weekly downloads. As such, @rollup-extras/plugin-copy popularity was classified as not popular.
We found that @rollup-extras/plugin-copy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.