2017-03-28 13:29:18 +03:00
|
|
|
/* eslint-env node */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
|
|
|
const concat = require('broccoli-concat');
|
|
|
|
const mergeTrees = require('broccoli-merge-trees');
|
2020-09-09 19:22:23 +03:00
|
|
|
const Terser = require('broccoli-terser-sourcemap');
|
2019-01-21 19:06:25 +03:00
|
|
|
const Funnel = require('broccoli-funnel');
|
2022-08-02 15:43:28 +03:00
|
|
|
const webpack = require('webpack');
|
2017-03-28 13:29:18 +03:00
|
|
|
const environment = EmberApp.env();
|
2022-08-31 18:07:11 +03:00
|
|
|
const isDevelopment = environment === 'development';
|
2017-03-28 13:29:18 +03:00
|
|
|
const isProduction = environment === 'production';
|
2022-08-02 15:43:28 +03:00
|
|
|
const isTesting = environment === 'test';
|
2015-09-03 13:03:45 +03:00
|
|
|
|
2021-01-19 12:25:05 +03:00
|
|
|
const postcssImport = require('postcss-import');
|
2019-02-24 07:19:06 +03:00
|
|
|
const postcssCustomProperties = require('postcss-custom-properties');
|
|
|
|
const postcssColorModFunction = require('postcss-color-mod-function');
|
|
|
|
const postcssCustomMedia = require('postcss-custom-media');
|
|
|
|
const autoprefixer = require('autoprefixer');
|
|
|
|
const cssnano = require('cssnano');
|
|
|
|
|
2019-01-21 19:06:25 +03:00
|
|
|
const codemirrorAssets = function () {
|
2017-03-28 13:29:18 +03:00
|
|
|
let codemirrorFiles = [
|
2016-07-05 19:30:14 +03:00
|
|
|
'lib/codemirror.js',
|
|
|
|
'mode/htmlmixed/htmlmixed.js',
|
|
|
|
'mode/xml/xml.js',
|
|
|
|
'mode/css/css.js',
|
|
|
|
'mode/javascript/javascript.js'
|
|
|
|
];
|
|
|
|
|
|
|
|
if (environment === 'test') {
|
|
|
|
return {import: codemirrorFiles};
|
|
|
|
}
|
|
|
|
|
2017-03-30 22:51:50 +03:00
|
|
|
let config = {};
|
|
|
|
|
|
|
|
config.public = {
|
|
|
|
include: codemirrorFiles,
|
|
|
|
destDir: '/',
|
|
|
|
processTree(tree) {
|
|
|
|
let jsTree = concat(tree, {
|
|
|
|
outputFile: 'assets/codemirror/codemirror.js',
|
|
|
|
headerFiles: ['lib/codemirror.js'],
|
|
|
|
inputFiles: ['mode/**/*'],
|
|
|
|
sourceMapConfig: {enabled: false}
|
|
|
|
});
|
|
|
|
|
2019-01-21 19:06:25 +03:00
|
|
|
if (isProduction) {
|
2020-09-09 19:22:23 +03:00
|
|
|
jsTree = new Terser(jsTree);
|
2019-01-21 19:06:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
let mergedTree = mergeTrees([tree, jsTree]);
|
|
|
|
return new Funnel(mergedTree, {include: ['assets/**/*', 'theme/**/*']});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// put the files in vendor ready for importing into the test-support file
|
|
|
|
if (environment === 'development') {
|
|
|
|
config.vendor = codemirrorFiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
return config;
|
|
|
|
};
|
|
|
|
|
2022-05-09 14:23:20 +03:00
|
|
|
let denylist = [];
|
2019-03-11 18:45:26 +03:00
|
|
|
if (process.env.CI) {
|
2022-05-09 14:23:20 +03:00
|
|
|
denylist.push('ember-cli-eslint');
|
2019-03-11 18:45:26 +03:00
|
|
|
}
|
|
|
|
|
2023-07-14 17:21:43 +03:00
|
|
|
let publicAssetURL;
|
|
|
|
|
|
|
|
if (isTesting) {
|
|
|
|
publicAssetURL = undefined;
|
|
|
|
} else if (process.env.GHOST_CDN_URL) {
|
|
|
|
publicAssetURL = process.env.GHOST_CDN_URL + 'assets/';
|
|
|
|
} else {
|
|
|
|
publicAssetURL = 'assets/';
|
|
|
|
}
|
|
|
|
|
2015-09-03 13:03:45 +03:00
|
|
|
module.exports = function (defaults) {
|
2017-03-28 13:29:18 +03:00
|
|
|
let app = new EmberApp(defaults, {
|
2022-05-09 14:23:20 +03:00
|
|
|
addons: {denylist},
|
2022-07-18 15:59:49 +03:00
|
|
|
babel: {
|
|
|
|
plugins: [
|
|
|
|
require.resolve('babel-plugin-transform-react-jsx')
|
2023-11-03 06:32:34 +03:00
|
|
|
]
|
2022-07-18 15:59:49 +03:00
|
|
|
},
|
2017-02-17 22:46:41 +03:00
|
|
|
'ember-cli-babel': {
|
2016-02-04 15:49:53 +03:00
|
|
|
optional: ['es6.spec.symbols'],
|
2019-01-22 17:03:27 +03:00
|
|
|
includePolyfill: false
|
2016-02-04 15:49:53 +03:00
|
|
|
},
|
2017-02-21 15:28:05 +03:00
|
|
|
'ember-composable-helpers': {
|
2022-10-21 11:31:25 +03:00
|
|
|
only: ['join', 'optional', 'pick', 'toggle', 'toggle-action', 'compute']
|
2017-02-21 15:28:05 +03:00
|
|
|
},
|
2021-09-03 20:14:28 +03:00
|
|
|
'ember-promise-modals': {
|
|
|
|
excludeCSS: true
|
|
|
|
},
|
2015-09-03 13:03:45 +03:00
|
|
|
outputPaths: {
|
|
|
|
app: {
|
2022-08-02 15:43:28 +03:00
|
|
|
js: 'assets/ghost.js',
|
2017-02-17 22:46:41 +03:00
|
|
|
css: {
|
2022-08-02 15:43:28 +03:00
|
|
|
app: 'assets/ghost.css',
|
2017-04-05 12:39:07 +03:00
|
|
|
// TODO: find a way to use the .min file with the lazyLoader
|
|
|
|
'app-dark': 'assets/ghost-dark.css'
|
2017-02-17 22:46:41 +03:00
|
|
|
}
|
2015-09-03 13:03:45 +03:00
|
|
|
}
|
|
|
|
},
|
2017-04-05 16:08:15 +03:00
|
|
|
fingerprint: {
|
2018-05-21 11:37:17 +03:00
|
|
|
enabled: isProduction,
|
2023-07-14 13:16:02 +03:00
|
|
|
prepend: process.env.GHOST_CDN_URL || '',
|
2023-07-14 11:39:33 +03:00
|
|
|
extensions: [
|
|
|
|
'js',
|
|
|
|
'css',
|
|
|
|
'png',
|
|
|
|
'jpg',
|
|
|
|
'jpeg',
|
|
|
|
'gif',
|
|
|
|
'map',
|
|
|
|
'svg',
|
|
|
|
'ttf',
|
2023-07-14 11:40:39 +03:00
|
|
|
'woff2',
|
|
|
|
'mp4',
|
2023-07-14 11:39:33 +03:00
|
|
|
'ico'
|
|
|
|
]
|
2017-04-05 16:08:15 +03:00
|
|
|
},
|
2017-09-18 18:39:03 +03:00
|
|
|
minifyJS: {
|
|
|
|
options: {
|
|
|
|
output: {
|
|
|
|
semicolons: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-05-20 13:05:11 +03:00
|
|
|
minifyCSS: {
|
|
|
|
// postcss already handles minification and this was stripping required CSS
|
|
|
|
enabled: false
|
|
|
|
},
|
2016-06-29 11:25:51 +03:00
|
|
|
nodeAssets: {
|
2023-10-12 15:17:39 +03:00
|
|
|
codemirror: codemirrorAssets()
|
2016-06-29 11:25:51 +03:00
|
|
|
},
|
2019-02-24 07:19:06 +03:00
|
|
|
postcssOptions: {
|
|
|
|
compile: {
|
|
|
|
enabled: true,
|
|
|
|
plugins: [
|
|
|
|
{
|
2021-01-19 12:25:05 +03:00
|
|
|
module: postcssImport,
|
2019-02-24 07:19:06 +03:00
|
|
|
options: {
|
|
|
|
path: ['app/styles']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
module: postcssCustomProperties,
|
|
|
|
options: {
|
|
|
|
preserve: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
module: postcssColorModFunction
|
|
|
|
},
|
|
|
|
{
|
|
|
|
module: postcssCustomMedia
|
|
|
|
},
|
|
|
|
{
|
|
|
|
module: autoprefixer
|
|
|
|
},
|
|
|
|
{
|
|
|
|
module: cssnano,
|
|
|
|
options: {
|
|
|
|
zindex: false,
|
|
|
|
// cssnano sometimes minifies animations incorrectly causing them to break
|
|
|
|
// See: https://github.com/ben-eb/gulp-cssnano/issues/33#issuecomment-210518957
|
|
|
|
reduceIdents: {
|
|
|
|
keyframes: false
|
|
|
|
},
|
|
|
|
discardUnused: {
|
|
|
|
keyframes: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2021-05-27 20:54:25 +03:00
|
|
|
sourcemaps: {enabled: true},
|
2018-03-19 12:57:31 +03:00
|
|
|
svgJar: {
|
2018-03-19 16:10:04 +03:00
|
|
|
strategy: 'inline',
|
|
|
|
stripPath: false,
|
|
|
|
sourceDirs: [
|
2023-10-12 15:17:39 +03:00
|
|
|
'public/assets/icons'
|
2017-03-01 15:48:27 +03:00
|
|
|
],
|
2018-03-19 12:57:31 +03:00
|
|
|
optimizer: {
|
2017-03-01 15:48:27 +03:00
|
|
|
plugins: [
|
2019-08-28 13:33:32 +03:00
|
|
|
{prefixIds: true},
|
|
|
|
{cleanupIds: false},
|
2017-03-01 15:48:27 +03:00
|
|
|
{removeDimensions: true},
|
2022-08-31 18:07:11 +03:00
|
|
|
{removeTitle: !isDevelopment},
|
2017-04-14 18:16:52 +03:00
|
|
|
{removeXMLNS: true},
|
|
|
|
// Transforms on groups are necessary to work around Firefox
|
|
|
|
// not supporting transform-origin on line/path elements.
|
|
|
|
{convertPathData: {
|
|
|
|
applyTransforms: false
|
|
|
|
}},
|
|
|
|
{moveGroupAttrsToElems: false}
|
2017-03-01 15:48:27 +03:00
|
|
|
]
|
|
|
|
}
|
2021-09-09 12:35:15 +03:00
|
|
|
},
|
|
|
|
autoImport: {
|
2023-07-14 17:21:43 +03:00
|
|
|
publicAssetURL,
|
2021-09-09 12:35:15 +03:00
|
|
|
webpack: {
|
2023-11-03 01:18:30 +03:00
|
|
|
devtool: 'source-map',
|
2022-08-02 15:43:28 +03:00
|
|
|
resolve: {
|
|
|
|
fallback: {
|
|
|
|
util: require.resolve('util'),
|
|
|
|
path: require.resolve('path-browserify'),
|
|
|
|
fs: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
process: 'process/browser'
|
|
|
|
})
|
|
|
|
]
|
2021-09-09 12:35:15 +03:00
|
|
|
}
|
2022-12-07 11:53:58 +03:00
|
|
|
},
|
|
|
|
'ember-test-selectors': {
|
|
|
|
strip: false
|
2015-09-03 13:03:45 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-03-19 20:56:09 +03:00
|
|
|
// Stop: Normalize
|
|
|
|
app.import('node_modules/normalize.css/normalize.css');
|
2019-01-21 19:06:25 +03:00
|
|
|
|
|
|
|
// 'dem Styles
|
2023-10-12 15:17:39 +03:00
|
|
|
// import codemirror styles rather than lazy-loading so that
|
2019-01-21 19:06:25 +03:00
|
|
|
// our overrides work correctly
|
2019-04-29 18:57:41 +03:00
|
|
|
app.import('node_modules/codemirror/lib/codemirror.css');
|
|
|
|
app.import('node_modules/codemirror/theme/xq-light.css');
|
2018-03-19 20:56:09 +03:00
|
|
|
|
2015-09-03 13:03:45 +03:00
|
|
|
// 'dem Scripts
|
2018-03-19 20:56:09 +03:00
|
|
|
app.import('node_modules/google-caja-bower/html-css-sanitizer-bundle.js');
|
|
|
|
app.import('node_modules/keymaster/keymaster.js');
|
2019-03-05 20:34:00 +03:00
|
|
|
app.import('node_modules/reframe.js/dist/noframe.js');
|
2015-09-16 20:02:06 +03:00
|
|
|
|
2017-03-30 22:51:50 +03:00
|
|
|
// pull things we rely on via lazy-loading into the test-support.js file so
|
|
|
|
// that tests don't break when running via http://localhost:4200/tests
|
|
|
|
if (app.env === 'development') {
|
|
|
|
app.import('vendor/codemirror/lib/codemirror.js', {type: 'test'});
|
|
|
|
}
|
|
|
|
|
2015-09-03 13:03:45 +03:00
|
|
|
return app.toTree();
|
|
|
|
};
|