-
Notifications
You must be signed in to change notification settings - Fork 284
/
ember-cli-build.js
122 lines (113 loc) · 3.28 KB
/
ember-cli-build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const Funnel = require('broccoli-funnel');
const SVGO = require('svgo');
module.exports = function (defaults) {
let fingerprint;
if (process.env.DISABLE_FINGERPRINTS) {
fingerprint = false;
} else {
fingerprint = {
exclude: ['images/emoji', 'images/logos'],
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'],
};
if (process.env.TRAVIS_ENTERPRISE) {
fingerprint.prepend = '/';
} else {
let assetsHost = process.env.ASSETS_HOST;
if (assetsHost) {
if (assetsHost.substr(-1) !== '/') {
assetsHost = assetsHost + '/';
}
fingerprint.prepend = assetsHost;
} else if (process.env.DEPLOY_TARGET) {
const s3Bucket = require('./config/deploy')(process.env.DEPLOY_TARGET)
.s3.bucket;
fingerprint.prepend = '//' + s3Bucket + '.s3.amazonaws.com/';
}
}
}
const app = new EmberApp(defaults, {
'ember-cli-babel': {
includePolyfill: true,
},
fingerprint: fingerprint,
sourcemaps: {
enabled: true,
extensions: ['js'],
},
'ember-prism': {
components: ['yaml'],
plugins: ['line-numbers', 'line-highlight'],
},
svg: {
optimize: false,
paths: ['public/images/stroke-icons', 'public/images/svg'],
},
svgJar: {
optimizer: {
svgoModule: SVGO,
plugins: [
{ prefixIds: true },
{ removeViewBox: false },
{ removeTitle: false },
{ removeDesc: false },
{
removeUnknownsAndDefaults: {
unknownContent: false,
},
},
{
inlineStyles: {
onlyMatchedOnce: false,
removeMatchedSelectors: true,
},
},
],
},
},
'ember-composable-helpers': {
only: ['sort-by', 'compute', 'contains', 'toggle'],
},
'ember-power-select': {
theme: false,
},
postcssOptions: {
compile: {
enabled: true,
extension: 'scss',
parser: require('postcss-scss'),
plugins: [
require('@csstools/postcss-sass'),
require('tailwindcss')('./config/tailwind.js'),
],
},
},
outputPaths: {
app: {
css: {
'tailwind/base': '/assets/tailwind-base.css',
},
},
},
});
const emojiAssets = new Funnel(
'node_modules/emoji-datasource-apple/img/apple/64',
{
destDir: '/images/emoji',
},
);
importNpmDependency(app, 'node_modules/fuzzysort/fuzzysort.js');
importNpmDependency(app, 'node_modules/pusher-js/dist/web/pusher.js');
importNpmDependency(app, 'node_modules/raven-js/dist/raven.js');
importNpmDependency(app, 'node_modules/emoji-js/lib/emoji.js');
importNpmDependency(app, 'node_modules/visibilityjs/index.js');
importNpmDependency(app, 'node_modules/ansiparse/lib/ansiparse.js', 'amd');
importNpmDependency(app, 'node_modules/js-yaml/index.js');
importNpmDependency(app, 'node_modules/deep-freeze/index.js');
return app.toTree(emojiAssets);
};
function importNpmDependency(app, path, transformation = 'cjs', alias) {
const as = alias || path.split('/')[1];
app.import(path, { using: [{ transformation, as }] });
}