forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostbuild.js
More file actions
31 lines (27 loc) · 885 Bytes
/
postbuild.js
File metadata and controls
31 lines (27 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var fs = require('fs');
// Ensure that any optional peer dependency (e.g. ReactTransitionGroup and
// ReactPopper) are properly set as optional globals. Specifically, do not
// error if the user has not loaded these dependencies. Degrade gracefully.
const files = [
__dirname + '/../dist/reactstrap.js',
__dirname + '/../dist/reactstrap.min.js',
];
files.forEach(function(file) {
fs.readFile(file, 'utf8', function(err, data) {
if (err) {
return console.error(err);
}
var result = data.replace(
/\,([a-zA-Z]+)\.ReactTransitionGroup\.Transition/,
',$1.ReactTransitionGroup && $1.ReactTransitionGroup.Transition || undefined'
).replace(
/\,([a-zA-Z]+)\.ReactPopper/,
',$1.ReactPopper || undefined'
);
fs.writeFile(file, result, 'utf8', function(err) {
if (err) {
console.error(err);
}
});
});
});