Skip to content

Commit 8e206fd

Browse files
author
Mark Murray
committed
module is now global, can be scaffolded with Creating new directory 'projectName'...
Successfully created new project 'projectName'! Next Steps: cd projectName npm install npm start Starts both Sails and the Webpack Dev Server simultaneously now
1 parent 68ba4e6 commit 8e206fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+310
-170
lines changed

.gitignore

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,2 @@
1-
################################################
2-
############### .gitignore ##################
3-
################################################
4-
#
5-
# This file is only relevant if you are using git.
6-
#
7-
# Files which match the splat patterns below will
8-
# be ignored by git. This keeps random crap and
9-
# sensitive credentials from being uploaded to
10-
# your repository. It allows you to configure your
11-
# app for your machine without accidentally
12-
# committing settings which will smash the local
13-
# settings of other developers on your team.
14-
#
15-
# Some reasonable defaults are included below,
16-
# but, of course, you should modify/extend/prune
17-
# to fit your needs!
18-
################################################
19-
20-
21-
22-
23-
################################################
24-
# Local Configuration
25-
#
26-
# Explicitly ignore files which contain:
27-
#
28-
# 1. Sensitive information you'd rather not push to
29-
# your git repository.
30-
# e.g., your personal API keys or passwords.
31-
#
32-
# 2. Environment-specific configuration
33-
# Basically, anything that would be annoying
34-
# to have to change every time you do a
35-
# `git pull`
36-
# e.g., your local development database, or
37-
# the S3 bucket you're using for file uploads
38-
# development.
39-
#
40-
################################################
41-
42-
config/local.js
43-
44-
45-
46-
47-
48-
################################################
49-
# Dependencies
50-
#
51-
# When releasing a production app, you may
52-
# consider including your node_modules and
53-
# bower_components directory in your git repo,
54-
# but during development, its best to exclude it,
55-
# since different developers may be working on
56-
# different kernels, where dependencies would
57-
# need to be recompiled anyway.
58-
#
59-
# More on that here about node_modules dir:
60-
# http://www.futurealoof.com/posts/nodemodules-in-git.html
61-
# (credit Mikeal Rogers, @mikeal)
62-
#
63-
# About bower_components dir, you can see this:
64-
# http://addyosmani.com/blog/checking-in-front-end-dependencies/
65-
# (credit Addy Osmani, @addyosmani)
66-
#
67-
################################################
68-
691
node_modules
70-
bower_components
71-
72-
73-
74-
75-
################################################
76-
# Sails.js / Waterline / Webpack
77-
#
78-
# Files generated by Sails and Grunt, or related
79-
# tasks and adapters.
80-
################################################
81-
.tmp
82-
public/dist
83-
assets.json
84-
dump.rdb
85-
86-
87-
88-
89-
90-
################################################
91-
# Node.js / NPM
92-
#
93-
# Common files generated by Node, NPM, and the
94-
# related ecosystem.
95-
################################################
96-
lib-cov
97-
*.seed
982
*.log
99-
*.out
100-
*.pid
101-
npm-debug.log
102-
103-
104-
105-
106-
107-
################################################
108-
# Miscellaneous
109-
#
110-
# Common files generated by text editors,
111-
# operating systems, file systems, etc.
112-
################################################
113-
114-
*~
115-
*#
116-
.DS_STORE
117-
.netbeans
118-
nbproject
119-
.idea
120-
.node_history

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ A boilerplate for [Sails](http://sailsjs.org) apps with a [React](https://facebo
1313
* [Autoprefixer](https://github.com/passy/autoprefixer-loader)
1414
* [React Hot Loader](https://github.com/gaearon/react-hot-loader)
1515

16-
1716
___
1817

1918
### Clone

bin/sails-react-webpack.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require('../index');

index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const spawn = require('child_process').spawn;
2+
const fs = require('fs');
3+
const ncp = require('ncp');
4+
const inquirer = require('inquirer');
5+
6+
require('colors');
7+
8+
const args = process.argv;
9+
const name = args[2];
10+
11+
if (!name) {
12+
console.error('You must enter a name for your project. `sails-react-webpack ProjectName`'.yellow);
13+
process.exit(0);
14+
}
15+
16+
// CREATE THE DIRECTORY FOR THE PROJECT
17+
console.log(`Creating new directory '${name}'...`.underline);
18+
fs.mkdir(name, (fsError) => {
19+
20+
if (fsError && fsError.code === 'EEXIST') {
21+
console.log('A directory with that name already exists. \nPlease try again with a different name.'.red);
22+
process.exit(0);
23+
}
24+
25+
// COPY THE FOLDER TEMPLATE TO THE NEW PROJECT
26+
ncp(`${__dirname}/template`, `${process.cwd()}/${name}`, (cpError) => {
27+
28+
if (cpError) {
29+
console.log(cpError);
30+
process.exit(0);
31+
}
32+
33+
console.log(`Successfully created new project '${name}'!`.green);
34+
console.log();
35+
console.log('Next Steps:'.blue);
36+
console.log(` cd ${name}`);
37+
console.log(` npm install`);
38+
console.log();
39+
console.log('npm start'.yellow);
40+
console.log(' Starts both Sails and the Webpack Dev Server simultaneously');
41+
console.log();
42+
});
43+
});

package.json

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"private": false,
44
"version": "0.2.0",
55
"description": "A Sails, React & Webpack boilerplate",
6+
"preferGlobal": true,
7+
"bin": {
8+
"sails-react-webpack": "bin/sails-react-webpack.js"
9+
},
610
"engines": {
711
"node": "5.8.0",
812
"npm": ">= 3.7.3"
@@ -13,64 +17,19 @@
1317
"webpack",
1418
"boilerplate"
1519
],
16-
"dependencies": {
17-
"assets-webpack-plugin": "^3.4.0",
18-
"colors": "^1.1.2",
19-
"ejs": "2.3.4",
20-
"foreman": "^1.4.1",
21-
"grunt": "0.4.5",
22-
"grunt-contrib-clean": "0.6.0",
23-
"grunt-contrib-concat": "0.5.1",
24-
"grunt-contrib-copy": "0.5.0",
25-
"grunt-contrib-jst": "0.6.0",
26-
"grunt-contrib-uglify": "0.7.0",
27-
"grunt-sails-linker": "~0.10.1",
28-
"grunt-sync": "0.2.4",
29-
"include-all": "~0.1.6",
30-
"rc": "1.0.1",
31-
"react": "^15.0.1",
32-
"react-dom": "^15.0.1",
33-
"react-router": "^2.3.0",
34-
"sails": "~0.12.2",
35-
"sails-disk": "~0.10.9",
36-
"webpack": "^1.13.0"
37-
},
3820
"scripts": {
39-
"start": "nf start --wrap",
40-
"dev": "node webpackDevServer",
41-
"dist": "NODE_ENV=production webpack -p --config webpack.config.prod.js",
42-
"postinstall": "npm run dist"
21+
"start": "node bin/sails-react-webpack"
4322
},
44-
"main": "app.js",
23+
"main": "index.js",
4524
"repository": {
4625
"type": "git",
4726
"url": "git://github.com/markmur/sails-react-webpack.git"
4827
},
4928
"author": "Mark Murray <mark@boxfish.com>",
5029
"license": "MIT",
51-
"devDependencies": {
52-
"autoprefixer": "^6.3.6",
53-
"autoprefixer-loader": "^3.2.0",
54-
"babel-loader": "^6.2.4",
55-
"babel-plugin-react-html-attrs": "^2.0.0",
56-
"babel-plugin-transform-runtime": "^6.7.5",
57-
"babel-polyfill": "^6.7.4",
58-
"babel-preset-es2015": "^6.6.0",
59-
"babel-preset-react": "^6.5.0",
60-
"babel-preset-stage-0": "^6.5.0",
61-
"chai": "^3.5.0",
62-
"clean-webpack-plugin": "^0.1.9",
63-
"css-loader": "^0.23.1",
64-
"enzyme": "^2.4.1",
65-
"mocha": "^3.0.2",
66-
"node-sass": "^3.4.2",
67-
"precss": "^1.4.0",
68-
"react-addons-test-utils": "^15.0.1",
69-
"react-hot-loader": "^1.3.0",
70-
"sails-hook-autoreload": "^0.13.1",
71-
"sass-loader": "^3.2.0",
72-
"sinon": "^1.17.5",
73-
"style-loader": "^0.13.1",
74-
"webpack-dev-server": "^1.14.1"
30+
"dependencies": {
31+
"colors": "^1.1.2",
32+
"inquirer": "^1.1.3",
33+
"ncp": "^2.0.0"
7534
}
7635
}
File renamed without changes.
File renamed without changes.

template/.gitignore

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
################################################
2+
############### .gitignore ##################
3+
################################################
4+
#
5+
# This file is only relevant if you are using git.
6+
#
7+
# Files which match the splat patterns below will
8+
# be ignored by git. This keeps random crap and
9+
# sensitive credentials from being uploaded to
10+
# your repository. It allows you to configure your
11+
# app for your machine without accidentally
12+
# committing settings which will smash the local
13+
# settings of other developers on your team.
14+
#
15+
# Some reasonable defaults are included below,
16+
# but, of course, you should modify/extend/prune
17+
# to fit your needs!
18+
################################################
19+
20+
21+
22+
23+
################################################
24+
# Local Configuration
25+
#
26+
# Explicitly ignore files which contain:
27+
#
28+
# 1. Sensitive information you'd rather not push to
29+
# your git repository.
30+
# e.g., your personal API keys or passwords.
31+
#
32+
# 2. Environment-specific configuration
33+
# Basically, anything that would be annoying
34+
# to have to change every time you do a
35+
# `git pull`
36+
# e.g., your local development database, or
37+
# the S3 bucket you're using for file uploads
38+
# development.
39+
#
40+
################################################
41+
42+
config/local.js
43+
44+
45+
46+
47+
48+
################################################
49+
# Dependencies
50+
#
51+
# When releasing a production app, you may
52+
# consider including your node_modules and
53+
# bower_components directory in your git repo,
54+
# but during development, its best to exclude it,
55+
# since different developers may be working on
56+
# different kernels, where dependencies would
57+
# need to be recompiled anyway.
58+
#
59+
# More on that here about node_modules dir:
60+
# http://www.futurealoof.com/posts/nodemodules-in-git.html
61+
# (credit Mikeal Rogers, @mikeal)
62+
#
63+
# About bower_components dir, you can see this:
64+
# http://addyosmani.com/blog/checking-in-front-end-dependencies/
65+
# (credit Addy Osmani, @addyosmani)
66+
#
67+
################################################
68+
69+
node_modules
70+
bower_components
71+
72+
73+
74+
75+
################################################
76+
# Sails.js / Waterline / Webpack
77+
#
78+
# Files generated by Sails and Grunt, or related
79+
# tasks and adapters.
80+
################################################
81+
.tmp
82+
public/dist
83+
assets.json
84+
dump.rdb
85+
86+
87+
88+
89+
90+
################################################
91+
# Node.js / NPM
92+
#
93+
# Common files generated by Node, NPM, and the
94+
# related ecosystem.
95+
################################################
96+
lib-cov
97+
*.seed
98+
*.log
99+
*.out
100+
*.pid
101+
npm-debug.log
102+
103+
104+
105+
106+
107+
################################################
108+
# Miscellaneous
109+
#
110+
# Common files generated by text editors,
111+
# operating systems, file systems, etc.
112+
################################################
113+
114+
*~
115+
*#
116+
.DS_STORE
117+
.netbeans
118+
nbproject
119+
.idea
120+
.node_history
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)