forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add scripts to copy assets to dist folders (#90)
- Loading branch information
1 parent
a354aa0
commit f7666e1
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
superset-frontend/temporary_superset_ui/superset-ui/scripts/buildAssets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, no-console */ | ||
const fg = require('fast-glob'); | ||
const fs = require('fs-extra'); | ||
|
||
const packages = fg.sync(['packages/*'], { | ||
onlyDirectories: true, | ||
}); | ||
|
||
packages.forEach(pkg => { | ||
const assets = fg.sync([`${pkg}/src/**/*.{png,gif,jpg,css,geojson}`]); | ||
assets.forEach(filePath => { | ||
const newPaths = ['lib', 'esm'].map(dir => filePath.replace(`${pkg}/src`, `${pkg}/${dir}`)); | ||
newPaths.forEach(p => { | ||
fs.copy(filePath, p, err => { | ||
if (err) { | ||
console.error(err); | ||
} | ||
console.log(`Copy ${filePath}`); | ||
console.log(`=> to ${p}`); | ||
}); | ||
}); | ||
}); | ||
}); |