-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
28 lines (24 loc) · 860 Bytes
/
index.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
/* jshint node: true */
'use strict';
var writeFile = require('broccoli-file-creator');
var mergeTrees = require('broccoli-merge-trees');
var appVersion = require('ember-cli-app-version');
var endpoint, version;
function appendVersionFile(tree) {
/*jshint validthis:true */
var versionFile = writeFile(endpoint, JSON.stringify(version));
return mergeTrees([tree, versionFile].filter(Boolean));
}
module.exports = {
name: 'ember-cli-self-update',
config: function (env, config) {
this.project.addons
.filter((add)=> add.name === 'ember-cli-app-version')
.map((add)=> add.config(env, config));
endpoint = endpoint || config.APP.versionEndpoint || '/version.json';
version = version || config.APP.version
},
treeForPublic: appendVersionFile,
treeForTestSupport: appendVersionFile,
included: function (app) { }
};