-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a brunch sample #73
Changes from 1 commit
6e7686c
d2abbd2
cdabd9d
ece2ba1
28997fc
806a987
0e3e7f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
"strict": true, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true | ||
"unused": true, | ||
"esversion": 6 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Numerous always-ignore extensions | ||
*.diff | ||
*.err | ||
*.orig | ||
*.log | ||
*.rej | ||
*.swo | ||
*.swp | ||
*.vi | ||
*~ | ||
*.sass-cache | ||
|
||
# OS or Editor folders | ||
.DS_Store | ||
.cache | ||
.project | ||
.settings | ||
.tmproj | ||
nbproject | ||
Thumbs.db | ||
|
||
# NPM packages folder. | ||
node_modules/ | ||
|
||
# Brunch output folder. | ||
public/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Brunch with ES6 running on Google App Engine. | ||
|
||
This sample demonstrates how to use [Brunch](http://brunch.io) on | ||
[Google App Engine Managed VMs](https://cloud.google.com/appengine). | ||
|
||
For more information about getting started with Brunch, see the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind adding a "Bunch is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, no problem. |
||
[Getting Started with Brunch Guide](https://github.com/brunch/brunch-guide/blob/master/content/en/chapter02-getting-started.md) . | ||
|
||
You can also view the [live demo](https://alien-lattice-123714.appspot.com) and read the full [Brunch documentation](https://github.com/brunch/brunch-guide). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great for now, but FYI we typically run these under one project we have at Google. Those VMs cost you money after the free trial runs out :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if you want me to change or remove the link, I don't mind keeping it up. |
||
|
||
## Setup | ||
Add the necessary modules in your `package.json`: | ||
```sh | ||
$ npm install --save-dev express body-parser morgan | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmdobry do you know if devDependenices are working? Last time I tried, they weren't :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I know, they aren't. |
||
``` | ||
|
||
## Running locally | ||
Refer to the [appengine/README.md](../README.md) file for instructions on | ||
running and deploying. | ||
|
||
To support custom web servers an `app.js` file was added. | ||
```sh | ||
$ npm start | ||
``` | ||
Will bypass the `brunch-config.js` file and use settings provided in the `app.js` file. | ||
|
||
```sh | ||
$ brunch watch --server | ||
``` | ||
Will use settings provided in the `brunch-config.js` file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2015-2016, Google, Inc. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
var startServer = require('./brunch-server'); | ||
startServer(process.env.PORT || 8080, '/', function() { | ||
var server = this; | ||
var port = server.address().port; | ||
console.log('App listening at http://localhost:%s', port); | ||
console.log('Press Ctrl+C to quit.'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2015-2016, Google, Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# [START app_yaml] | ||
runtime: nodejs | ||
vm: true | ||
|
||
skip_files: | ||
- ^(.*/)?.*/node_modules/.*$ | ||
# [END app_yaml] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="initial-scale=1.0, user-scalable=no"><!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323--><meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"><title>Brunch with ES6</title><script src="/libraries.js"></script><script src="/app.js"></script><script>require('application').init();</script></head><body><div id="app"><h1>Hello World!</h1></div></body> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you format this? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
// do your setup here | ||
console.log('Initialized app'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
doctype html | ||
head | ||
meta(charset='utf-8') | ||
meta(name='viewport', content='initial-scale=1.0, user-scalable=no') | ||
// WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 | ||
meta(name='viewport', content='user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi') | ||
title Brunch with ES6 running on Google App Engine | ||
script(src='/vendor.js') | ||
script(src='/app.js') | ||
script. | ||
require('initialize'); | ||
body | ||
#app | ||
h1 Hello World! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
files: { | ||
javascripts: { | ||
joinTo: { | ||
'vendor.js': /^(?!app)/, | ||
'app.js': /^app/ | ||
} | ||
}, | ||
stylesheets: { | ||
joinTo: 'app.css' | ||
} | ||
}, | ||
|
||
plugins: { | ||
babel: { | ||
presets: ['es2015'] | ||
} | ||
}, | ||
server: { | ||
run: true, | ||
base: '/', | ||
port: 8080 | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
var express = require('express'); | ||
var http = require('http'); | ||
var Path = require('path'); | ||
|
||
module.exports = function startServer(port, path, callback) { | ||
var app = express(); | ||
var server = http.createServer(app); | ||
|
||
app.use(express.static(Path.join(__dirname, path))); | ||
|
||
app.set('views', Path.join(__dirname, 'app/views')); | ||
app.set('view engine', 'jade'); | ||
|
||
app.get('/', function(req, res) { | ||
res.render('index'); | ||
}); | ||
|
||
server.listen(port, callback); | ||
|
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "appengine-brunch", | ||
"description": "An example of Brunch with ES6 running on Google App Engine.", | ||
"version": "0.0.1", | ||
"private": true, | ||
"license": "Apache Version 2.0", | ||
"author": "Google Inc.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah, give yourself credit |
||
"engines": { | ||
"node": "~4.2" | ||
}, | ||
"scripts": { | ||
"start": "node app.js", | ||
"watch": "brunch watch --server", | ||
"deploy": "gcloud preview app deploy", | ||
"prod": "brunch build --production" | ||
}, | ||
"dependencies": { | ||
"auto-reload-brunch": "^2.0.0", | ||
"babel-brunch": "~6.0.0", | ||
"babel-preset-es2015": "~6.3.13", | ||
"brunch": "^2.4.0", | ||
"clean-css-brunch": "^2.0.0", | ||
"css-brunch": "^2.0.0", | ||
"express": "^4.13.4", | ||
"jade": "^1.11.0", | ||
"javascript-brunch": "^2.0.0", | ||
"uglify-js-brunch": "^2.0.0" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Managed VMs link is https://cloud.google.com/appengine/docs/managed-vms/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed