This repository was archived by the owner on Apr 14, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathember-cli-build.js
More file actions
133 lines (123 loc) · 4.44 KB
/
ember-cli-build.js
File metadata and controls
133 lines (123 loc) · 4.44 KB
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
123
124
125
126
127
128
129
130
131
132
133
/* eslint-env node */
const nodeSass = require('node-sass');
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const broccoliAssetRevDefaults = require('broccoli-asset-rev/lib/default-options');
const { EMBER_ENV } = process.env;
const IS_PROD = EMBER_ENV === 'production';
function postProcess(content) {
return content.trim().replace(/^\s{20}/mg, '');
}
module.exports = function(defaults) {
const config = defaults.project.config(EMBER_ENV);
const app = new EmberApp(defaults, {
hinting: config.lintOnBuild,
tests: config.testsEnabled,
ace: {
modes: ['handlebars'],
},
autoImport: {
webpack: {
node: {
path: true,
},
},
exclude: ['jsonapi-typescript'],
},
addons: {
blacklist: [
...Object.keys(config.engines).filter(
engineName => !config.engines[engineName].enabled,
),
],
},
'ember-bootstrap': {
bootstrapVersion: 3,
importBootstrapFont: true,
importBootstrapCSS: false,
},
'ember-composable-helpers': {
only: ['compose', 'contains', 'flatten', 'includes', 'range', 'queue', 'map-by', 'without', 'find-by'],
},
'ember-cli-password-strength': {
bundleZxcvbn: !IS_PROD,
},
fingerprint: {
enabled: true,
extensions: broccoliAssetRevDefaults.extensions.concat(['svg']),
exclude: [
'zxcvbn.js',
'assets/osf-assets',
'assets/images/addons/icons',
// Exclude <engine-name>/config/environment.js from fingerprinting so it matches
// the engines exclude regex.
// https://github.com/ember-engines/ember-engines/blob/master/index.js#L10
'config/environment.js',
],
prepend: config.assetsPrefix,
},
sassOptions: {
implementation: nodeSass,
includePaths: [
'app/styles/',
],
},
cssModules: {
headerModules: [
'ember-osf-web/styles/headers',
],
},
babel: {
sourceMaps: 'inline',
},
sourcemaps: {
enabled: config.sourcemapsEnabled,
extensions: ['js'],
},
inlineContent: {
assetsPrefix: {
content: config.assetsPrefix,
},
raven: {
enabled: IS_PROD,
content: `
<script src="https://cdn.ravenjs.com/3.22.1/ember/raven.min.js"></script>
<script>
var encodedConfig = document.head.querySelector("meta[name$='/config/environment']").content;
var config = JSON.parse(unescape(encodedConfig));
if (config.sentryDSN) {
Raven.config(config.sentryDSN, config.sentryOptions || {}).install();
}
</script>
`,
postProcess,
},
zxcvbn: {
enabled: IS_PROD,
/* eslint-disable max-len */
content: `
<script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"
integrity="sha256-Znf8FdJF85f1LV0JmPOob5qudSrns8pLPZ6qkd/+F0o=
sha384-jhGcGHNZytnBnH1wbEM3KxJYyRDy9Q0QLKjE65xk+aMqXFCdvFuYIjzMWAAWBBtR
sha512-TZlMGFY9xKj38t/5m2FzJ+RM/aD5alMHDe26p0mYUMoCF5G7ibfHUQILq0qQPV3wlsnCwL+TPRNK4vIWGLOkUQ=="
crossorigin="anonymous">
</script>
`,
postProcess,
/* eslint-enable max-len */
},
},
'ember-cli-babel': {
includePolyfill: IS_PROD,
},
assetLoader: {
generateURI(filePath) {
return config.assetsPrefix.replace(/\/$/, '') + filePath;
},
},
});
app.import('node_modules/dropzone/dist/dropzone.css');
app.import('node_modules/dropzone/dist/dropzone.js');
app.import('node_modules/wicg-inert/dist/inert.min.js');
app.import('node_modules/billboard.js/dist/billboard.css');
return app.toTree();
};