bones-cli 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -6
- package/init-template/router-sitemap.js.tmpl +13 -0
- package/package.json +1 -1
- package/page-template/page.js.tmpl +28 -12
package/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var fs = require('fs');
|
|
|
4
4
|
// bfinit: CLI command to set up the files in a new project
|
|
5
5
|
// bf stands for Bones Framework
|
|
6
6
|
var bfinit = function() {
|
|
7
|
-
|
|
8
7
|
|
|
9
8
|
// Let people know what's going on...
|
|
10
9
|
console.log('=================================');
|
|
@@ -89,7 +88,7 @@ var bfinit = function() {
|
|
|
89
88
|
fs.writeFileSync(dest, updatedContent);
|
|
90
89
|
|
|
91
90
|
src = 'page-template/page.js.tmpl';
|
|
92
|
-
dest = 'pages/page-home/
|
|
91
|
+
dest = 'pages/page-home/page-home-route.js';
|
|
93
92
|
var templateContent = fs.readFileSync(`${__dirname}/${src}`);
|
|
94
93
|
var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'pageHome');
|
|
95
94
|
updatedContent = updatedContent.replace(/PAGE_PATH_GOES_HERE/g, '/');
|
|
@@ -116,7 +115,7 @@ var bfinit = function() {
|
|
|
116
115
|
fs.writeFileSync(dest, updatedContent);
|
|
117
116
|
|
|
118
117
|
src = 'page-template/page.js.tmpl';
|
|
119
|
-
dest = 'pages/page-2/
|
|
118
|
+
dest = 'pages/page-2/page-2-route.js';
|
|
120
119
|
var templateContent = fs.readFileSync(`${__dirname}/${src}`);
|
|
121
120
|
var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'page2');
|
|
122
121
|
updatedContent = updatedContent.replace(/PAGE_PATH_GOES_HERE/g, '/page/2');
|
|
@@ -129,7 +128,6 @@ var bfinit = function() {
|
|
|
129
128
|
var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'page2');
|
|
130
129
|
fs.writeFileSync(dest, updatedContent);
|
|
131
130
|
|
|
132
|
-
|
|
133
131
|
src = 'init-template/head.html.tmpl';
|
|
134
132
|
dest = 'client/head.html';
|
|
135
133
|
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
@@ -154,6 +152,10 @@ var bfinit = function() {
|
|
|
154
152
|
dest = 'router/router-security.js';
|
|
155
153
|
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
156
154
|
|
|
155
|
+
src = 'init-template/router-sitemap.js.tmpl';
|
|
156
|
+
dest = 'router/router-sitemap.js';
|
|
157
|
+
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
158
|
+
|
|
157
159
|
// ==============================================
|
|
158
160
|
// END: Copy templates
|
|
159
161
|
// ==============================================
|
|
@@ -176,7 +178,7 @@ var bfinit = function() {
|
|
|
176
178
|
|
|
177
179
|
// Let people know what's going on...
|
|
178
180
|
console.log('File templates copied...');
|
|
179
|
-
console.log('Your project is ready! Yay!!!')
|
|
181
|
+
console.log('Your project is ready! Yay!!!');
|
|
180
182
|
console.log('Have fun coding!!!');
|
|
181
183
|
console.log('=================================');
|
|
182
184
|
|
|
@@ -248,7 +250,7 @@ var bfpage = function() {
|
|
|
248
250
|
fs.writeFileSync(dest, updatedContent);
|
|
249
251
|
|
|
250
252
|
src = 'page-template/page.js.tmpl';
|
|
251
|
-
dest = `pages/${fileName}
|
|
253
|
+
dest = `pages/${fileName}/${fileName}-route.js`;
|
|
252
254
|
var templateContent = fs.readFileSync(`${__dirname}/${src}`);
|
|
253
255
|
var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
|
|
254
256
|
updatedContent = updatedContent.replace(/PAGE_PATH_GOES_HERE/g, pagePath);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WebApp } from 'meteor/webapp';
|
|
2
|
+
|
|
3
|
+
WebApp.connectHandlers.use('/sitemap.txt', (req, res, next) => {
|
|
4
|
+
res.writeHead(200, {'Content-Type': 'text/plain'});
|
|
5
|
+
let sitemapContent = [];
|
|
6
|
+
const baseURL = 'https://www.update-this-in-server-folder.com';
|
|
7
|
+
Bones.sitemap.forEach((route) => {
|
|
8
|
+
if (route.sitemap === true) {
|
|
9
|
+
sitemapContent.push(`${baseURL}${route.path}`);
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
res.end(sitemapContent.join("\n"));
|
|
13
|
+
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
let route = {
|
|
2
|
+
path: 'PAGE_PATH_GOES_HERE',
|
|
3
|
+
name: 'TEMPLATE_NAME_GOES_HERE',
|
|
4
|
+
title: 'PAGE_TITLE_GOES_HERE',
|
|
5
|
+
description: '',
|
|
6
|
+
sitemap: true
|
|
7
|
+
}
|
|
8
|
+
Bones.sitemap.push(route);
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
// WITH OLDER FlowRouter AND Meteor RELEASES
|
|
5
|
-
FlowRouter.decodeQueryParamsOnce = true;
|
|
10
|
+
if (Meteor.isClient) {
|
|
6
11
|
|
|
7
|
-
FlowRouter
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
|
13
|
+
|
|
14
|
+
// DISABLE QUERY STRING COMPATIBILITY
|
|
15
|
+
// WITH OLDER FlowRouter AND Meteor RELEASES
|
|
16
|
+
FlowRouter.decodeQueryParamsOnce = true;
|
|
17
|
+
|
|
18
|
+
// SET ROUTE
|
|
19
|
+
FlowRouter.route(route.path, {
|
|
20
|
+
name: route.name,
|
|
21
|
+
title: route.title,
|
|
22
|
+
meta: {
|
|
23
|
+
description: route.description,
|
|
24
|
+
},
|
|
25
|
+
action() {
|
|
26
|
+
this.render(route.name);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
}
|