mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 08:31:43 +03:00
fcd6360869
- this is no longer needed because we don't do env-specific builds
36 lines
1.1 KiB
JavaScript
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});
|
|
});
|
|
}
|
|
};
|