Ghost/ghost/admin/lib/asset-delivery/index.js
Daniel Lockyer fcd6360869
Cleaned up asset-delivery env config
- this is no longer needed because we don't do env-specific builds
2022-08-30 08:24:48 +01:00

36 lines
1.1 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
const assets = walkSync(results.directory + '/assets');
assets.forEach(function (relativePath) {
if (relativePath.slice(-1) === '/') { return; }
fs.copySync(`${results.directory}/assets/${relativePath}`, `${assetsOut}/assets/${relativePath}`, {overwrite: true, dereference: true});
});
}
};