Comparing version 1.9.1 to 1.10.0
{ | ||
"name": "nyg-jam3", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "Jam3 project scaffold generator based on nyg", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,6 +22,60 @@ # nyg-jam3 | ||
## Prompts | ||
`What is your name? (Author)` | ||
Default: Jam3 | ||
A name used in the README.md, package.json and humans.txt. | ||
`What is your email? (Author Email)` | ||
Default: td@jam3.com | ||
An email used in the package.json and humans.txt. | ||
`Describe the project:` | ||
Default: A Jam3 project | ||
A brief description of the project that is used at the top of the README.md. | ||
`What is your git repository? (GitHub Repository)` | ||
Default: (empty string) | ||
The git repository used for the project, used within the package.json. | ||
`What framework will your project use?"` | ||
Default: React | ||
The framework that this project will be based on, all necessary files and modules will be downloaded to get you up and running with the selected framework. Currently supports React, Bigwheel, or None. In the case of None, source files won't be created, but all the common development scripts will still be setup. | ||
`Would you perfer Landing/Landing.js over Landing/index.js?` | ||
Default: false | ||
Whether file names will follow the convention of [folder name]/[folder name].js or [folder name]/index.js. | ||
`Use push states?` | ||
Default: true | ||
Whether to use push states in the application, if false, uses hashbangs. This will setup the proper configuration in the framework and the .htaccess file. | ||
`Would you like to use ES6?` | ||
Default: true | ||
Whether to use ES6 and babel transpilation. Sets up a .babelrc file and all necessary dependencies. | ||
`What css preprocessor will your project use?` | ||
Default: SCSS | ||
Which css preprocessor should be setup on the project, defaults to SASS, but LESS is also an option. | ||
`Separate common npm modules into vendor.js?` | ||
Default: true | ||
Whether to separate all npm modules into a separate vender.js file, limiting the bundle.js file to just custom code. | ||
`How would you like to implement an unsupported page redirect?` | ||
Default: PHP | ||
Whether to setup an automatic page redirect for unsupported devices, this will create json file where you can specify which browsers are supported. | ||
`Choose the password to use for password protection. (leave blank to disable)` | ||
Default: (empty string) | ||
If you want to enable password protection via .htaccess, simply type the password you would like to use and the .htaccess and .htpasswd files will be created. | ||
`Where on the server will your .htpasswd be located?` | ||
Default: /var/www | ||
If you opted to add password protection, this will need to be set to the location of the .htpasswd file in your production environment. | ||
## Setup Favicons | ||
#### Default setup | ||
After generate the scaffolding, you will have already setup the favicons for all the common devices, including those with iOS, Android, Windows Phone and for desktop version. | ||
After generating the scaffolding, you will have favicons setup for all the common devices (iOS, Android, Windows Phone and Desktop) | ||
@@ -33,6 +87,2 @@ #### Customize | ||
**Note:** | ||
If you run the project on dev you won't see them because `budo` is creating an own `index.html`. If you run `npm run release` you will see all this properly working. | ||
## Preloader (React component) | ||
@@ -42,3 +92,3 @@ Preloader Rect component is built on the top of [preloader module](https://www.npmjs.com/package/preloader). Please refer to it for more information. | ||
#### Setup | ||
Specify files or folders (to be read recursively) in `config-preloader.json` in the root of the project. | ||
Specify files or folders (to be read recursively) using glob format in `config-preloader.json` in the root of the project. | ||
Example preloader json file: | ||
@@ -45,0 +95,0 @@ ``` |
@@ -10,2 +10,3 @@ { | ||
"ASSET_PATH": "./assets/", | ||
"JPEG_QUALITY": 80, | ||
"templateBlacklist": [], | ||
@@ -18,2 +19,3 @@ "htpasswd": {{#if password}}"{{passLocation}}"{{else}}false{{/if}} | ||
"production": { | ||
"timestamp": true, | ||
"output": "./release/", | ||
@@ -20,0 +22,0 @@ "minify": true, |
@@ -14,5 +14,5 @@ { | ||
"style": "node scripts/style.js", | ||
"preloader": "node scripts/preloader.js", | ||
"dev": "node scripts/dev.js", | ||
"preloader": "node scripts/preloader.js", | ||
"release": "npm run preloader-release && npm run release-clean && npm run release-style && npm run release-browserify && npm run release-copy && npm run release-gzip", | ||
"release": "node scripts/timestamp.js && npm run preloader-release && npm run release-clean && npm run release-style && npm run release-browserify && npm run release-copy && npm run release-gzip && node scripts/timestamp.js --delete", | ||
"preloader-release": "node scripts/preloader.js --env=production", | ||
@@ -74,2 +74,3 @@ "release-style": "node scripts/style.js --env=production", | ||
"rfg-api": "^0.1.7", | ||
"mozjpeg": "^4.1.1", | ||
"pngquant-bin": "^3.0.0", | ||
@@ -76,0 +77,0 @@ "uglify-js": "^2.6.1", |
'use strict'; | ||
var fs = require('fs'); | ||
var merge = require('merge'); | ||
@@ -7,3 +8,22 @@ var argv = require('minimist')(process.argv.slice(2)); | ||
var config = merge.recursive(configs.defaults, configs[type]); | ||
var path = require('path'); | ||
config.stylesheet = path.parse(config.style).name + '.css'; | ||
if (type==='production' && config.timestamp) { | ||
var delimiter = '-'; | ||
var stamp = typeof config.timestamp === 'string' ? config.timestamp : fs.readFileSync('timestamp.txt'); | ||
if (stamp) { | ||
var stamp = delimiter + stamp; | ||
config.stylesheet = path.parse(config.style).name.split(delimiter)[0] + stamp + '.css'; | ||
config.bundle = path.parse(config.bundle).name.split(delimiter)[0] + stamp + '.js'; | ||
if (config.vendor) config.vendor = path.parse(config.vendor).name.split(delimiter)[0] + stamp + '.js'; | ||
var parsed = path.parse(config.ASSET_PATH); | ||
config.ASSET_PATH = path.join(parsed.dir, parsed.base+stamp); | ||
} | ||
} | ||
config.NODE_ENV = type; | ||
module.exports = config; | ||
module.exports = config; |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var pngquant = require('pngquant-bin'); | ||
var mozjpeg = require('mozjpeg'); | ||
var render = require("./template"); | ||
@@ -16,8 +17,9 @@ var isbinaryfile = require('isbinaryfile'); | ||
function copy(file) { | ||
var assets = config.ASSET_PATH; | ||
if (file) { | ||
copyFile(path.join(config.output,'assets/'),config.raw,file); | ||
copyFile(path.join(config.output,assets),config.raw,file); | ||
} else { | ||
glob(path.join(config.raw,'**/*'),{dot: true, nodir: true},function(err,files) { | ||
if (!err) { | ||
files.forEach(copyFile.bind(null,path.join(config.output,'assets/'),config.raw)); | ||
files.forEach(copyFile.bind(null,path.join(config.output,assets),config.raw)); | ||
} else { | ||
@@ -48,6 +50,10 @@ console.log(err); | ||
if (!err) { | ||
if (config.NODE_ENV==='production' && file.indexOf('.png')>-1){ | ||
if (config.NODE_ENV==='production' && file.toLowerCase().indexOf('.png')>-1){ | ||
execFile(pngquant, ['-o', output, file], function (err) { | ||
if (err) stream(file,output); | ||
}); | ||
} else if (config.NODE_ENV==='production' && (config.JPEG_QUALITY!==false && !isNaN(config.JPEG_QUALITY)) && (file.toLowerCase().indexOf('.jpg')>-1 || file.toLowerCase().indexOf('.jpeg')>-1)) { | ||
execFile(mozjpeg, ['-quality', config.JPEG_QUALITY, '-outfile', output, file], function (err) { | ||
if (err) stream(file,output); | ||
}); | ||
} else if(srcDir === config.static && !isBlacklisted(file) && !isbinaryfile.sync(file)) { | ||
@@ -54,0 +60,0 @@ template(file,output); |
{ | ||
"masterPicture": "favicon_template.png", | ||
"iconsPath": "/assets/images/favicons", | ||
"iconsPath": "\{{ASSET_PATH}}images/favicons", | ||
"design": { | ||
@@ -5,0 +5,0 @@ "ios": { |
@@ -68,2 +68,5 @@ var rfg = require('rfg-api').init(); | ||
}); | ||
fs.exists(path.join(config.static,'unsupported.html'),function(exists) { | ||
if (exists) fav.inject(path.join(config.static,'unsupported.html')); | ||
}); | ||
}); | ||
@@ -70,0 +73,0 @@ } else { |
@@ -14,2 +14,7 @@ 'use strict'; | ||
var lessOutput = path.basename(config.style).replace('.less','.css'); | ||
if (config.NODE_ENV === 'production') { | ||
lessOutput = config.stylesheet; | ||
} | ||
var createLess = function(callback) { | ||
@@ -16,0 +21,0 @@ if (running) return; |
@@ -15,2 +15,6 @@ 'use strict'; | ||
if (config.NODE_ENV === 'production') { | ||
sassOutput = config.stylesheet; | ||
} | ||
var createSass = function (callback) { | ||
@@ -17,0 +21,0 @@ if (running) return; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
241586
89
1726
129
18