-
Notifications
You must be signed in to change notification settings - Fork 0
π api
-
*
required -
?
optional -
β
chainable and returns the instance -
π―
arguments - if applicable -
π
example -
π
return value -
configs
instance ofDLL
with configs to export
- dir
- config
- find
- pkgDeps
- lastModifiedFilter
- debug
- toConfig
- staleTime
- everyX
- og
- cacheBustingFiles
- context
- shouldBeUsed
- clearCache
- auto (static)
- configs (static)
β currently, for non-static functions, this has to be the first function called. likely this will be improved with a minor refactor.
?β
directory to resolve paths to
- ?directory
- type:
string
- default:
process.cwd()
- type:
configs.dir(__dirname)
*β
webpack config
- config
- type:
object
webpack config object
- type:
const config = {
context: './src',
entry: { index: 'index.js' },
output: { path: 'output', filename: '[name].js' }
}
const configs = DLL.config(config)
?β
find files in src code, use them if they haven't been edited recently
- ?glob
- type:
string
glob - default:
src/**/*.+(js|jsx|ts|tsx)
- type:
default
configs.find()
custom
configs.find(`src/**/*.+(js|jsx|ts|tsx)`)
?β
loads dependencies, and optionally devDependencies frompackage.json
- ?filterFn(
Array<?dependency: string>, Array<?devDependencies: string>, Array<?allDependencies: string>
)- type:
function
- default:
null
- type:
default package.dependencies
configs.pkgDeps()
with filter callback
configs
.pkgDeps((deps, dev, all) => {
if (process.env.NODE_ENV === 'production') {
return deps
}
return all.filter(dep => !['fliplog'].includes(dep))
})
?β
last modified specification filter for including files that don't change often when using .find
- type:
object
fliptime#tillNowSatisfies
more on time specification obj
would filter .find to include files that were last edited at least 1 day ago
configs.lastModifiedFilter({days: 1})
?β
enables or disables debugging logs
- ?should
- type:
boolean
- type:
configs.debug(true)
*
returns an array of webpack configs, your application config(s), alongside dll config(s) when needed
Array<Object>
webpack configs
module.exports = configs.toConfig()
?
after a certain number of time since the last DLL build, build it again to keep it fresh
- object
- type:
object
fliptime#tillNowSatisfies - default:
{days: 1}
- type:
more on time specification obj
configs.everyX(100)
?
every X number of builds, rebuild the dll, clears the cache to keep it light
- number
- type:
number
- default:
33
- type:
configs.everyX(100)
when needed (e.g. testing time difference), for ease-of-use, this will return the original (og) config in .toConfig() regardless of the other settings
- number
- type:
number
- default:
33
- type:
configs.everyX(100)
?
an array of absolute file paths that bust the cache when changed using flipcache
- files
- type:
array
- default:
[require.main.filename, resolve(dir, package.json)]
- type:
const {resolve} = require('path')
const res = rel => resolve(__dirname, rel)
const files = [res('./src/vendor.js'), res('./.babelrc')]
configs.cacheBustingFiles(files)
?β
use all defaults, configureconfig
&dir
, call other required functions automatically
-
config
- type:
object
- type:
dir
Array<Object>
webpack configs
const configs = DLL.auto(config, __dirname)
is the same as using the default values by calling each method manually
const auto = new DLL()
const configs = auto
.dir(__dirname)
.config(config)
.find()
.pkgDeps()
.toConfig()
for an array of configs
-
configs
- type:
array
- type:
-
cb
called for each config, same usage as the api- type:
function
- type:
Array<Object>
webpack configs (flattens the return array configs, since each config becomes an array itself to contain dll config when needed)
?β
context
property for DLLPlugin
- type:
string
path?? (docs do not seem to cover this)
Webpack DLLPlugin source Webpack DllReferencePlugin source
?β
override whether to use dll plugin or not, force using or not
- type:
boolean
const configs = dll.dir(__dirname).config(config).shouldBeUsed(true).toConfig()
?β
delete the cache files
dll.clearCache()
check that the difference is
equal or greater than
specification.
(use only 1 property, all are integers
)
- longhand:
{seconds, hours, minutes, days, years}
- shorthand:
{s, h, m, d, y}
// true: was >= 60 seconds ago
tillNowSatisfies(Date.now() - 60000, {seconds: 60})