Ghost/ghost/admin/lib/asset-delivery/index.js
Daniel Lockyer b376b0c4c9 Removed icon files from packaged tarball
refs 6290fd6deb

- following the referenced commit, all SVG icons should only be used
  with svg-jar and not externally loaded
- this means we are now shipping all the icon files in the packaged tarball, but
  they're unused once Admin is built
- this commit prevents the icons from being copied and bundled
2022-08-31 18:06:42 +01:00

38 lines
1.2 KiB
JavaScript

/* eslint-disable */
'use strict';
module.exports = {
name: 'asset-delivery',
isDevelopingAddon() {
return true;
},
postBuild: function (results) {
const fs = this.project.require('fs-extra');
const walkSync = this.project.require('walk-sync');
const assetsOut = `../core/core/built/admin`;
fs.removeSync(assetsOut);
fs.ensureDirSync(assetsOut);
// the dist folder contains more than just index.html and /assets, especially
// for development builds but for Ghost's purposes it only needs to serve
// index.html and /assets
// copy the index.html file
fs.copySync(`${results.directory}/index.html`, `${assetsOut}/index.html`, {overwrite: true, dereference: true});
// copy all the `/assets` files, except the `icons` folder
const assets = walkSync(results.directory + '/assets', {
ignore: ['icons']
});
assets.forEach(function (relativePath) {
if (relativePath.slice(-1) === '/') { return; }
fs.copySync(`${results.directory}/assets/${relativePath}`, `${assetsOut}/assets/${relativePath}`, {overwrite: true, dereference: true});
});
}
};