-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (24 loc) · 813 Bytes
/
index.js
File metadata and controls
28 lines (24 loc) · 813 Bytes
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
'use strict';
const chalk = require('chalk');
const generateSitemap = require('./lib/sitemap-generator').generateSitemap;
const fs = require('fs');
let urls = [];
module.exports = {
name: require('./package').name,
urlsFromPrember(premberUrls) {
urls = premberUrls || [];
},
outputReady() {
if (process.env.EMBER_ENV === 'production') {
const premberOptions = this.app.options['prember'];
const baseRoot = premberOptions.baseRoot;
if (!baseRoot) {
return this.ui.writeLine(chalk.red(
'ERROR: You must define `baseRoot` for prember-sitemap-generator to generate sitemaps.'
));
}
fs.writeFileSync('dist/sitemap.xml', generateSitemap(baseRoot, urls));
this.ui.writeLine(chalk.green('sitemap.xml successfully created!'));
}
}
};