I've been scheming through bower.io website to learn how I should define packages for my project in bower.json.
However, I've not found any explanation on the overrides property.
Take this as an example:
"dependencies": {
"modernizr": "2.8.2",
"jquery": "1.11.2",
"bootstrap-sass-official": "~3.3.4"
},
"overrides": {
"modernizr": {
"main": "./modernizr.js"
}
}
What does overrides do exactly? Would the snippet I pasted install modernizer 2.8.2, and then override this with whatever is in the relative path, e.i. ./modernizer.js ? What's the point of it?
Related
I'm trying to use rollup to build my React component library. The bundle step completes with a few warnings, however, when I actually try to use it in a Next.js application, I get many "X is not a function" errors when visiting the website. It seems to happen because some dependencies inside the _virtual directory are empty:
For example, this is dist/_virtual/d3-time-format.js (my library uses #visx/scale, which depends on d3-scale, which in turn depends on d3-time-format)
var d3TimeFormat = {exports: {}};
export { d3TimeFormat as d };
//# sourceMappingURL=d3-time-format.js.map
As you can see above, the exports is an empty object, so I get the error "format is not a function". This happens also with other modules, like prop-types (my dependencies depend on it).
This is my rollup.config.js:
import { babel } from '#rollup/plugin-babel';
import commonjs from '#rollup/plugin-commonjs';
import resolve from '#rollup/plugin-node-resolve';
import typescript from '#rollup/plugin-typescript';
import svgr from '#svgr/rollup';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
function bundle(inputPath) {
return {
input: inputPath,
output: [
{
dir: `./dist`,
format: 'esm',
sourcemap: true,
preserveModules: true,
preserveModulesRoot: 'src',
},
],
plugins: [
peerDepsExternal(),
commonjs(),
resolve(),
svgr({
icon: true,
replaceAttrValues: { '#000': '{props.color}' },
svgProps: { fill: 'currentColor' },
}),
typescript(),
babel({
babelHelpers: 'runtime',
exclude: /node_modules/,
extensions: ['.js', '.ts', '.tsx'],
}),
],
};
}
export default [bundle('./src/index.ts')];
When bundling I get these warnings, not sure if they are relevant:
Would appreciate some guidance on what the files inside _virtual are and why they are generated with an empty object. Thanks#
I have a DSL script that creates a pipeline to push to jfrog artifactory. I want to create a target directory in artifactory with current date as directory name.
import java.text.SimpleDateFormat
env.buildDateString="\${new SimpleDateFormat('yyMMdd').format(new Date())}-\${env.BUILD_NUMBER}"
...
...
//artifactory step
{
"pattern": "*abc*.zip",
"target": "myrepo/application/\${env.buildDateString}\\n/artifacts/"
}
The above script is giving the below snippet
{
"pattern": "*abc*.zip",
"target": "myrepo/application/${env.buildDateString}\n/artifacts/"
}
I want the directory to be created using the date. How to refer the buildDateString in "target" section of artifactory so I get output like this
"target": "myrepo/application/220328/artifacts/"
Why the slashes?
backslash () is used to escape special characters in every type, except dollar-slashy string, where we must use dollar ($) to escape.
In your case just do as below,
env.buildDateString="${new SimpleDateFormat('yyMMdd').format(new Date())}-${env.BUILD_NUMBER}"
{
"pattern": "*abc*.zip",
"target": "myrepo/application/${env.buildDateString}/artifacts/"
}
sample
Hi Im using cypress coverage report but I have a class which houses all touch device specific functionality and as I'm running the tests on my Mac, they never run. Is there any way to exclude this class?
you might want to check cypress coverage readme:
...
"nyc": {
"include": [...],
"exclude": [...]
}
...
If this doesn't work:
"nyc": {
"exclude": [...]
}
Then add one more property like this:
"nyc": {
"exclude": [...],
"excludeAfterRemap": true
}
On cypress version 10, what worked for me is to create a .nycrc.json file which contains
{
"exclude": [...],
}
I'm using webpack 2, with the webpack-dev-middleware
{
test: /\.styl$/,
use: [
'style-loader',
'css-loader',
{
loader: 'stylus-loader',
options: {
use: [nib()],
},
},
]
},
{
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
use: [ {
loader: 'file-loader',
options: {
publicPath: '/dist/'
}
} ]
}
Relevant server code:
let compiler = webpack(webpackConfig);
app.use(webpackDevMiddleware(compiler, {
publicPath: ('/dist/')
}));
On the initial build (either using webpack from the console, or on first running my server) the whole process takes ~2000ms. Changing .js files doesn't take long at all (<200ms), but changing stylus files takes a very long time (>90s). If I make a change to the stylus then manually trigger a rebuild with webpack it's really quick, but ideally I'd like the watch to do its magic and for my css to be reloaded in place quickly...
Any ideas why the rebuild is taking such a long with stylus, or how I can debug the issue?
I'm new to electron. I'm building an app that uses ffmpeg and sox, which are installed globally. How do I guarantee that these dependencies will be installed on the users computer?
Try this, it is not specific to electron, but can help
http://12factor.net/dependencies
There could be two kind of system level dependencies:
NPM based package expected to be installed at a system level
Non NPM package, like a system level library(in your case ffmpeg)
For NPM based package, you can do a peer dependency like the following:
{
....
"peerDependencies": {
"chai": "1.x"
}
....
}
For non NPM package, usual pattern is to check this during your application start flow and inform the user if it's not available.
Answering specific to ffmpeg, following should help:
/**
* Check for ffmpeg availability
*
* If the FFMPEG_PATH environment variable is set, try to use it.
* If it is unset or incorrect, try to find ffmpeg in the PATH instead.
*
* #method FfmpegCommand#_getFfmpegPath
* #param {Function} callback callback with signature (err, path)
* #private
*/
proto._getFfmpegPath = function(callback) {
if ('ffmpegPath' in cache) {
return callback(null, cache.ffmpegPath);
}
async.waterfall([
// Try FFMPEG_PATH
function(cb) {
if (process.env.FFMPEG_PATH) {
fs.exists(process.env.FFMPEG_PATH, function(exists) {
if (exists) {
cb(null, process.env.FFMPEG_PATH);
} else {
cb(null, '');
}
});
} else {
cb(null, '');
}
},
// Search in the PATH
function(ffmpeg, cb) {
if (ffmpeg.length) {
return cb(null, ffmpeg);
}
utils.which('ffmpeg', function(err, ffmpeg) {
cb(err, ffmpeg);
});
}
], function(err, ffmpeg) {
if (err) {
callback(err);
} else {
callback(null, cache.ffmpegPath = (ffmpeg || ''));
}
});
};
The above code is taken from here. node-fluent-ffmpeg is a nice project which works on top of ffmpeg. I believe, it will be a good reference for your project.
You could package the different installers for the dependencies with your app, then create a custom installer for your app that also launches the dependency installers in sequence, or simply prompt the user to install the dependencies themselves and link them to a download page.
There are lots of resources for creating installers, try a google search for electron installer for your specific platform.
sorry I'm late to the party but just in case this is still relevant - I've created ffbinaries module specifically for this purpose.
You can check it out on npm, it'll simply download the binaries on user machine during app boot, the platform will be detected automatically (you can override it though if you're planning to include it in CI of some sort).