fix things I fixed before and that were overwritten
parent
42489ad574
commit
8025aa45ff
10
Gruntfile.js
10
Gruntfile.js
|
@ -12,12 +12,10 @@
|
|||
* For more information see:
|
||||
* https://sailsjs.com/anatomy/Gruntfile.js
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
var loadGruntTasks = require('sails-hook-grunt/accessible/load-grunt-tasks');
|
||||
module.exports = function (grunt) {
|
||||
var loadGruntTasks = require('sails-hook-grunt/accessible/load-grunt-tasks')
|
||||
|
||||
// Load Grunt task configurations (from `tasks/config/`) and Grunt
|
||||
// task registrations (from `tasks/register/`).
|
||||
loadGruntTasks(__dirname, grunt);
|
||||
|
||||
};
|
||||
loadGruntTasks(__dirname, grunt)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* @help :: See https://sailsjs.com/docs/concepts/actions
|
||||
*/
|
||||
|
||||
const HttpError = require('../errors/HttpError')
|
||||
|
||||
module.exports = {
|
||||
publish: async function (req, res) {
|
||||
try {
|
||||
|
@ -12,13 +14,13 @@ module.exports = {
|
|||
const host = req.hostname
|
||||
let result
|
||||
|
||||
if (!host) throw new Error('Missing hostname')
|
||||
if (!body) throw new Error('Missing body')
|
||||
if (!host) throw new HttpError(400, 'Missing hostname')
|
||||
if (!body) throw new HttpError(400, 'Missing body')
|
||||
|
||||
const bookExists = await Book.findOne(body)
|
||||
|
||||
if (bookExists) {
|
||||
throw new Error('Version already exists')
|
||||
throw new HttpError(400, 'Version already exists')
|
||||
} else {
|
||||
result = await Book.create(body)
|
||||
}
|
||||
|
@ -35,7 +37,8 @@ module.exports = {
|
|||
})
|
||||
})
|
||||
} catch (e) {
|
||||
return res.status(400).json({
|
||||
if (e instanceof HttpError) return e.send(res)
|
||||
return res.status(500).json({
|
||||
error: e.message
|
||||
})
|
||||
}
|
||||
|
@ -44,17 +47,16 @@ module.exports = {
|
|||
list: async function (req, res) {
|
||||
try {
|
||||
const body = req.allParams()
|
||||
if (!body) throw new Error('Missing parameters')
|
||||
if (!body) throw new HttpError(400, 'Missing parameters')
|
||||
|
||||
const books = await Book.find(body)
|
||||
|
||||
if (!books.length) {
|
||||
return res.status(404).json({
|
||||
error: 'No books matching those parameters were found.'
|
||||
})
|
||||
throw new HttpError(404, 'No books matching those parameters were found.')
|
||||
}
|
||||
return res.json(books)
|
||||
} catch (e) {
|
||||
if (e instanceof HttpError) return e.send(res)
|
||||
return res.status(500).json({
|
||||
error: e.message
|
||||
})
|
||||
|
|
|
@ -12,9 +12,11 @@ module.exports = {
|
|||
create: async function (req, res, next) {
|
||||
const passportHelper = await sails.helpers.passport()
|
||||
passportHelper.protocols.local.register(req.body, function (err, user) {
|
||||
if (err) return res.status(500).json({
|
||||
if (err) {
|
||||
return res.status(500).json({
|
||||
error: err.toString()
|
||||
})
|
||||
}
|
||||
|
||||
res.json(user)
|
||||
})
|
||||
|
@ -23,9 +25,11 @@ module.exports = {
|
|||
update: async function (req, res, next) {
|
||||
const passportHelper = await sails.helpers.passport()
|
||||
passportHelper.protocols.local.update(req.body, function (err, user) {
|
||||
if (err) return res.status(500).json({
|
||||
if (err) {
|
||||
return res.status(500).json({
|
||||
error: err.toString()
|
||||
})
|
||||
}
|
||||
|
||||
res.json(user)
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ passport.serializeUser(function (user, next) {
|
|||
next(null, user.id)
|
||||
})
|
||||
passport.deserializeUser(function (id, next) {
|
||||
return User.findOne({id: id})
|
||||
return User.findOne({ id: id })
|
||||
.then(function (user) {
|
||||
next(null, user)
|
||||
return user
|
||||
|
@ -37,7 +37,7 @@ function PassportHelper () {
|
|||
const strategies = sails.config.passport
|
||||
|
||||
for (const key in strategies) {
|
||||
let options = {passReqToCallback: true}
|
||||
let options = { passReqToCallback: true }
|
||||
let Strategy = strategies[key].strategy
|
||||
if (key === 'local') {
|
||||
_.extend(options, {
|
||||
|
@ -122,7 +122,7 @@ function PassportHelper () {
|
|||
let user
|
||||
|
||||
if (!req.user) {
|
||||
if (!passport) { // new user signing up, create a new user
|
||||
if (!pass) { // new user signing up, create a new user
|
||||
user = await User.create(userAttrs).fetch()
|
||||
await Passport.create({
|
||||
...q,
|
||||
|
|
|
@ -18,20 +18,19 @@ module.exports = {
|
|||
autoIncrement: true,
|
||||
columnName: '_id'
|
||||
},
|
||||
title: {type: 'string', required: true},
|
||||
author: {type: 'string'},
|
||||
isbn: {type: 'string'},
|
||||
version: {type: 'string'},
|
||||
title: { type: 'string', required: true },
|
||||
author: { type: 'string' },
|
||||
isbn: { type: 'string' },
|
||||
version: { type: 'string' }
|
||||
|
||||
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
|
||||
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
|
||||
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
|
||||
|
||||
|
||||
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
|
||||
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
|
||||
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
|
41
app.js
41
app.js
|
@ -20,35 +20,30 @@
|
|||
* https://sailsjs.com/anatomy/app.js
|
||||
*/
|
||||
|
||||
|
||||
// Ensure we're in the project directory, so cwd-relative paths work as expected
|
||||
// no matter where we actually lift from.
|
||||
// > Note: This is not required in order to lift, but it is a convenient default.
|
||||
process.chdir(__dirname);
|
||||
|
||||
|
||||
process.chdir(__dirname)
|
||||
|
||||
// Attempt to import `sails` dependency, as well as `rc` (for loading `.sailsrc` files).
|
||||
var sails;
|
||||
var rc;
|
||||
var sails
|
||||
var rc
|
||||
try {
|
||||
sails = require('sails');
|
||||
rc = require('sails/accessible/rc');
|
||||
sails = require('sails')
|
||||
rc = require('sails/accessible/rc')
|
||||
} catch (err) {
|
||||
console.error('Encountered an error when attempting to require(\'sails\'):');
|
||||
console.error(err.stack);
|
||||
console.error('--');
|
||||
console.error('To run an app using `node app.js`, you need to have Sails installed');
|
||||
console.error('locally (`./node_modules/sails`). To do that, just make sure you\'re');
|
||||
console.error('in the same directory as your app and run `npm install`.');
|
||||
console.error();
|
||||
console.error('If Sails is installed globally (i.e. `npm install -g sails`) you can');
|
||||
console.error('also run this app with `sails lift`. Running with `sails lift` will');
|
||||
console.error('not run this file (`app.js`), but it will do exactly the same thing.');
|
||||
console.error('(It even uses your app directory\'s local Sails install, if possible.)');
|
||||
return;
|
||||
}//-•
|
||||
|
||||
console.error('Encountered an error when attempting to require(\'sails\'):')
|
||||
console.error(err.stack)
|
||||
console.error('--')
|
||||
console.error('To run an app using `node app.js`, you need to have Sails installed')
|
||||
console.error('locally (`./node_modules/sails`). To do that, just make sure you\'re')
|
||||
console.error('in the same directory as your app and run `npm install`.')
|
||||
console.error()
|
||||
console.error('If Sails is installed globally (i.e. `npm install -g sails`) you can')
|
||||
console.error('also run this app with `sails lift`. Running with `sails lift` will')
|
||||
console.error('not run this file (`app.js`), but it will do exactly the same thing.')
|
||||
console.error('(It even uses your app directory\'s local Sails install, if possible.)')
|
||||
}// -•
|
||||
|
||||
// Start server
|
||||
sails.lift(rc('sails'));
|
||||
sails.lift(rc('sails'))
|
||||
|
|
|
@ -53,9 +53,9 @@ export const setLoggedIn = (data) => (dispatch, getState) => {
|
|||
export const checkEmail = email => async (dispatch, getState) => {
|
||||
dispatch(setWorking(true))
|
||||
dispatch(clearError())
|
||||
if (/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/.test(email)) {
|
||||
if (/^([a-zA-Z0-9_\-.]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,5})$/.test(email)) {
|
||||
try {
|
||||
const res = await Ajax.post({
|
||||
await Ajax.post({
|
||||
url: '/auth/email_exists',
|
||||
data: {
|
||||
email
|
||||
|
@ -103,7 +103,7 @@ export const checkPassword = (email, password) => async (dispatch, getState) =>
|
|||
export const signup = (email, password) => async (dispatch, getState) => {
|
||||
dispatch(setWorking(true))
|
||||
dispatch(clearError())
|
||||
if (/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/.test(email)) {
|
||||
if (/^([a-zA-Z0-9_\-.]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,5})$/.test(email)) {
|
||||
try {
|
||||
await Ajax.post({
|
||||
url: '/auth/email_available',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import React from 'react'
|
||||
|
||||
import STYLE from '../../styles/shared/underlineinput.scss'
|
||||
import '../../styles/shared/underlineinput.scss'
|
||||
|
||||
const UnderlineInput = props => (
|
||||
<div className={'underlined-input ' + (props.className ? props.className : '')}>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
import React from 'react'
|
||||
import STYLE from '../../styles/shared/carousel.scss'
|
||||
import '../../styles/shared/carousel.scss'
|
||||
|
||||
class Carousel extends React.Component {
|
||||
constructor () {
|
||||
|
@ -18,7 +18,7 @@ class Carousel extends React.Component {
|
|||
render () {
|
||||
return (
|
||||
<section className='carousel-container'>
|
||||
<div className='carousel' style={{width: this.getWidth(), left: this.getOffset()}}>
|
||||
<div className='carousel' style={{ width: this.getWidth(), left: this.getOffset() }}>
|
||||
{this.props.children}
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import Progress from './components/Progress'
|
||||
import Carousel, {CarouselItem} from './containers/Carousel'
|
||||
import Carousel, { CarouselItem } from './containers/Carousel'
|
||||
import UnderlineInput from './components/UnderlineInput'
|
||||
import reducer from './reducers/login'
|
||||
import {setEmail, setPassword, setCarousel, checkEmail, checkPassword, signup} from './actions/login'
|
||||
import { setEmail, setPassword, setCarousel, checkEmail, checkPassword, signup } from './actions/login'
|
||||
|
||||
import STYLE from '../styles/login.scss'
|
||||
import '../styles/login.scss'
|
||||
|
||||
class App extends React.Component {
|
||||
constructor () {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import Actions from '../actions/login'
|
||||
|
||||
const reducer = (state = {}, action) => {
|
||||
const {type, data} = action
|
||||
const { type, data } = action
|
||||
switch (type) {
|
||||
case Actions.set_user:
|
||||
return {
|
||||
|
|
|
@ -19,7 +19,6 @@ module.exports.blueprints = {
|
|||
|
||||
// actions: false,
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Automatically expose RESTful routes for your models? *
|
||||
|
@ -28,7 +27,6 @@ module.exports.blueprints = {
|
|||
|
||||
// rest: true,
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Automatically expose CRUD "shortcut" routes to GET requests? *
|
||||
|
@ -38,4 +36,4 @@ module.exports.blueprints = {
|
|||
|
||||
// shortcuts: true,
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/config/bootstrap
|
||||
*/
|
||||
|
||||
module.exports.bootstrap = async function(done) {
|
||||
|
||||
module.exports.bootstrap = async function (done) {
|
||||
// By convention, this is a good place to set up fake data during development.
|
||||
//
|
||||
// For example:
|
||||
|
@ -29,6 +28,5 @@ module.exports.bootstrap = async function(done) {
|
|||
|
||||
// Don't forget to trigger `done()` when this bootstrap function's logic is finished.
|
||||
// (otherwise your server will never lift, since it's waiting on the bootstrap)
|
||||
return done();
|
||||
|
||||
};
|
||||
return done()
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@ module.exports.custom = {
|
|||
// stripeSecret: 'sk_test_Zzd814nldl91104qor5911gjald',
|
||||
// …
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
module.exports.datastores = {
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Your app's default datastore. *
|
||||
|
@ -51,7 +50,6 @@ module.exports.datastores = {
|
|||
// adapter: 'sails-mysql',
|
||||
// url: 'mysql://user:password@host:port/database',
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -59,15 +59,15 @@ module.exports = {
|
|||
// --------------------------------------------------------------------------
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* *
|
||||
* More adapter-specific options *
|
||||
* *
|
||||
* *
|
||||
* > For example, for some hosted PostgreSQL providers (like Heroku), the *
|
||||
* > extra `ssl: true` option is mandatory and must be provided. *
|
||||
* *
|
||||
* More info: *
|
||||
* https://sailsjs.com/config/datastores *
|
||||
* *
|
||||
* *
|
||||
* More info: *
|
||||
* https://sailsjs.com/config/datastores *
|
||||
* *
|
||||
****************************************************************************/
|
||||
// ssl: true,
|
||||
|
||||
|
|
|
@ -61,15 +61,15 @@ module.exports = {
|
|||
url: process.env.SAILS_DATASTORE_URL
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* *
|
||||
* More adapter-specific options *
|
||||
* *
|
||||
* *
|
||||
* > For example, for some hosted PostgreSQL providers (like Heroku), the *
|
||||
* > extra `ssl: true` option is mandatory and must be provided. *
|
||||
* *
|
||||
* More info: *
|
||||
* https://sailsjs.com/config/datastores *
|
||||
* *
|
||||
* *
|
||||
* More info: *
|
||||
* https://sailsjs.com/config/datastores *
|
||||
* *
|
||||
****************************************************************************/
|
||||
// ssl: true,
|
||||
|
||||
|
@ -240,8 +240,8 @@ module.exports = {
|
|||
* *
|
||||
***************************************************************************/
|
||||
onlyAllowOrigins: [
|
||||
'https://ec2-18-219-76-43.us-east-2.compute.amazonaws.com',
|
||||
],
|
||||
'https://ec2-18-219-76-43.us-east-2.compute.amazonaws.com'
|
||||
]
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
|
|
|
@ -47,6 +47,6 @@ module.exports.globals = {
|
|||
* *
|
||||
****************************************************************************/
|
||||
|
||||
sails: true,
|
||||
sails: true
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports.http = {
|
|||
],
|
||||
rateLimit: rateLimiter,
|
||||
passportInit: require('passport').initialize(),
|
||||
passportSession: require('passport').session(),
|
||||
passportSession: require('passport').session()
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports.i18n = {
|
|||
* *
|
||||
***************************************************************************/
|
||||
|
||||
locales: ['en', 'es', 'fr', 'de'],
|
||||
locales: ['en', 'es', 'fr', 'de']
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
|
@ -42,4 +42,4 @@ module.exports.i18n = {
|
|||
|
||||
// localesDirectory: 'config/locales'
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ module.exports.log = {
|
|||
|
||||
// level: 'info'
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
module.exports.models = {
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Whether the `.create()` and `.update()` model methods should ignore *
|
||||
|
@ -37,7 +36,6 @@ module.exports.models = {
|
|||
|
||||
// schema: true,
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* How and whether Sails will attempt to automatically rebuild the *
|
||||
|
@ -55,7 +53,6 @@ module.exports.models = {
|
|||
|
||||
// migrate: 'alter',
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Base attributes that are included in all of your models by default. *
|
||||
|
@ -82,10 +79,9 @@ module.exports.models = {
|
|||
//
|
||||
// Plus, don't forget to configure MongoDB as your default datastore:
|
||||
// https://sailsjs.com/docs/tutorials/using-mongo-db
|
||||
//--------------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------------
|
||||
},
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* The set of DEKs (data encryption keys) for at-rest encryption. *
|
||||
|
@ -104,7 +100,6 @@ module.exports.models = {
|
|||
default: 'nuF29j3StsGhRTut9dIrCxCNyYegcwH30FxnZ3kkdiA='
|
||||
},
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Whether or not implicit records for associations should be cleaned up *
|
||||
|
@ -120,5 +115,4 @@ module.exports.models = {
|
|||
|
||||
cascadeOnDestroy: true
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ module.exports.protocols = {
|
|||
}
|
||||
}
|
||||
|
||||
const EMAIL_REGEX = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i
|
||||
const EMAIL_REGEX = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i
|
||||
|
||||
function validateEmail (email) {
|
||||
return EMAIL_REGEX.test(email)
|
||||
|
|
|
@ -77,10 +77,8 @@ module.exports.routes = {
|
|||
// ║║║║╣ ╠╩╗╠═╣║ ║║ ║╠╩╗╚═╗
|
||||
// ╚╩╝╚═╝╚═╝╩ ╩╚═╝╚═╝╩ ╩╚═╝
|
||||
|
||||
|
||||
// ╔╦╗╦╔═╗╔═╗
|
||||
// ║║║║╚═╗║
|
||||
// ╩ ╩╩╚═╝╚═╝
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ module.exports.security = {
|
|||
// allowCredentials: false,
|
||||
// },
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* By default, Sails' built-in CSRF protection is disabled to facilitate *
|
||||
|
@ -51,4 +50,4 @@ module.exports.security = {
|
|||
|
||||
// csrf: false
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,8 +18,7 @@ module.exports.session = {
|
|||
* of your users, forcing them to log in again. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
secret: 'b7f0374251c4d79227067c286fe97ea5',
|
||||
|
||||
secret: 'b7f0374251c4d79227067c286fe97ea5'
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
|
@ -36,4 +35,4 @@ module.exports.session = {
|
|||
// return !!req.path.match(req._sails.LOOKS_LIKE_ASSET_RX);
|
||||
// },
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ module.exports.sockets = {
|
|||
|
||||
// transports: [ 'websocket' ],
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* `beforeConnect` *
|
||||
|
@ -50,7 +49,6 @@ module.exports.sockets = {
|
|||
//
|
||||
// },
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* `afterDisconnect` *
|
||||
|
@ -68,7 +66,6 @@ module.exports.sockets = {
|
|||
//
|
||||
// },
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Whether to expose a 'GET /__getcookie' route that sets an HTTP-only *
|
||||
|
@ -78,5 +75,4 @@ module.exports.sockets = {
|
|||
|
||||
// grant3rdPartyCookie: true,
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -38,4 +38,4 @@ module.exports.views = {
|
|||
|
||||
layout: 'layouts/layout'
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/babel.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('babel', {
|
||||
dist: {
|
||||
options: {
|
||||
|
@ -25,7 +24,7 @@ module.exports = function(grunt) {
|
|||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -50,5 +49,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-babel');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/clean.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('clean', {
|
||||
dev: ['.tmp/public/**'],
|
||||
build: ['www'],
|
||||
|
@ -23,7 +22,7 @@ module.exports = function(grunt) {
|
|||
'www/templates',
|
||||
'www/dependencies'
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -48,5 +47,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/coffee.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('coffee', {
|
||||
dev: {
|
||||
options: {
|
||||
|
@ -27,7 +26,7 @@ module.exports = function(grunt) {
|
|||
ext: '.js'
|
||||
}]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -52,5 +51,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-coffee');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/concat.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('concat', {
|
||||
js: {
|
||||
src: require('../pipeline').jsFilesToInject,
|
||||
|
@ -21,7 +20,7 @@ module.exports = function(grunt) {
|
|||
src: require('../pipeline').cssFilesToInject,
|
||||
dest: '.tmp/public/concat/production.css'
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -46,5 +45,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/copy.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('copy', {
|
||||
dev: {
|
||||
files: [{
|
||||
|
@ -35,8 +34,8 @@ module.exports = function(grunt) {
|
|||
src: ['**/*'],
|
||||
dest: '.tmp/public/dist'
|
||||
}]
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -61,5 +60,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/cssmin.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('cssmin', {
|
||||
dist: {
|
||||
src: ['.tmp/public/concat/production.css'],
|
||||
dest: '.tmp/public/min/production.min.css'
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -43,5 +42,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/hash.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('hash', {
|
||||
options: {
|
||||
mapping: '',
|
||||
|
@ -18,11 +17,11 @@ module.exports = function(grunt) {
|
|||
destBasePath: '',
|
||||
flatten: false,
|
||||
hashLength: 8,
|
||||
hashFunction: function(source, encoding){
|
||||
hashFunction: function (source, encoding) {
|
||||
if (!source || !encoding) {
|
||||
throw new Error('Consistency violation: Cannot compute unique hash for production .css/.js cache-busting suffix, because `source` and/or `encoding` are falsey-- but they should be truthy strings! Here they are, respectively:\nsource: '+require('util').inspect(source, {depth:null})+'\nencoding: '+require('util').inspect(encoding, {depth:null}));
|
||||
throw new Error('Consistency violation: Cannot compute unique hash for production .css/.js cache-busting suffix, because `source` and/or `encoding` are falsey-- but they should be truthy strings! Here they are, respectively:\nsource: ' + require('util').inspect(source, { depth: null }) + '\nencoding: ' + require('util').inspect(encoding, { depth: null }))
|
||||
}
|
||||
return require('crypto').createHash('sha1').update(source, encoding).digest('hex');
|
||||
return require('crypto').createHash('sha1').update(source, encoding).digest('hex')
|
||||
}
|
||||
},
|
||||
js: {
|
||||
|
@ -33,7 +32,7 @@ module.exports = function(grunt) {
|
|||
src: '.tmp/public/min/*.css',
|
||||
dest: '.tmp/public/hash/'
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -58,5 +57,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-hash');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('jst', {
|
||||
dev: {
|
||||
|
||||
|
@ -26,14 +25,13 @@ module.exports = function(grunt) {
|
|||
// default interpolation. If you want to parse templates with the default _.template behavior
|
||||
// (i.e. using <div><%= this.id %></div>), there's no need to overwrite `templateSettings.interpolate`.
|
||||
|
||||
|
||||
files: {
|
||||
// e.g.
|
||||
// 'relative/path/from/gruntfile/to/compiled/template/destination' : ['relative/path/to/sourcefiles/**/*.html']
|
||||
'.tmp/public/jst.js': require('../pipeline').templateFilesToInject
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -58,5 +56,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-jst');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/less.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('less', {
|
||||
dev: {
|
||||
files: [{
|
||||
|
@ -21,7 +20,7 @@ module.exports = function(grunt) {
|
|||
ext: '.css'
|
||||
}]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -46,5 +45,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-less');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,11 +11,9 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/sails-linker.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('sails-linker', {
|
||||
|
||||
|
||||
// ╦╔═╗╦ ╦╔═╗╔═╗╔═╗╦═╗╦╔═╗╔╦╗
|
||||
// ║╠═╣╚╗╔╝╠═╣╚═╗║ ╠╦╝║╠═╝ ║
|
||||
// ╚╝╩ ╩ ╚╝ ╩ ╩╚═╝╚═╝╩╚═╩╩ ╩
|
||||
|
@ -41,7 +39,7 @@ module.exports = function(grunt) {
|
|||
startTag: '<!--SCRIPTS-->',
|
||||
endTag: '<!--SCRIPTS END-->',
|
||||
fileTmpl: '<script src="%s"></script>',
|
||||
appRoot: '.tmp/public',
|
||||
appRoot: '.tmp/public'
|
||||
// relative: true
|
||||
// ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
|
||||
// (but be note that this can break custom font URLs)
|
||||
|
@ -72,7 +70,7 @@ module.exports = function(grunt) {
|
|||
startTag: '<!--SCRIPTS-->',
|
||||
endTag: '<!--SCRIPTS END-->',
|
||||
fileTmpl: '<script src="%s"></script>',
|
||||
appRoot: '.tmp/public',
|
||||
appRoot: '.tmp/public'
|
||||
// relative: true
|
||||
// ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
|
||||
// (but be note that this can break custom font URLs)
|
||||
|
@ -84,7 +82,6 @@ module.exports = function(grunt) {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
// ╔═╗╔╦╗╦ ╦╦ ╔═╗╔═╗╦ ╦╔═╗╔═╗╔╦╗╔═╗
|
||||
// ╚═╗ ║ ╚╦╝║ ║╣ ╚═╗╠═╣║╣ ║╣ ║ ╚═╗
|
||||
// ╚═╝ ╩ ╩ ╩═╝╚═╝╚═╝╩ ╩╚═╝╚═╝ ╩ ╚═╝
|
||||
|
@ -111,7 +108,7 @@ module.exports = function(grunt) {
|
|||
startTag: '<!--STYLES-->',
|
||||
endTag: '<!--STYLES END-->',
|
||||
fileTmpl: '<link rel="stylesheet" href="%s">',
|
||||
appRoot: '.tmp/public',
|
||||
appRoot: '.tmp/public'
|
||||
// relative: true
|
||||
// ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
|
||||
// (but be note that this can break custom font URLs)
|
||||
|
@ -143,7 +140,7 @@ module.exports = function(grunt) {
|
|||
startTag: '<!--STYLES-->',
|
||||
endTag: '<!--STYLES END-->',
|
||||
fileTmpl: '<link rel="stylesheet" href="%s">',
|
||||
appRoot: '.tmp/public',
|
||||
appRoot: '.tmp/public'
|
||||
// relative: true
|
||||
// ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
|
||||
// (but be note that this can break custom font URLs)
|
||||
|
@ -155,7 +152,6 @@ module.exports = function(grunt) {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
// ╔═╗╦═╗╔═╗╔═╗╔═╗╔╦╗╔═╗╦╦ ╔═╗╔╦╗ ╦ ╦╔╦╗╔╦╗╦ ╔╦╗╔═╗╔╦╗╔═╗╦ ╔═╗╔╦╗╔═╗╔═╗
|
||||
// ╠═╝╠╦╝║╣ ║ ║ ║║║║╠═╝║║ ║╣ ║║ ╠═╣ ║ ║║║║ ║ ║╣ ║║║╠═╝║ ╠═╣ ║ ║╣ ╚═╗
|
||||
// ╩ ╩╚═╚═╝╚═╝╚═╝╩ ╩╩ ╩╩═╝╚═╝═╩╝ ╩ ╩ ╩ ╩ ╩╩═╝ ╩ ╚═╝╩ ╩╩ ╩═╝╩ ╩ ╩ ╚═╝╚═╝
|
||||
|
@ -180,7 +176,7 @@ module.exports = function(grunt) {
|
|||
startTag: '<!--TEMPLATES-->',
|
||||
endTag: '<!--TEMPLATES END-->',
|
||||
fileTmpl: '<script type="text/javascript" src="%s"></script>',
|
||||
appRoot: '.tmp/public',
|
||||
appRoot: '.tmp/public'
|
||||
// relative: true
|
||||
// ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
|
||||
// (but be note that this can break custom font URLs)
|
||||
|
@ -190,9 +186,9 @@ module.exports = function(grunt) {
|
|||
'views/**/*.html': ['.tmp/public/jst.js'],
|
||||
'views/**/*.ejs': ['.tmp/public/jst.js']
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
});//</ grunt.config.set() >
|
||||
})// </ grunt.config.set() >
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -217,5 +213,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-sails-linker');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/sync.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('sync', {
|
||||
dev: {
|
||||
files: [{
|
||||
|
@ -20,7 +19,7 @@ module.exports = function(grunt) {
|
|||
dest: '.tmp/public'
|
||||
}]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -45,5 +44,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-sync');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/uglify.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('uglify', {
|
||||
dist: {
|
||||
src: ['.tmp/public/concat/production.js'],
|
||||
|
@ -24,7 +23,7 @@ module.exports = function(grunt) {
|
|||
'Promise',
|
||||
'File',
|
||||
'Location',
|
||||
'RttcRefPlaceholder',
|
||||
'RttcRefPlaceholder'
|
||||
],
|
||||
keep_fnames: true//eslint-disable-line
|
||||
},
|
||||
|
@ -32,7 +31,7 @@ module.exports = function(grunt) {
|
|||
keep_fnames: true//eslint-disable-line
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -57,6 +56,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/config/watch.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.config.set('watch', {
|
||||
assets: {
|
||||
|
||||
|
@ -27,7 +26,7 @@ module.exports = function(grunt) {
|
|||
'linkAssets'
|
||||
]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// This Grunt plugin is part of the default asset pipeline in Sails,
|
||||
|
@ -52,5 +51,4 @@ module.exports = function(grunt) {
|
|||
// grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
// ```
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
* https://sailsjs.com/anatomy/tasks/pipeline.js
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// ██████╗ ██╗ █████╗ ██╗███╗ ██╗ ██████╗███████╗███████╗
|
||||
// ██╔══██╗██║ ██╔══██╗██║████╗ ██║ ██╔════╝██╔════╝██╔════╝
|
||||
// ██████╔╝██║ ███████║██║██╔██╗ ██║ ██║ ███████╗███████╗
|
||||
|
@ -40,8 +38,7 @@ var cssFilesToInject = [
|
|||
// in no particular order. To customize the ordering, add additional
|
||||
// items here, _above_ this one.
|
||||
'styles/**/*.css'
|
||||
];
|
||||
|
||||
]
|
||||
|
||||
// ██████╗██╗ ██╗███████╗███╗ ██╗████████╗ ███████╗██╗██████╗ ███████╗
|
||||
// ██╔════╝██║ ██║██╔════╝████╗ ██║╚══██╔══╝ ██╔════╝██║██╔══██╗██╔════╝
|
||||
|
@ -73,8 +70,7 @@ var jsFilesToInject = [
|
|||
// in no particular order. To customize the ordering, add additional items
|
||||
// here, _above_ this one.
|
||||
'js/**/*.js'
|
||||
];
|
||||
|
||||
]
|
||||
|
||||
// ██████╗██╗ ██╗███████╗███╗ ██╗████████╗ ███████╗██╗██████╗ ███████╗
|
||||
// ██╔════╝██║ ██║██╔════╝████╗ ██║╚══██╔══╝ ██╔════╝██║██╔══██╗██╔════╝
|
||||
|
@ -103,9 +99,7 @@ var jsFilesToInject = [
|
|||
//
|
||||
var templateFilesToInject = [
|
||||
'templates/**/*.html'
|
||||
];
|
||||
|
||||
|
||||
]
|
||||
|
||||
// ███╗ ███╗██╗███████╗ ██████╗ ███████╗███████╗████████╗██╗ ██╗██████╗
|
||||
// ████╗ ████║██║██╔════╝██╔════╝ ██╔════╝██╔════╝╚══██╔══╝██║ ██║██╔══██╗
|
||||
|
@ -119,29 +113,29 @@ var templateFilesToInject = [
|
|||
// the code below, unless you are modifying the default asset pipeline.**
|
||||
|
||||
// Default path for public folder (see documentation on sailsjs.com for more information)
|
||||
var tmpPath = '.tmp/public/';
|
||||
var tmpPath = '.tmp/public/'
|
||||
|
||||
// Prefix relative paths to source files so they point to the proper locations
|
||||
// (i.e. where the other Grunt tasks spit them out, or in some cases, where
|
||||
// they reside in the first place)
|
||||
module.exports.cssFilesToInject = cssFilesToInject.map((cssPath)=>{
|
||||
module.exports.cssFilesToInject = cssFilesToInject.map((cssPath) => {
|
||||
// If we're ignoring the file, make sure the ! is at the beginning of the path
|
||||
if (cssPath[0] === '!') {
|
||||
return require('path').join('!' + tmpPath, cssPath.substr(1));
|
||||
return require('path').join('!' + tmpPath, cssPath.substr(1))
|
||||
}
|
||||
return require('path').join(tmpPath, cssPath);
|
||||
});
|
||||
module.exports.jsFilesToInject = jsFilesToInject.map((jsPath)=>{
|
||||
return require('path').join(tmpPath, cssPath)
|
||||
})
|
||||
module.exports.jsFilesToInject = jsFilesToInject.map((jsPath) => {
|
||||
// If we're ignoring the file, make sure the ! is at the beginning of the path
|
||||
if (jsPath[0] === '!') {
|
||||
return require('path').join('!' + tmpPath, jsPath.substr(1));
|
||||
return require('path').join('!' + tmpPath, jsPath.substr(1))
|
||||
}
|
||||
return require('path').join(tmpPath, jsPath);
|
||||
});
|
||||
module.exports.templateFilesToInject = templateFilesToInject.map((tplPath)=>{
|
||||
return require('path').join(tmpPath, jsPath)
|
||||
})
|
||||
module.exports.templateFilesToInject = templateFilesToInject.map((tplPath) => {
|
||||
// If we're ignoring the file, make sure the ! is at the beginning of the path
|
||||
if (tplPath[0] === '!') {
|
||||
return require('path').join('!assets/', tplPath.substr(1));
|
||||
return require('path').join('!assets/', tplPath.substr(1))
|
||||
}
|
||||
return require('path').join('assets/', tplPath);
|
||||
});
|
||||
return require('path').join('assets/', tplPath)
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/build.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('build', [
|
||||
// 'polyfill:dev', //« uncomment to ALSO transpile during development (for broader browser compat.)
|
||||
'compileAssets',
|
||||
|
@ -18,5 +18,5 @@ module.exports = function(grunt) {
|
|||
'linkAssetsBuild',
|
||||
'clean:build',
|
||||
'copy:build'
|
||||
]);
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
|
@ -11,20 +11,19 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/build-prod.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('buildProd', [
|
||||
'polyfill:prod', //« Remove this to skip transpilation in production (not recommended)
|
||||
'polyfill:prod', // « Remove this to skip transpilation in production (not recommended)
|
||||
'compileAssets',
|
||||
'babel', //« Remove this to skip transpilation in production (not recommended)
|
||||
'babel', // « Remove this to skip transpilation in production (not recommended)
|
||||
'concat',
|
||||
'uglify',
|
||||
'cssmin',
|
||||
'hash',//« Cache-busting
|
||||
'copy:beforeLinkBuildProd',//« For prettier URLs after cache-busting
|
||||
'hash', // « Cache-busting
|
||||
'copy:beforeLinkBuildProd', // « For prettier URLs after cache-busting
|
||||
'linkAssetsBuildProd',
|
||||
'clean:build',
|
||||
'copy:build',
|
||||
'clean:afterBuildProd'
|
||||
]);
|
||||
};
|
||||
|
||||
])
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/compile-assets.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('compileAssets', [
|
||||
'clean:dev',
|
||||
'jst:dev',
|
||||
'less:dev',
|
||||
'copy:dev',
|
||||
'coffee:dev'
|
||||
]);
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
|
@ -13,15 +13,11 @@
|
|||
*
|
||||
*/
|
||||
module.exports = function (grunt) {
|
||||
|
||||
|
||||
grunt.registerTask('default', [
|
||||
// 'polyfill:dev', //« uncomment to ALSO transpile during development (for broader browser compat.)
|
||||
'compileAssets',
|
||||
// 'babel', //« uncomment to ALSO transpile during development (for broader browser compat.)
|
||||
'linkAssets',
|
||||
'watch'
|
||||
]);
|
||||
|
||||
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/link-assets.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('linkAssets', [
|
||||
'sails-linker:devJs',
|
||||
'sails-linker:devStyles',
|
||||
'sails-linker:clientSideTemplates'
|
||||
]);
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/link-assets-build.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('linkAssetsBuild', [
|
||||
'sails-linker:devJsBuild',
|
||||
'sails-linker:devStylesBuild',
|
||||
'sails-linker:clientSideTemplatesBuild'
|
||||
]);
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/link-assets-build-prod.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('linkAssetsBuildProd', [
|
||||
'sails-linker:prodJsBuild',
|
||||
'sails-linker:prodStylesBuild',
|
||||
'sails-linker:clientSideTemplatesBuild'
|
||||
]);
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
|
@ -7,22 +7,21 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/polyfill.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('polyfill:prod', 'Add the polyfill file to the top of the list of files to concatenate', ()=>{
|
||||
grunt.config.set('concat.js.src', [require('sails-hook-grunt/accessible/babel-polyfill')].concat(grunt.config.get('concat.js.src')));
|
||||
});
|
||||
grunt.registerTask('polyfill:dev', 'Add the polyfill file to the top of the list of files to copy and link', ()=>{
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('polyfill:prod', 'Add the polyfill file to the top of the list of files to concatenate', () => {
|
||||
grunt.config.set('concat.js.src', [require('sails-hook-grunt/accessible/babel-polyfill')].concat(grunt.config.get('concat.js.src')))
|
||||
})
|
||||
grunt.registerTask('polyfill:dev', 'Add the polyfill file to the top of the list of files to copy and link', () => {
|
||||
grunt.config.set('copy.dev.files', grunt.config.get('copy.dev.files').concat({
|
||||
expand: true,
|
||||
cwd: require('path').dirname(require('sails-hook-grunt/accessible/babel-polyfill')),
|
||||
src: require('path').basename(require('sails-hook-grunt/accessible/babel-polyfill')),
|
||||
dest: '.tmp/public/polyfill'
|
||||
}));
|
||||
var devLinkFiles = grunt.config.get('sails-linker.devJs.files');
|
||||
grunt.config.set('sails-linker.devJs.files', Object.keys(devLinkFiles).reduce((linkerConfigSoFar, glob)=>{
|
||||
linkerConfigSoFar[glob] = ['.tmp/public/polyfill/polyfill.min.js'].concat(devLinkFiles[glob]);
|
||||
return linkerConfigSoFar;
|
||||
}, {}));
|
||||
});
|
||||
};
|
||||
|
||||
}))
|
||||
var devLinkFiles = grunt.config.get('sails-linker.devJs.files')
|
||||
grunt.config.set('sails-linker.devJs.files', Object.keys(devLinkFiles).reduce((linkerConfigSoFar, glob) => {
|
||||
linkerConfigSoFar[glob] = ['.tmp/public/polyfill/polyfill.min.js'].concat(devLinkFiles[glob])
|
||||
return linkerConfigSoFar
|
||||
}, {}))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -11,17 +11,16 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/prod.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('prod', [
|
||||
'polyfill:prod', //« Remove this to skip transpilation in production (not recommended)
|
||||
'polyfill:prod', // « Remove this to skip transpilation in production (not recommended)
|
||||
'compileAssets',
|
||||
'babel', //« Remove this to skip transpilation in production (not recommended)
|
||||
'babel', // « Remove this to skip transpilation in production (not recommended)
|
||||
'concat',
|
||||
'uglify',
|
||||
'cssmin',
|
||||
'sails-linker:prodJs',
|
||||
'sails-linker:prodStyles',
|
||||
'sails-linker:clientSideTemplates',
|
||||
]);
|
||||
};
|
||||
|
||||
'sails-linker:clientSideTemplates'
|
||||
])
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
* https://sailsjs.com/anatomy/tasks/register/sync-assets.js
|
||||
*
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('syncAssets', [
|
||||
'jst:dev',
|
||||
'less:dev',
|
||||
'sync:dev',
|
||||
'coffee:dev'
|
||||
]);
|
||||
};
|
||||
])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue