2.9.83 • Published 10 months ago

@taktikorg/autem-reprehenderit v2.9.83

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@taktikorg/autem-reprehenderit

npm version Downloads/month tests

Copy file globs, watching for changes.

This module provides a CLI tool like cp, but with watching.

This is a maintained fork of mysticatea/cpx. It retains the cpx bin name, so it can act as a drop-in replacement.

Installation

npm install @taktikorg/autem-reprehenderit

Usage

Usage: cpx <source> <dest> [options]

    Copy files, watching for changes.

        <source>  The glob of target files.
        <dest>    The path of a destination directory.

Options:

    -c, --command <command>   A command text to transform each file.
    -C, --clean               Clean files that matches <source> like pattern in
                              <dest> directory before the first copying.
    -f, --force               Force the file to be copied, even if the
                              destination is readonly.   
    -i, --ignore              A comma separated list of gitignore style ignore
                              patterns.
    -L, --dereference         Follow symbolic links when copying from them.
    -h, --help                Print usage information.
    --include-empty-dirs      The flag to copy empty directories which is
                              matched with the glob.
    --no-initial              The flag to not copy at the initial time of watch.
                              Use together '--watch' option.
    -p, --preserve            The flag to copy attributes of files.
                              This attributes are uid, gid, atime, and mtime.
    -t, --transform <name>    A module name to transform each file. cpx lookups
                                the specified name via "require()".
    -u, --update              The flag to not overwrite files on destination if
                              the source file is older.
    -v, --verbose             Print copied/removed files.
    -V, --version             Print the version number.
    -w, --watch               Watch for files that matches <source>, and copy
                              the file to <dest> every changing.

Example

$ cpx "src/**/*.{html,png,jpg}" app --watch

This example will copy html/png/jpg files from src directory to app directory, keeping file tree structure. Whenever the files are changed, copy them.

Since Bash expands globs, requires to enclose it with double quotes.

You can use together Browserify.

$ cpx "src/**/*.{html,png,jpg}" app -w & watchify src/index.js -o app/index.js

You can use shell commands to convert each file.

$ cpx "src/**/*.js" app -w -c "babel --source-maps inline"

You can use the transform packages for Browserify.

$ cpx "src/**/*.js" app -w -t babelify -t uglifyify

It maybe can use to add header comment, to optimize images, or etc...

Node.js API

You can use this module as a node module.

var cpx = require("@taktikorg/autem-reprehenderit");

cpx.copy

cpx.copy(source, dest, options, callback)
cpx.copy(source, dest, callback)
  • source {string} -- A file glob of copy targets.
  • dest {string} -- A file path of a destination directory.
  • options {object}
    • options.clean {boolean} -- The flag to remove files that copied on past before copy. Default: false.
    • options.dereference {boolean} -- The flag to follow symbolic links when copying from them. Default: false.
    • options.includeEmptyDirs {boolean} -- The flag to copy empty directories which is matched with the glob. Default: false.
    • options.initialCopy {boolean} -- The flag to not copy at the initial time of watch. This is for cpx.watch(). Default: true.
    • options.force {boolean} -- The flag to copy file to the destination, even if it is readonly.
    • options.preserve {boolean} -- The flag to copy uid, gid, atime, and mtime of files. Default: false.
    • options.transform {((filepath: string) => stream.Transform)[]} -- Functions that creates a stream.Transform object to transform each copying file.
    • options.update {boolean} -- The flag to not overwrite files on destination if the source file is older. Default: false.
    • options.ignore {string|Array<string>} -- A gitignore style string or array of strings that make ignoring directory patterns easier. Default: []
  • callback {(err: Error|null) => void} -- A function that is called at done.

Copy files that matches with source glob to dest directory.

cpx.copySync

cpx.copySync(source, dest, options)
cpx.copySync(source, dest)

A synchronous function of cpx.copy.

Arguments is almost same as cpx.copy. But options.transform is not supported.

cpx.watch

cpx.watch(source, dest, options)
cpx.watch(source, dest)

Copy files that matches with source glob string to dest directory. After the first copy, starts observing. And copy the files when every changes.

Arguments is same as cpx.copy.

cpx.watch returns an EventEmitter.

  • .on("copy", (e) => { ... }) : Be fired after file is copied. e.srcPath is a path of original file. e.dstPath is a path of new file.
  • .on("remove", (e) => { ... }) : Be fired after file is removed. e.path is a path of removed file.
  • .on("watch-ready", () => { ... }) : Be fired when started watching files, after the first copying.
  • .on("watch-error", (err) => { ... }) : Be fired when occured errors during watching.

Changelog

GitHub Releases

Contributing

Thank you for contributions!

Bug Reports or Feature Requests

Please use GitHub Issues.

Document Corrections

Please use GitHub Pull Requests. I would especially thank for document corrections since I'm not familiar with English.

Feature Implementing

Please use GitHub Pull Requests.

There are some npm-scripts to help developments.

  • npm test - Run tests and collect coverage.
  • npm run build - Make lib directory from src directory.
  • npm run clean - Delete directories (folders) which are created by other commands.
  • npm run lint - Run ESLint.
  • npm run watch - Run tests (not collect coverage) when each file was modified.
  • npm run open-coverage - Open the coverage report of the last npm test command with web browser.
babel-coreopensslvalidmatchAllArray.prototype.flatpasswordcopyURLSearchParamscommanderqsdependenciesenvironmentfluxparseES2018slothas-ownesprotoflateventDispatcherreact-componentjson-schemacliphonepinoECMAScript 2022Int32Arrayjsdomdiffauthenticationtypedarraybufferramdaes-shimsgesturesargsautoscalingspeederror-handlingzerosubprocessvestclass-validatorpackage.jsonrulesschemalesscsstrimRightTypedArrayhardlinkshookformvarperformanttyped arraymkdirstraverseECMAScript 2016ignorehashmanagerauthcolouremrfastzxdraghasOwneffect-tsmomentpostcss-pluginless mixinsstyleguidecore-jses-shim APIjQuerydom-testing-library$.extendes5genericsECMAScript 2019-0regexstarterformwgetcloudtrailbufferperformancesuperstructsigtermi18nArray.prototype.findLastpreprocessoroptimistlengthqueryserverenvironmentsarrayssetextramockingES2017trimEndwhichquotetypeerrorebsshimfile systemnameUint8ClampedArraytoolkitstyleboundObject.entriesremovetestingprotocol-buffersredirectrangeerrorRxJSprivateiteratorcommand-linereact animationreduxsetterhasOwnPropertyFunction.prototype.namewalkArray.prototype.findLastIndexString.prototype.matchAllUnderscorestringifytranspilehandlersgetintrinsicconfigutilsstringifierdeletesuperagentthreedependency managermapreduceArray.prototype.includestacitpositivewritecolumnsfull-widtherrordataviewmake dirclassnameuser-streamsprotobufdayjsreducercertificatesObject.ischinesemakevalidateweakmapbinarynumberponyfillassertregularcolorstyled-componentsgraphqlgetoptfast-clonelrureal-timemapdropvariablesInt8Arraynopeworkspace:*reducereplayglobal this valuedataconsolechannelsymboles2018jstypedarraysameValueZerojwtESvpcviewless compilermobilecompile lesselminternaloptionjsonbuffersstableObject.fromEntriesgdprcensorcodeslastes6ES6executejsxdescriptortypesafestructuredCloneimportexporteslintconfiga11yTypeBoxsimpledbArrayBuffer.prototype.slicefindLastIndextrimStartfullpushstateunicodecolumnfilterlibphonenumberjsonschemaschemeECMAScript 2015json-schema-validatorinferencepreserve-symlinksirqObject.getPrototypeOfWeakSetBigUint64ArrayobjectRegExp#flagsURLtranspilerwidthjson-schema-validationInt16ArraydommixinsWeakMapbundlingclassesgitignoresharedarraybufferbusyBigInt64Arraymockapollopackage managercirculares2017rapidECMAScript 5cryptregular-expressioncloudformationclonecurriedRegExp.prototype.flagsglobal objectfnmatchsignedReactiveExtensionsloggeriterategradients cssjavascriptreadablees8definePropertygetpersistentutilfast-deep-copyforkfast-deep-cloneECMAScript 2018prototypeshrinkwrapfastifychaixhrECMAScript 2020less.jsgetPrototypeOffunctionbcryptkeysjoiObject.valuesbrowserUint16ArraytoobjectstreamsefficientfetchmergeStyleSheetwritablewindowscall-bindinstallerutil.inspectietrimLeftimmernegativeinterruptsoutputacornvaluesArray.prototype.contains.envweaksetless cssassertsparserES8cjkenvES2019.gitignoreprocesscolorsquerystringes-abstractspringjshintpatchsafeglobalsloggingcollectionmrudeterministicinstallflattenartfunction.lengthposeprettycoreECMAScript 6emitmodulesArrayBuffer#sliceroutelocalassertionreactsidechromiumfullwidthES2016touchhelpersendpointprunenpmexecES2022bootstrap csstypesignalasteriskssyntaxenumerablehttpsqueuepropertiesprogresstypanionprefixcurlcloudwatchcss lessreact poseshebangsortedserializerloadingdeep-copymacoscall-boundcss nestingSymbolsesbinlintgradients css3waitwhatwg6to5globalThisfastcopyMapmkdirpcharacterpackagesTypeScriptanimationdeepcopydynamodbpipedirectoryES5awesomesauceuninstallelasticacheflatMapjapaneseautoprefixertddnested csslogrgbstreamastcallboundgroupByfixed-widthidentifiersservicetypescripttoArrayeslintvaluetoSortedsortmoduletsflagString.prototype.trimECMAScript 2021Iteratormulti-packageansireadmoveAsyncIteratordeepclonevalidationpyyamlhasstatustypeofback-endSystem.globalArray.prototype.filterES2020kinesisgroupexitlocationObjectstylesheetinredux-toolkit256helpereslintplugines2016indicatortrimnegative zerodataViewregular expressionsliceframerredactcheckextendpluginiterationsqsincludesnodejsreact-testing-librarybrowserslistsetPrototypeOfsymlinkseveryespreedatastructureeslint-plugincloudfrontbddjsdifflanguage@@toStringTagequalityFloat64Arrayreact-hooksnpmignoreinternal slotutilitiesdefinehandlerxtermvariables in csspath__proto__signalsspawnglobArrayproxycallmonoreposhelltextoperating-systemio-tsserializationtimenamesvarspuretslibvalidatorES2021bannerPromiseairbnbpicomatchminimalglacierfastclonecoercibleUint32Arraytesterec2[[Prototype]]ECMAScript 2017stylinglockfileArray.prototype.flattenterminalPushtoStringTagfilepromisestoragegatewaybyteOffsetharmonyfpbabelrecursive_.extendgetOwnPropertyDescriptorelectronscheme-validationECMAScript 3sequencecallbindletsomeajv3dWebSocketcontainsformspropertypnpm9inspectCSSforEachutilityRFC-6455Symbol.toStringTagJSON-Schemaestreecss variableomitvisualReactiveXhotESnexttestReflect.getPrototypeOfonceimportelbworkeraccessibilityES2015requiretoolsfunctionsexpressexpressionwafmetadataeast-asian-widthresolveintrinsicrandombundlerasciifind0s3ObservablesconsumeCSSStyleDeclarationinputequalroutingexecfilelivechromepolyfillpopmotionoffsettakecompilerttykeybeanstalkconcatasyncHyBisyntaxerrorisECMAScript 7sharedsnsmatches2015owneventEmitterconcatMapcomparelazyObservablesetImmediateObject.keystypedarraysstylesdescriptionobjruntimesettingstelephoneregexpdescriptorsenderjestfsconfigurablesigintcss-in-jsfigletECMAScript 2023Microsoftwindowstatelessimmutableajaxformattingreadablestreamfast-copyselflistenersArrayBuffersymlinkspinnerconstinvariantwaapiworkflowStreamhigher-ordertermbrowserlistamazonagentspinnerscollection.es6zoduploadl10npredictablerequestcssbytemkdirfindLastArray.prototype.flatMapapiObject.definePropertyhooksbinariescommandhttpgetterUint8Arraygloballessmatchesdotenvfantasy-landdirfunctionalcreateclientencryptionserializecryptoentriesargumentarrayassignObject.assignoptimizerprivate dataroute53loadbalancingnodechildidleYAMLqueueMicrotaskSetawsES7Float32ArrayrdsJSONisConcatSpreadablelinuxswfbyteLengthtostringtagpoint-freedeep-clonepostcssreusestringshamarktypetransportWebSocketscacheurlbindnativepropaccessorspecES2023escapedatecomputed-typeswarningformateventsecmascriptreact-hook-formfpsfromdeepkorean
2.9.83

10 months ago

2.9.82

10 months ago

1.9.82

10 months ago

1.9.81

10 months ago

1.9.80

10 months ago

1.9.79

10 months ago

1.9.78

10 months ago

1.9.77

11 months ago

1.9.76

11 months ago

1.9.75

11 months ago

1.9.74

11 months ago

1.9.73

11 months ago

1.9.72

11 months ago

1.9.71

11 months ago

1.8.71

11 months ago

1.8.70

11 months ago

1.8.69

11 months ago

1.8.68

11 months ago

1.8.67

11 months ago

1.8.66

11 months ago

1.7.66

11 months ago

1.7.65

11 months ago

1.7.64

11 months ago

1.7.63

11 months ago

1.7.62

11 months ago

1.6.62

11 months ago

1.6.61

11 months ago

1.6.60

11 months ago

1.6.59

11 months ago

1.6.58

11 months ago

1.6.57

11 months ago

1.6.56

11 months ago

1.6.55

11 months ago

1.6.54

11 months ago

1.6.53

11 months ago

1.6.52

11 months ago

1.6.51

11 months ago

1.6.50

12 months ago

1.6.49

12 months ago

1.6.48

12 months ago

1.6.47

12 months ago

1.5.47

12 months ago

1.5.46

12 months ago

1.5.45

12 months ago

1.5.44

12 months ago

1.5.43

12 months ago

1.5.42

12 months ago

1.4.42

12 months ago

1.4.41

12 months ago

1.4.40

12 months ago

1.4.39

12 months ago

1.4.38

12 months ago

1.4.37

12 months ago

1.4.36

12 months ago

1.4.35

12 months ago

1.4.34

12 months ago

1.4.33

12 months ago

1.3.33

1 year ago

1.3.32

1 year ago

1.3.31

1 year ago

1.3.30

1 year ago

1.3.29

1 year ago

1.3.28

1 year ago

1.3.27

1 year ago

1.3.26

1 year ago

1.3.25

1 year ago

1.3.24

1 year ago

1.3.23

1 year ago

1.3.22

1 year ago

1.3.21

1 year ago

1.3.20

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago