bones-cli 0.0.7 → 0.0.9
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 +12 -6
- package/init-template/bones.js.tmpl +2 -0
- 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);
|
|
@@ -146,6 +144,10 @@ var bfinit = function() {
|
|
|
146
144
|
dest = 'client/layouts/layout.js';
|
|
147
145
|
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
148
146
|
|
|
147
|
+
src = 'init-template/bones.js.tmpl';
|
|
148
|
+
dest = 'lib/bones.js';
|
|
149
|
+
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
150
|
+
|
|
149
151
|
src = 'init-template/router-options.js.tmpl';
|
|
150
152
|
dest = 'router/router-options.js';
|
|
151
153
|
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
@@ -154,6 +156,10 @@ var bfinit = function() {
|
|
|
154
156
|
dest = 'router/router-security.js';
|
|
155
157
|
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
156
158
|
|
|
159
|
+
src = 'init-template/router-sitemap.js.tmpl';
|
|
160
|
+
dest = 'router/router-sitemap.js';
|
|
161
|
+
fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
|
|
162
|
+
|
|
157
163
|
// ==============================================
|
|
158
164
|
// END: Copy templates
|
|
159
165
|
// ==============================================
|
|
@@ -176,7 +182,7 @@ var bfinit = function() {
|
|
|
176
182
|
|
|
177
183
|
// Let people know what's going on...
|
|
178
184
|
console.log('File templates copied...');
|
|
179
|
-
console.log('Your project is ready! Yay!!!')
|
|
185
|
+
console.log('Your project is ready! Yay!!!');
|
|
180
186
|
console.log('Have fun coding!!!');
|
|
181
187
|
console.log('=================================');
|
|
182
188
|
|
|
@@ -248,7 +254,7 @@ var bfpage = function() {
|
|
|
248
254
|
fs.writeFileSync(dest, updatedContent);
|
|
249
255
|
|
|
250
256
|
src = 'page-template/page.js.tmpl';
|
|
251
|
-
dest = `pages/${fileName}
|
|
257
|
+
dest = `pages/${fileName}/${fileName}-route.js`;
|
|
252
258
|
var templateContent = fs.readFileSync(`${__dirname}/${src}`);
|
|
253
259
|
var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
|
|
254
260
|
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
|
+
}
|