bones-cli 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 meteorhubdotnet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # bones-cli
2
+
3
+ Command line tools for Bones - a rapid development framework for web apps with MeteorJS & Blaze templates.
4
+
5
+ For more info, go to the main project page:
6
+
7
+ https://github.com/meteorhubdotnet/bones
package/bin/fscoll ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../index').bfcoll();
package/bin/fscomp ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../index').bfcomp();
package/bin/fsinit ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../index').bfinit();
package/bin/fspage ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../index').fspage();
@@ -0,0 +1,44 @@
1
+ class COLLECTION_CLASS_NAME_GOES_HERECollection extends Mongo.Collection {
2
+
3
+ insert(data, callback) {
4
+
5
+ return super.insert(data, callback);
6
+
7
+ }
8
+
9
+ update(selector, data, callback) {
10
+
11
+ return super.update(selector, data, callback);
12
+
13
+ }
14
+
15
+ remove(selector, callback) {
16
+
17
+ return super.remove(selector, callback);
18
+
19
+ }
20
+
21
+ }
22
+
23
+ COLLECTION_CLASS_NAME_GOES_HERE = new COLLECTION_CLASS_NAME_GOES_HERECollection('COLLECTION_NAME_GOES_HERE');
24
+
25
+ COLLECTION_CLASS_NAME_GOES_HERE.allow({
26
+
27
+ insert(userId, doc) {
28
+ // The user must be logged in and the document must be owned by the user.
29
+ return userId && doc.userId === userId;
30
+ },
31
+ update(userId, doc, fields, modifier) {
32
+ // Can only change your own documents.
33
+ return doc.userId === userId;
34
+ },
35
+ remove(userId, doc) {
36
+ // Can only remove your own documents.
37
+ return doc.userId === userId;
38
+ },
39
+ // Only fetch userId from the database to improve performance
40
+ fetch: ['userId']
41
+
42
+ });
43
+
44
+
@@ -0,0 +1,77 @@
1
+ MODEL_CLASS_NAME_GOES_HERE = class {
2
+
3
+ constructor({ data, id } = {}) {
4
+
5
+ let model = data || {};
6
+
7
+ // check for email or user ID or userSlug
8
+ if (id) {
9
+
10
+ model = COLLECTION_CLASS_NAME_GOES_HERE.findOne({ _id: id });
11
+
12
+ }
13
+
14
+
15
+ // Set members of object
16
+ if (model) {
17
+
18
+ const modelProperties = Object.keys(model);
19
+ for (let i = 0; i < modelProperties.length; i += 1) {
20
+
21
+ const prop = modelProperties[i];
22
+ this[prop] = model[prop];
23
+
24
+ }
25
+
26
+ }
27
+
28
+ }
29
+
30
+ /**
31
+ * Assigns data values to members
32
+ * @param data
33
+ */
34
+ populate({ data }) {
35
+
36
+ if (data) {
37
+
38
+ Object.assign(this, data);
39
+
40
+ }
41
+
42
+ }
43
+
44
+ save() {
45
+
46
+ if (this._id) {
47
+
48
+ return this.update();
49
+
50
+ } else {
51
+
52
+ return this.create();
53
+
54
+ }
55
+
56
+ }
57
+
58
+ create() {
59
+
60
+ this._id = COLLECTION_CLASS_NAME_GOES_HERE.insert(this);
61
+ return !!this._id;
62
+
63
+ }
64
+
65
+ update() {
66
+
67
+ return COLLECTION_CLASS_NAME_GOES_HERE.update({ _id: this._id }, { $set: this });
68
+
69
+ }
70
+
71
+ remove() {
72
+
73
+ return COLLECTION_CLASS_NAME_GOES_HERE.remove({ _id: this._id });
74
+
75
+ }
76
+
77
+ }
@@ -0,0 +1,5 @@
1
+ Meteor.methods({
2
+
3
+ TEMPLATE_NAME_GOES_HERE() {},
4
+
5
+ });
@@ -0,0 +1 @@
1
+ Meteor.publish('TEMPLATE_NAME_GOES_HERE', function() {});
@@ -0,0 +1,5 @@
1
+ .FILE_NAME_GOES_HERE{
2
+
3
+
4
+
5
+ }
@@ -0,0 +1,9 @@
1
+ <template name="TEMPLATE_NAME_GOES_HERE">
2
+
3
+ <div class="FILE_NAME_GOES_HERE">
4
+
5
+ <h1>TEMPLATE_NAME_GOES_HERE</h1>
6
+
7
+ </div>
8
+
9
+ </template>
@@ -0,0 +1,36 @@
1
+ import { Template } from 'meteor/templating';
2
+
3
+ /**
4
+ * =============================================================
5
+ * TEMPLATE CREATED
6
+ * =============================================================
7
+ */
8
+ Template.TEMPLATE_NAME_GOES_HERE.onCreated(function() {});
9
+
10
+ /**
11
+ * =============================================================
12
+ * TEMPLATE RENDERED
13
+ * =============================================================
14
+ */
15
+ Template.TEMPLATE_NAME_GOES_HERE.onRendered(function() {});
16
+
17
+ /**
18
+ * =============================================================
19
+ * TEMPLATE DESTROYED
20
+ * =============================================================
21
+ */
22
+ Template.TEMPLATE_NAME_GOES_HERE.onDestroyed(function() {});
23
+
24
+ /**
25
+ * =============================================================
26
+ * TEMPLATE EVENTS
27
+ * =============================================================
28
+ */
29
+ Template.TEMPLATE_NAME_GOES_HERE.events({});
30
+
31
+ /**
32
+ * =============================================================
33
+ * TEMPLATE HELPERS
34
+ * =============================================================
35
+ */
36
+ Template.TEMPLATE_NAME_GOES_HERE.helpers({});
package/index.js ADDED
@@ -0,0 +1,433 @@
1
+ // Import the filesystem module
2
+ var fs = require('fs');
3
+
4
+ // bfinit: CLI command to set up the files in a new project
5
+ // bf stands for Bones Framework
6
+ var bfinit = function() {
7
+
8
+
9
+ // Let people know what's going on...
10
+ console.log('=================================');
11
+ console.log('Setting up Bones Framework project.....');
12
+
13
+ // ==============================================
14
+ // START: Create Directories
15
+ // ==============================================
16
+
17
+ // Init dir var
18
+ var d;
19
+
20
+ d = 'pages';
21
+ fs.mkdirSync(d);
22
+
23
+ d = 'components';
24
+ fs.mkdirSync(d);
25
+
26
+ d = 'router';
27
+ fs.mkdirSync(d);
28
+
29
+ d = 'lib';
30
+ fs.mkdirSync(d);
31
+
32
+ d = 'client/layouts';
33
+ fs.mkdirSync(d);
34
+
35
+ d = 'pages/page-home';
36
+ fs.mkdirSync(d);
37
+
38
+ d = 'pages/page-home/client';
39
+ fs.mkdirSync(d);
40
+
41
+ d = 'pages/page-home/server';
42
+ fs.mkdirSync(d);
43
+
44
+ d = 'pages/page-2';
45
+ fs.mkdirSync(d);
46
+
47
+ d = 'pages/page-2/client';
48
+ fs.mkdirSync(d);
49
+
50
+ d = 'pages/page-2/server';
51
+ fs.mkdirSync(d);
52
+
53
+ console.log('Directories created...');
54
+
55
+ // ==============================================
56
+ // END: Create Directories
57
+ // ==============================================
58
+
59
+ // Init variables to copy template files
60
+ var src;
61
+ var dest;
62
+
63
+ // ==============================================
64
+ // START: Copy templates
65
+ // ==============================================
66
+
67
+ src = 'page-template/page-home.html.tmpl';
68
+ dest = 'pages/page-home/client/page-home.html';
69
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
70
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'pageHome');
71
+ updatedContent = updatedContent.replace(/FILE_NAME_GOES_HERE/g, 'page-home');
72
+ fs.writeFileSync(dest, updatedContent);
73
+
74
+ src = 'page-template/page.css.tmpl';
75
+ dest = 'pages/page-home/client/page-home.css';
76
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
77
+ var updatedContent = templateContent.toString().replace(/FILE_NAME_GOES_HERE/g, 'page-home');
78
+ fs.writeFileSync(dest, updatedContent);
79
+
80
+ src = 'page-template/page.js.tmpl';
81
+ dest = 'pages/page-home/page-home-route.js';
82
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
83
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'pageHome');
84
+ updatedContent = updatedContent.replace(/PAGE_PATH_GOES_HERE/g, '/');
85
+ updatedContent = updatedContent.replace(/PAGE_TITLE_GOES_HERE/g, 'Homepage');
86
+ fs.writeFileSync(dest, updatedContent);
87
+
88
+ src = 'page-template/page-publications.js.tmpl';
89
+ dest = 'pages/page-home/server/page-home-publications.js';
90
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
91
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'pageHome');
92
+ fs.writeFileSync(dest, updatedContent);
93
+
94
+ src = 'page-template/page-2.html.tmpl';
95
+ dest = 'pages/page-2/client/page-2.html';
96
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
97
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'page2');
98
+ updatedContent = updatedContent.replace(/FILE_NAME_GOES_HERE/g, 'page-2');
99
+ fs.writeFileSync(dest, updatedContent);
100
+
101
+ src = 'page-template/page.css.tmpl';
102
+ dest = 'pages/page-2/client/page-2.css';
103
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
104
+ var updatedContent = templateContent.toString().replace(/FILE_NAME_GOES_HERE/g, 'page-2');
105
+ fs.writeFileSync(dest, updatedContent);
106
+
107
+ src = 'page-template/page.js.tmpl';
108
+ dest = 'pages/page-2/page-2-route.js';
109
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
110
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'page2');
111
+ updatedContent = updatedContent.replace(/PAGE_PATH_GOES_HERE/g, '/page/2');
112
+ updatedContent = updatedContent.replace(/PAGE_TITLE_GOES_HERE/g, 'Page 2');
113
+ fs.writeFileSync(dest, updatedContent);
114
+
115
+ src = 'page-template/page-publications.js.tmpl';
116
+ dest = 'pages/page-2/server/page-2-publications.js';
117
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
118
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, 'page2');
119
+ fs.writeFileSync(dest, updatedContent);
120
+
121
+
122
+ src = 'init-template/head.html.tmpl';
123
+ dest = 'client/head.html';
124
+ fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
125
+
126
+ src = 'init-template/layout.html.tmpl';
127
+ dest = 'client/layouts/layout.html';
128
+ fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
129
+
130
+ src = 'init-template/layout.css.tmpl';
131
+ dest = 'client/layouts/layout.css';
132
+ fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
133
+
134
+ src = 'init-template/layout.js.tmpl';
135
+ dest = 'client/layouts/layout.js';
136
+ fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
137
+
138
+ src = 'init-template/router-options.js.tmpl';
139
+ dest = 'router/router-options.js';
140
+ fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
141
+
142
+ src = 'init-template/router-security.js.tmpl';
143
+ dest = 'router/router-security.js';
144
+ fs.copyFileSync(`${__dirname}/${src}`, dest, fs.constants.COPYFILE_EXCL);
145
+
146
+ // ==============================================
147
+ // END: Copy templates
148
+ // ==============================================
149
+
150
+ // remove default Meteor files on the client
151
+ fs.unlinkSync('client/main.html');
152
+ fs.unlinkSync('client/main.js');
153
+ fs.unlinkSync('client/main.css');
154
+
155
+ // create empty files
156
+ fs.open('client/main.css', 'w', (error, file) => { if (error) { return console.log(error); } });
157
+ fs.open('client/main.js', 'w', (error, file) => { if (error) { return console.log(error); } });
158
+
159
+ // Search-and-replace magic to use Meteor file autoloading
160
+ src = 'package.json';
161
+ var templateContent = fs.readFileSync(src);
162
+ fs.unlinkSync(src);
163
+ var updatedContent = templateContent.toString().replace(/mainModule/g, 'meteor_main_module_turnedOffByBonesFramework');
164
+ fs.writeFileSync(src, updatedContent);
165
+
166
+ // Let people know what's going on...
167
+ console.log('File templates copied...');
168
+ console.log('Your project is ready! Yay!!!')
169
+ console.log('Have fun coding!!!');
170
+ console.log('=================================');
171
+
172
+ };
173
+
174
+
175
+ var bfpage = function() {
176
+
177
+ // Let people know what's going on...
178
+ console.log('=================================');
179
+ console.log('Creating new page .....');
180
+
181
+ // ==============================================
182
+ // START: Check arguments
183
+ // ==============================================
184
+
185
+ var myArgs = process.argv.slice(2);
186
+ if (!myArgs[0] || !myArgs[1]) {
187
+ console.log('Missing arguments. Expected syntax:');
188
+ console.log('bfpage fileName pageName [pageTitle] [pagePath]');
189
+ return;
190
+ }
191
+ var fileName = myArgs[0];
192
+ var componentName = myArgs[1];
193
+ var pageTitle = myArgs[2] ? myArgs[2] : 'PAGE_TITLE_GOES_HERE';
194
+ var pagePath = myArgs[3] ? myArgs[3] : '/page/path/goes/here';
195
+
196
+ // ==============================================
197
+ // END: Check arguments
198
+ // ==============================================
199
+
200
+ // ==============================================
201
+ // START: Create Directories
202
+ // ==============================================
203
+
204
+ // Init dir var
205
+ var d;
206
+
207
+ d = `pages/${fileName}`;
208
+ fs.mkdirSync(d);
209
+
210
+ d = `pages/${fileName}/client`;
211
+ fs.mkdirSync(d);
212
+
213
+ d = `pages/${fileName}/server`;
214
+ fs.mkdirSync(d);
215
+
216
+ // ==============================================
217
+ // END: Create Directories
218
+ // ==============================================
219
+
220
+ // ==============================================
221
+ // START: Copy templates
222
+ // ==============================================
223
+
224
+ var src;
225
+ var dest;
226
+
227
+ src = 'page-template/page.html.tmpl';
228
+ dest = `pages/${fileName}/client/${fileName}.html`;
229
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
230
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
231
+ updatedContent = updatedContent.replace(/FILE_NAME_GOES_HERE/g, fileName);
232
+ fs.writeFileSync(dest, updatedContent);
233
+
234
+ src = 'page-template/page.js.tmpl';
235
+ dest = `pages/${fileName}/${fileName}.js`;
236
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
237
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
238
+ updatedContent = updatedContent.replace(/PAGE_PATH_GOES_HERE/g, pagePath);
239
+ updatedContent = updatedContent.replace(/PAGE_TITLE_GOES_HERE/g, pageTitle);
240
+ fs.writeFileSync(dest, updatedContent);
241
+
242
+ src = 'page-template/page.css.tmpl';
243
+ dest = `pages/${fileName}/client/${fileName}.css`;
244
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
245
+ var updatedContent = templateContent.toString().replace(/FILE_NAME_GOES_HERE/g, fileName);
246
+ fs.writeFileSync(dest, updatedContent);
247
+
248
+ src = 'page-template/page-publications.js.tmpl';
249
+ dest = `pages/${fileName}/server/${fileName}-publications.js`;
250
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
251
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
252
+ fs.writeFileSync(dest, updatedContent);
253
+
254
+ // ==============================================
255
+ // END: Copy templates
256
+ // ==============================================
257
+
258
+ // Let people know what's going on...
259
+ console.log('File templates copied...');
260
+ console.log('Done creating new page!');
261
+ console.log('=================================');
262
+
263
+ };
264
+
265
+ var bfcomp = function() {
266
+
267
+ // Let people know what's going on...
268
+ console.log('=================================');
269
+ console.log('Creating new component .....');
270
+
271
+ // ==============================================
272
+ // START: Check arguments
273
+ // ==============================================
274
+
275
+ var myArgs = process.argv.slice(2);
276
+ if (!myArgs[0] || !myArgs[1]) {
277
+ console.log('Missing arguments. Expected syntax:');
278
+ console.log('bfcomp fileName componentName');
279
+ return;
280
+ }
281
+ var fileName = myArgs[0];
282
+ var componentName = myArgs[1];
283
+
284
+ // ==============================================
285
+ // END: Check arguments
286
+ // ==============================================
287
+
288
+ // ==============================================
289
+ // START: Create Directories
290
+ // ==============================================
291
+
292
+ // Init dir var
293
+ var d;
294
+
295
+ d = `components/${fileName}`;
296
+ fs.mkdirSync(d);
297
+
298
+ d = `components/${fileName}/client`;
299
+ fs.mkdirSync(d);
300
+
301
+ d = `components/${fileName}/server`;
302
+ fs.mkdirSync(d);
303
+
304
+ // ==============================================
305
+ // END: Create Directories
306
+ // ==============================================
307
+
308
+ // ==============================================
309
+ // START: Copy templates
310
+ // ==============================================
311
+
312
+ var src;
313
+ var dest;
314
+
315
+ src = 'component-template/component.html.tmpl';
316
+ dest = `components/${fileName}/client/${fileName}.html`;
317
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
318
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
319
+ updatedContent = updatedContent.replace(/FILE_NAME_GOES_HERE/g, fileName);
320
+ fs.writeFileSync(dest, updatedContent);
321
+
322
+ src = 'component-template/component.js.tmpl';
323
+ dest = `components/${fileName}/client/${fileName}.js`;
324
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
325
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
326
+ fs.writeFileSync(dest, updatedContent);
327
+
328
+ src = 'component-template/component.css.tmpl';
329
+ dest = `components/${fileName}/client/${fileName}.css`;
330
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
331
+ var updatedContent = templateContent.toString().replace(/FILE_NAME_GOES_HERE/g, fileName);
332
+ fs.writeFileSync(dest, updatedContent);
333
+
334
+ src = 'component-template/component-publications.js.tmpl';
335
+ dest = `components/${fileName}/server/${fileName}-publications.js`;
336
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
337
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
338
+ fs.writeFileSync(dest, updatedContent);
339
+
340
+ src = 'component-template/component-methods.js.tmpl';
341
+ dest = `components/${fileName}/server/${fileName}-methods.js`;
342
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
343
+ var updatedContent = templateContent.toString().replace(/TEMPLATE_NAME_GOES_HERE/g, componentName);
344
+ fs.writeFileSync(dest, updatedContent);
345
+
346
+ // ==============================================
347
+ // END: Copy templates
348
+ // ==============================================
349
+
350
+ // Let people know what's going on...
351
+ console.log('File templates copied...');
352
+ console.log('Done creating new component!');
353
+ console.log('=================================');
354
+
355
+ };
356
+
357
+ var bfcoll = function() {
358
+
359
+ // Let people know what's going on...
360
+ console.log('=================================');
361
+ console.log('Creating new collection and model .....');
362
+
363
+ // ==============================================
364
+ // START: Check arguments
365
+ // ==============================================
366
+
367
+ var myArgs = process.argv.slice(2);
368
+ if (!myArgs[0] || !myArgs[1] || !myArgs[2] || !myArgs[3]) {
369
+ console.log('Missing arguments. Expected syntax:');
370
+ console.log('bfcoll fileName collectionName collectionClassName modelClassName');
371
+ return;
372
+ }
373
+ var fileName = myArgs[0];
374
+ var collectionName = myArgs[1];
375
+ var collectionClassName = myArgs[2];
376
+ var modelClassName = myArgs[3];
377
+
378
+ // ==============================================
379
+ // END: Check arguments
380
+ // ==============================================
381
+
382
+ // ==============================================
383
+ // START: Create Directories
384
+ // ==============================================
385
+
386
+ // Init dir var
387
+ var d;
388
+
389
+ d = `lib/${fileName}`;
390
+ fs.mkdirSync(d);
391
+
392
+ // ==============================================
393
+ // END: Create Directories
394
+ // ==============================================
395
+
396
+ // ==============================================
397
+ // START: Copy templates
398
+ // ==============================================
399
+
400
+ var src;
401
+ var dest;
402
+
403
+ src = 'coll-template/collection.js.tmpl';
404
+ dest = `lib/${fileName}/${fileName}-collection.js`;
405
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
406
+ var updatedContent = templateContent.toString().replace(/COLLECTION_NAME_GOES_HERE/g, collectionName);
407
+ updatedContent = updatedContent.replace(/COLLECTION_CLASS_NAME_GOES_HERE/g, collectionClassName);
408
+ updatedContent = updatedContent.replace(/MODEL_CLASS_NAME_GOES_HERE/g, modelClassName);
409
+ fs.writeFileSync(dest, updatedContent);
410
+
411
+ src = 'coll-template/model.js.tmpl';
412
+ dest = `lib/${fileName}/${fileName}-model.js`;
413
+ var templateContent = fs.readFileSync(`${__dirname}/${src}`);
414
+ var updatedContent = templateContent.toString().replace(/COLLECTION_NAME_GOES_HERE/g, collectionName);
415
+ updatedContent = updatedContent.replace(/COLLECTION_CLASS_NAME_GOES_HERE/g, collectionClassName);
416
+ updatedContent = updatedContent.replace(/MODEL_CLASS_NAME_GOES_HERE/g, modelClassName);
417
+ fs.writeFileSync(dest, updatedContent);
418
+
419
+ // ==============================================
420
+ // END: Copy templates
421
+ // ==============================================
422
+
423
+ // Let people know what's going on...
424
+ console.log('File templates copied...');
425
+ console.log('Done creating new collection and model!');
426
+ console.log('=================================');
427
+
428
+ };
429
+
430
+ exports.bfinit = bfinit;
431
+ exports.bfpage = bfpage;
432
+ exports.bfcomp = bfcomp;
433
+ exports.bfcoll = bfcoll;
@@ -0,0 +1,5 @@
1
+ <head>
2
+ <title>My App :: Built With Bones Framework</title>
3
+ <meta name="My App :: Built With Bones Framework">
4
+ <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
5
+ </head>
@@ -0,0 +1,3 @@
1
+ .layout {
2
+
3
+ }
@@ -0,0 +1,5 @@
1
+ <template name="layout">
2
+ <div class="layout">
3
+ {{>yield}}
4
+ </div>
5
+ </template>
@@ -0,0 +1,36 @@
1
+ import { Template } from 'meteor/templating';
2
+
3
+ /**
4
+ * =============================================================
5
+ * TEMPLATE CREATED
6
+ * =============================================================
7
+ */
8
+ Template.layout.onCreated(function() {});
9
+
10
+ /**
11
+ * =============================================================
12
+ * TEMPLATE RENDERED
13
+ * =============================================================
14
+ */
15
+ Template.layout.onRendered(function() {});
16
+
17
+ /**
18
+ * =============================================================
19
+ * TEMPLATE DESTROYED
20
+ * =============================================================
21
+ */
22
+ Template.layout.onDestroyed(function() {});
23
+
24
+ /**
25
+ * =============================================================
26
+ * TEMPLATE EVENTS
27
+ * =============================================================
28
+ */
29
+ Template.layout.events({});
30
+
31
+ /**
32
+ * =============================================================
33
+ * TEMPLATE HELPERS
34
+ * =============================================================
35
+ */
36
+ Template.layout.helpers({});
File without changes
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "bones-cli",
3
+ "version": "0.0.1",
4
+ "description": "Command line tools for Bones - a rapid development framework for web apps with MeteorJS & Blaze templates",
5
+ "keywords": [
6
+ "cli",
7
+ "bones",
8
+ "meteor",
9
+ "blaze"
10
+ ],
11
+ "homepage": "https://github.com/meteorhubdotnet/bones-cli#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/meteorhubdotnet/bones-cli/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/meteorhubdotnet/bones-cli.git"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Yacine Merzouk <yacine@merzouk.ca> (https://yacine.merzouk.ca)",
21
+ "type": "commonjs",
22
+ "main": "index.js",
23
+ "bin": {
24
+ "fsinit": "bin/fsinit",
25
+ "fspage": "bin/fspage",
26
+ "fscomp": "bin/fscomp",
27
+ "fscoll": "bin/fscoll"
28
+ },
29
+ "scripts": {
30
+ "test": "echo \"Error: no test specified\" && exit 1"
31
+ }
32
+ }
@@ -0,0 +1,17 @@
1
+ <template name="page2">
2
+
3
+ <main class="content">
4
+
5
+ <div class="page page-2">
6
+
7
+ <h1>PAGE 2</h1>
8
+
9
+ <p>
10
+ <a href="/">Go to homepage</a>
11
+ </p>
12
+
13
+ </div>
14
+
15
+ </main>
16
+
17
+ </template>
@@ -0,0 +1,17 @@
1
+ <template name="pageHome">
2
+
3
+ <main class="content">
4
+
5
+ <div class="page page-home">
6
+
7
+ <h1>HOMEPAGE</h1>
8
+
9
+ <p>
10
+ <a href="/page/2">Go to page 2</a>
11
+ </p>
12
+
13
+ </div>
14
+
15
+ </main>
16
+
17
+ </template>
@@ -0,0 +1,4 @@
1
+ Meteor.publish('TEMPLATE_NAME_GOES_HERE', function() {
2
+
3
+
4
+ });
@@ -0,0 +1,3 @@
1
+ .FILE_NAME_GOES_HERE {
2
+
3
+ }
@@ -0,0 +1,13 @@
1
+ <template name="TEMPLATE_NAME_GOES_HERE">
2
+
3
+ <main class="content">
4
+
5
+ <div class="page FILE_NAME_GOES_HERE">
6
+
7
+ <h1>TEMPLATE_NAME_GOES_HERE</h1>
8
+
9
+ </div>
10
+
11
+ </main>
12
+
13
+ </template>
@@ -0,0 +1 @@
1
+