mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 19:21:46 +00:00
Merge pull request #385 from weaveworks/js-tooling
Update the JS tooling
This commit is contained in:
10
Makefile
10
Makefile
@@ -44,7 +44,7 @@ client/build/app.js: client/app/scripts/*
|
||||
mkdir -p client/build
|
||||
docker run -ti -v $(shell pwd)/client/app:/home/weave/app \
|
||||
-v $(shell pwd)/client/build:/home/weave/build \
|
||||
$(SCOPE_UI_BUILD_IMAGE) gulp build --release
|
||||
$(SCOPE_UI_BUILD_IMAGE) npm run build
|
||||
|
||||
client-test: client/test/*
|
||||
docker run -ti -v $(shell pwd)/client/app:/home/weave/app \
|
||||
@@ -56,18 +56,18 @@ client-lint:
|
||||
-v $(shell pwd)/client/test:/home/weave/test \
|
||||
$(SCOPE_UI_BUILD_IMAGE) npm run lint
|
||||
|
||||
client-sync:
|
||||
client-start:
|
||||
docker run -ti --net=host -v $(shell pwd)/client/app:/home/weave/app \
|
||||
-v $(shell pwd)/client/build:/home/weave/build \
|
||||
$(SCOPE_UI_BUILD_IMAGE) gulp sync
|
||||
$(SCOPE_UI_BUILD_IMAGE) npm start
|
||||
|
||||
$(SCOPE_UI_BUILD_EXPORT): client/Dockerfile client/gulpfile.js client/package.json client/webpack.config.js client/.eslintrc
|
||||
$(SCOPE_UI_BUILD_EXPORT): client/Dockerfile client/package.json client/webpack.local.config.js client/webpack.production.config.js client/server.js client/.eslintrc
|
||||
docker build -t $(SCOPE_UI_BUILD_IMAGE) client
|
||||
docker save $(SCOPE_UI_BUILD_IMAGE):latest > $@
|
||||
|
||||
clean:
|
||||
go clean ./...
|
||||
rm -rf $(SCOPE_EXPORT) $(SCOPE_UI_BUILD_EXPORT) $(APP_EXE) $(PROBE_EXE) client/build
|
||||
rm -rf $(SCOPE_EXPORT) $(SCOPE_UI_BUILD_EXPORT) $(APP_EXE) $(PROBE_EXE) client/build/app.js
|
||||
|
||||
deps:
|
||||
go get \
|
||||
|
||||
@@ -35,7 +35,7 @@ dependencies:
|
||||
- make deps
|
||||
- mkdir -p $(dirname $SRCDIR)
|
||||
- cp -r $(pwd)/ $SRCDIR
|
||||
- cd $SRCDIR/client; $TOOLS/rebuild-image weaveworks/scope-ui-build . Dockerfile gulpfile.js package.json webpack.config.js .eslintrc
|
||||
- cd $SRCDIR/client; $TOOLS/rebuild-image weaveworks/scope-ui-build . Dockerfile package.json webpack.production.config.js .eslintrc
|
||||
|
||||
test:
|
||||
override:
|
||||
|
||||
3
client/.gitignore
vendored
3
client/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
build
|
||||
build/app.js
|
||||
build/*[woff2?|ttf|eot|svg]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
FROM node:0.10
|
||||
WORKDIR /home/weave
|
||||
RUN npm install -g gulp
|
||||
COPY package.json /home/weave/
|
||||
RUN npm install
|
||||
COPY gulpfile.js webpack.config.js .eslintrc /home/weave/
|
||||
COPY webpack.local.config.js webpack.production.config.js server.js .eslintrc /home/weave/
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
## Getting Started
|
||||
|
||||
- Setup: `npm install`
|
||||
- Build: `gulp build --release`, output will be in `build/`
|
||||
- Develop: `gulp sync` and then open `http://localhost:4042/`
|
||||
- Build: `npm run build`, output will be in `build/`
|
||||
- Develop: `npm start` and then open `http://localhost:4042/`
|
||||
|
||||
To see a topology, `../app/app` needs to be running, as well as a probe.
|
||||
|
||||
## Coding
|
||||
|
||||
This directory has a `.eslintrc`, make sure your editor supports linter hints.
|
||||
To run a linter, you also run `gulp lint`.
|
||||
To run a linter, you also run `npm run lint`.
|
||||
|
||||
## Logging
|
||||
|
||||
|
||||
@@ -1,663 +0,0 @@
|
||||
# Apache Server Configs v2.2.0 | MIT License
|
||||
# https://github.com/h5bp/server-configs-apache
|
||||
|
||||
# (!) Using `.htaccess` files slows down Apache, therefore, if you have access
|
||||
# to the main server config file (usually called `httpd.conf`), you should add
|
||||
# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html.
|
||||
|
||||
# ##############################################################################
|
||||
# # CROSS-ORIGIN RESOURCE SHARING (CORS) #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Cross-domain AJAX requests |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Allow cross-origin AJAX requests.
|
||||
# http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
|
||||
# http://enable-cors.org/
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set Access-Control-Allow-Origin "*"
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | CORS-enabled images |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Send the CORS header for images when browsers request it.
|
||||
# https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image
|
||||
# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
|
||||
# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
|
||||
|
||||
<IfModule mod_setenvif.c>
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "\.(cur|gif|ico|jpe?g|png|svgz?|webp)$">
|
||||
SetEnvIf Origin ":" IS_CORS
|
||||
Header set Access-Control-Allow-Origin "*" env=IS_CORS
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Web fonts access |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Allow access to web fonts from all domains.
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "\.(eot|otf|tt[cf]|woff)$">
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# # ERRORS #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | 404 error prevention for non-existing redirected folders |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Prevent Apache from returning a 404 error as the result of a rewrite
|
||||
# when the directory with the same name does not exist.
|
||||
# http://httpd.apache.org/docs/current/content-negotiation.html#multiviews
|
||||
# http://www.webmasterworld.com/apache/3808792.htm
|
||||
|
||||
Options -MultiViews
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Custom error messages / pages |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Customize what Apache returns to the client in case of an error.
|
||||
# http://httpd.apache.org/docs/current/mod/core.html#errordocument
|
||||
|
||||
ErrorDocument 404 /404.html
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# # INTERNET EXPLORER #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Better website experience |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Force Internet Explorer to render pages in the highest available mode
|
||||
# in the various cases when it may not.
|
||||
# http://hsivonen.iki.fi/doctype/ie-mode.pdf
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
Header set X-UA-Compatible "IE=edge"
|
||||
# `mod_headers` cannot match based on the content-type, however, this
|
||||
# header should be send only for HTML pages and not for the other resources
|
||||
<FilesMatch "\.(appcache|atom|crx|css|cur|eot|f4[abpv]|flv|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|tt[cf]|vcf|vtt|webapp|web[mp]|woff|xml|xpi)$">
|
||||
Header unset X-UA-Compatible
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Cookie setting from iframes |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Allow cookies to be set from iframes in Internet Explorer.
|
||||
# http://msdn.microsoft.com/en-us/library/ms537343.aspx
|
||||
# http://www.w3.org/TR/2000/CR-P3P-20001215/
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
|
||||
# </IfModule>
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# # MIME TYPES AND ENCODING #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Proper MIME types for all files |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
<IfModule mod_mime.c>
|
||||
|
||||
# Audio
|
||||
AddType audio/mp4 m4a f4a f4b
|
||||
AddType audio/ogg oga ogg opus
|
||||
|
||||
# Data interchange
|
||||
AddType application/json json map
|
||||
AddType application/ld+json jsonld
|
||||
|
||||
# JavaScript
|
||||
# Normalize to standard type.
|
||||
# http://tools.ietf.org/html/rfc4329#section-7.2
|
||||
AddType application/javascript js
|
||||
|
||||
# Video
|
||||
AddType video/mp4 f4v f4p m4v mp4
|
||||
AddType video/ogg ogv
|
||||
AddType video/webm webm
|
||||
AddType video/x-flv flv
|
||||
|
||||
# Web fonts
|
||||
AddType application/font-woff woff
|
||||
AddType application/vnd.ms-fontobject eot
|
||||
|
||||
# Browsers usually ignore the font MIME types and simply sniff the bytes
|
||||
# to figure out the font type.
|
||||
# http://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern
|
||||
|
||||
# Chrome however, shows a warning if any other MIME types are used for
|
||||
# the following fonts.
|
||||
|
||||
AddType application/x-font-ttf ttc ttf
|
||||
AddType font/opentype otf
|
||||
|
||||
# Make SVGZ fonts work on the iPad.
|
||||
# https://twitter.com/FontSquirrel/status/14855840545
|
||||
AddType image/svg+xml svgz
|
||||
AddEncoding gzip svgz
|
||||
|
||||
# Other
|
||||
AddType application/octet-stream safariextz
|
||||
AddType application/x-chrome-extension crx
|
||||
AddType application/x-opera-extension oex
|
||||
AddType application/x-web-app-manifest+json webapp
|
||||
AddType application/x-xpinstall xpi
|
||||
AddType application/xml atom rdf rss xml
|
||||
AddType image/webp webp
|
||||
AddType image/x-icon cur
|
||||
AddType text/cache-manifest appcache manifest
|
||||
AddType text/vtt vtt
|
||||
AddType text/x-component htc
|
||||
AddType text/x-vcard vcf
|
||||
|
||||
</IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | UTF-8 encoding |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Use UTF-8 encoding for anything served as `text/html` or `text/plain`.
|
||||
AddDefaultCharset utf-8
|
||||
|
||||
# Force UTF-8 for certain file formats.
|
||||
<IfModule mod_mime.c>
|
||||
AddCharset utf-8 .atom .css .js .json .jsonld .rss .vtt .webapp .xml
|
||||
</IfModule>
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# # URL REWRITES #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Rewrite engine |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Turn on the rewrite engine and enable the `FollowSymLinks` option (this is
|
||||
# necessary in order for the following directives to work).
|
||||
|
||||
# If your web host doesn't allow the `FollowSymlinks` option, you may need to
|
||||
# comment it out and use `Options +SymLinksIfOwnerMatch`, but be aware of the
|
||||
# performance impact.
|
||||
# http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks
|
||||
|
||||
# Also, some cloud hosting services require `RewriteBase` to be set.
|
||||
# http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
Options +FollowSymlinks
|
||||
# Options +SymLinksIfOwnerMatch
|
||||
RewriteEngine On
|
||||
# RewriteBase /
|
||||
</IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Suppressing / Forcing the `www.` at the beginning of URLs |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# The same content should never be available under two different URLs,
|
||||
# especially not with and without `www.` at the beginning. This can cause
|
||||
# SEO problems (duplicate content), and therefore, you should choose one
|
||||
# of the alternatives and redirect the other one.
|
||||
|
||||
# By default `Option 1` (no `www.`) is activated.
|
||||
# http://no-www.org/faq.php?q=class_b
|
||||
|
||||
# If you would prefer to use `Option 2`, just comment out all the lines
|
||||
# from `Option 1` and uncomment the ones from `Option 2`.
|
||||
|
||||
# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Option 1: rewrite www.example.com → example.com
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
|
||||
</IfModule>
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Option 2: rewrite example.com → www.example.com
|
||||
|
||||
# Be aware that the following might not be a good idea if you use "real"
|
||||
# subdomains for certain parts of your website.
|
||||
|
||||
# <IfModule mod_rewrite.c>
|
||||
# RewriteCond %{HTTPS} !=on
|
||||
# RewriteCond %{HTTP_HOST} !^www\. [NC]
|
||||
# RewriteCond %{SERVER_ADDR} !=127.0.0.1
|
||||
# RewriteCond %{SERVER_ADDR} !=::1
|
||||
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||
# </IfModule>
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# # SECURITY #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Clickjacking |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Protect website against clickjacking.
|
||||
|
||||
# The example below sends the `X-Frame-Options` response header with the value
|
||||
# `DENY`, informing browsers not to display the web page content in any frame.
|
||||
|
||||
# This might not be the best setting for everyone. You should read about the
|
||||
# other two possible values for `X-Frame-Options`: `SAMEORIGIN` & `ALLOW-FROM`.
|
||||
# http://tools.ietf.org/html/rfc7034#section-2.1
|
||||
|
||||
# Keep in mind that while you could send the `X-Frame-Options` header for all
|
||||
# of your site’s pages, this has the potential downside that it forbids even
|
||||
# non-malicious framing of your content (e.g.: when users visit your site using
|
||||
# a Google Image Search results page).
|
||||
|
||||
# Nonetheless, you should ensure that you send the `X-Frame-Options` header for
|
||||
# all pages that allow a user to make a state changing operation (e.g: pages
|
||||
# that contain one-click purchase links, checkout or bank-transfer confirmation
|
||||
# pages, pages that make permanent configuration changes, etc.).
|
||||
|
||||
# Sending the `X-Frame-Options` header can also protect your website against
|
||||
# more than just clickjacking attacks: https://cure53.de/xfo-clickjacking.pdf.
|
||||
|
||||
# http://tools.ietf.org/html/rfc7034
|
||||
# http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx
|
||||
# https://www.owasp.org/index.php/Clickjacking
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set X-Frame-Options "DENY"
|
||||
# <FilesMatch "\.(appcache|atom|crx|css|cur|eot|f4[abpv]|flv|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|tt[cf]|vcf|vtt|webapp|web[mp]|woff|xml|xpi)$">
|
||||
# Header unset X-Frame-Options
|
||||
# </FilesMatch>
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Content Security Policy (CSP) |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Mitigate the risk of cross-site scripting and other content-injection attacks.
|
||||
|
||||
# This can be done by setting a `Content Security Policy` which whitelists
|
||||
# trusted sources of content for your website.
|
||||
|
||||
# The example header below allows ONLY scripts that are loaded from the current
|
||||
# site's origin (no inline scripts, no CDN, etc). This almost certainly won't
|
||||
# work as-is for your site!
|
||||
|
||||
# For more details on how to craft a reasonable policy for your site, read:
|
||||
# http://html5rocks.com/en/tutorials/security/content-security-policy (or the
|
||||
# specification: http://w3.org/TR/CSP). Also, to make things easier, you can
|
||||
# use an online CSP header generator such as: http://cspisawesome.com/.
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set Content-Security-Policy "script-src 'self'; object-src 'self'"
|
||||
# <FilesMatch "\.(appcache|atom|crx|css|cur|eot|f4[abpv]|flv|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|tt[cf]|vcf|vtt|webapp|web[mp]|woff|xml|xpi)$">
|
||||
# Header unset Content-Security-Policy
|
||||
# </FilesMatch>
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | File access |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Block access to directories without a default document.
|
||||
# You should leave the following uncommented, as you shouldn't allow anyone to
|
||||
# surf through every directory on your server (which may includes rather private
|
||||
# places such as the CMS's directories).
|
||||
|
||||
<IfModule mod_autoindex.c>
|
||||
Options -Indexes
|
||||
</IfModule>
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Block access to hidden files and directories.
|
||||
# This includes directories used by version control systems such as Git and SVN.
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteCond %{SCRIPT_FILENAME} -d [OR]
|
||||
RewriteCond %{SCRIPT_FILENAME} -f
|
||||
RewriteRule "(^|/)\." - [F]
|
||||
</IfModule>
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Block access to files that can expose sensitive information.
|
||||
|
||||
# By default, block access to backup and source files that may be left by some
|
||||
# text editors and can pose a security risk when anyone has access to them.
|
||||
# http://feross.org/cmsploit/
|
||||
|
||||
# IMPORTANT: Update the `<FilesMatch>` regular expression from below to include
|
||||
# any files that might end up on your production server and can expose sensitive
|
||||
# information about your website. These files may include: configuration files,
|
||||
# files that contain metadata about the project (e.g.: project dependencies),
|
||||
# build scripts, etc..
|
||||
|
||||
<FilesMatch "(^#.*#|\.(bak|config|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$">
|
||||
|
||||
# Apache < 2.3
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy All
|
||||
</IfModule>
|
||||
|
||||
# Apache ≥ 2.3
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
|
||||
</FilesMatch>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Reducing MIME-type security risks |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Prevent some browsers from MIME-sniffing the response.
|
||||
|
||||
# This reduces exposure to drive-by download attacks and should be enable
|
||||
# especially if the web server is serving user uploaded content, content
|
||||
# that could potentially be treated by the browser as executable.
|
||||
|
||||
# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
|
||||
# http://msdn.microsoft.com/en-us/library/ie/gg622941.aspx
|
||||
# http://mimesniff.spec.whatwg.org/
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set X-Content-Type-Options "nosniff"
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Reflected Cross-Site Scripting (XSS) attacks |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# (1) Try to re-enable the Cross-Site Scripting (XSS) filter built into the
|
||||
# most recent web browsers.
|
||||
#
|
||||
# The filter is usually enabled by default, but in some cases it may be
|
||||
# disabled by the user. However, in Internet Explorer for example, it can
|
||||
# be re-enabled just by sending the `X-XSS-Protection` header with the
|
||||
# value of `1`.
|
||||
#
|
||||
# (2) Prevent web browsers from rendering the web page if a potential reflected
|
||||
# (a.k.a non-persistent) XSS attack is detected by the filter.
|
||||
#
|
||||
# By default, if the filter is enabled and browsers detect a reflected
|
||||
# XSS attack, they will attempt to block the attack by making the smallest
|
||||
# possible modifications to the returned web page.
|
||||
#
|
||||
# Unfortunately, in some browsers (e.g.: Internet Explorer), this default
|
||||
# behavior may allow the XSS filter to be exploited, thereby, it's better
|
||||
# to tell browsers to prevent the rendering of the page altogether, instead
|
||||
# of attempting to modify it.
|
||||
#
|
||||
# http://hackademix.net/2009/11/21/ies-xss-filter-creates-xss-vulnerabilities
|
||||
#
|
||||
# IMPORTANT: Do not rely on the XSS filter to prevent XSS attacks! Ensure that
|
||||
# you are taking all possible measures to prevent XSS attacks, the most obvious
|
||||
# being: validating and sanitizing your site's inputs.
|
||||
#
|
||||
# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-iv-the-xss-filter.aspx
|
||||
# http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx
|
||||
# https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# # (1) (2)
|
||||
# Header set X-XSS-Protection "1; mode=block"
|
||||
# <FilesMatch "\.(appcache|atom|crx|css|cur|eot|f4[abpv]|flv|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|tt[cf]|vcf|vtt|webapp|web[mp]|woff|xml|xpi)$">
|
||||
# Header unset X-XSS-Protection
|
||||
# </FilesMatch>
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Secure Sockets Layer (SSL) |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Rewrite secure requests properly in order to prevent SSL certificate warnings.
|
||||
# E.g.: prevent `https://www.example.com` when your certificate only allows
|
||||
# `https://secure.example.com`.
|
||||
|
||||
# <IfModule mod_rewrite.c>
|
||||
# RewriteCond %{SERVER_PORT} !^443
|
||||
# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | HTTP Strict Transport Security (HSTS) |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Force client-side SSL redirection.
|
||||
|
||||
# If a user types `example.com` in his browser, the above rule will redirect
|
||||
# him to the secure version of the site. That still leaves a window of
|
||||
# opportunity (the initial HTTP connection) for an attacker to downgrade or
|
||||
# redirect the request.
|
||||
|
||||
# The following header ensures that browser will ONLY connect to your server
|
||||
# via HTTPS, regardless of what the users type in the address bar.
|
||||
|
||||
# http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-6.1
|
||||
# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/
|
||||
|
||||
# IMPORTANT: Remove the `includeSubDomains` optional directive if the subdomains
|
||||
# are not using HTTPS.
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set Strict-Transport-Security "max-age=16070400; includeSubDomains"
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Server software information |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Avoid displaying the exact Apache version number, the description of the
|
||||
# generic OS-type and the information about Apache's compiled-in modules.
|
||||
|
||||
# ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`!
|
||||
|
||||
# ServerTokens Prod
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# # WEB PERFORMANCE #
|
||||
# ##############################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Compression |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
<IfModule mod_deflate.c>
|
||||
|
||||
# Force compression for mangled headers.
|
||||
# http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
|
||||
<IfModule mod_setenvif.c>
|
||||
<IfModule mod_headers.c>
|
||||
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
|
||||
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
# Compress all output labeled with one of the following MIME-types
|
||||
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
|
||||
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
|
||||
# as `AddOutputFilterByType` is still in the core directives).
|
||||
<IfModule mod_filter.c>
|
||||
AddOutputFilterByType DEFLATE application/atom+xml \
|
||||
application/javascript \
|
||||
application/json \
|
||||
application/ld+json \
|
||||
application/rss+xml \
|
||||
application/vnd.ms-fontobject \
|
||||
application/x-font-ttf \
|
||||
application/x-web-app-manifest+json \
|
||||
application/xhtml+xml \
|
||||
application/xml \
|
||||
font/opentype \
|
||||
image/svg+xml \
|
||||
image/x-icon \
|
||||
text/css \
|
||||
text/html \
|
||||
text/plain \
|
||||
text/x-component \
|
||||
text/xml
|
||||
</IfModule>
|
||||
|
||||
</IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Content transformations |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Prevent mobile network providers from modifying the website's content.
|
||||
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5.
|
||||
|
||||
# <IfModule mod_headers.c>
|
||||
# Header set Cache-Control "no-transform"
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | ETags |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Remove `ETags` as resources are sent with far-future expires headers.
|
||||
# http://developer.yahoo.com/performance/rules.html#etags.
|
||||
|
||||
# `FileETag None` doesn't work in all cases.
|
||||
<IfModule mod_headers.c>
|
||||
Header unset ETag
|
||||
</IfModule>
|
||||
|
||||
FileETag None
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Expires headers |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# The following expires headers are set pretty far in the future. If you
|
||||
# don't control versioning with filename-based cache busting, consider
|
||||
# lowering the cache time for resources such as style sheets and JavaScript
|
||||
# files to something like one week.
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 month"
|
||||
|
||||
# CSS
|
||||
ExpiresByType text/css "access plus 1 year"
|
||||
|
||||
# Data interchange
|
||||
ExpiresByType application/json "access plus 0 seconds"
|
||||
ExpiresByType application/ld+json "access plus 0 seconds"
|
||||
ExpiresByType application/xml "access plus 0 seconds"
|
||||
ExpiresByType text/xml "access plus 0 seconds"
|
||||
|
||||
# Favicon (cannot be renamed!) and cursor images
|
||||
ExpiresByType image/x-icon "access plus 1 week"
|
||||
|
||||
# HTML components (HTCs)
|
||||
ExpiresByType text/x-component "access plus 1 month"
|
||||
|
||||
# HTML
|
||||
ExpiresByType text/html "access plus 0 seconds"
|
||||
|
||||
# JavaScript
|
||||
ExpiresByType application/javascript "access plus 1 year"
|
||||
|
||||
# Manifest files
|
||||
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
|
||||
ExpiresByType text/cache-manifest "access plus 0 seconds"
|
||||
|
||||
# Media
|
||||
ExpiresByType audio/ogg "access plus 1 month"
|
||||
ExpiresByType image/gif "access plus 1 month"
|
||||
ExpiresByType image/jpeg "access plus 1 month"
|
||||
ExpiresByType image/png "access plus 1 month"
|
||||
ExpiresByType video/mp4 "access plus 1 month"
|
||||
ExpiresByType video/ogg "access plus 1 month"
|
||||
ExpiresByType video/webm "access plus 1 month"
|
||||
|
||||
# Web feeds
|
||||
ExpiresByType application/atom+xml "access plus 1 hour"
|
||||
ExpiresByType application/rss+xml "access plus 1 hour"
|
||||
|
||||
# Web fonts
|
||||
ExpiresByType application/font-woff "access plus 1 month"
|
||||
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
||||
ExpiresByType application/x-font-ttf "access plus 1 month"
|
||||
ExpiresByType font/opentype "access plus 1 month"
|
||||
ExpiresByType image/svg+xml "access plus 1 month"
|
||||
|
||||
</IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | Filename-based cache busting |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# If you're not using a build process to manage your filename version revving,
|
||||
# you might want to consider enabling the following directives to route all
|
||||
# requests such as `/css/style.12345.css` to `/css/style.css`.
|
||||
|
||||
# To understand why this is important and a better idea than `*.css?v231`, read:
|
||||
# http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring
|
||||
|
||||
# <IfModule mod_rewrite.c>
|
||||
# RewriteCond %{REQUEST_FILENAME} !-f
|
||||
# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpe?g|gif)$ $1.$3 [L]
|
||||
# </IfModule>
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | File concatenation |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Allow concatenation from within specific style sheets and JavaScript files.
|
||||
|
||||
# e.g.:
|
||||
#
|
||||
# If you have the following content in a file
|
||||
#
|
||||
# <!--#include file="libs/jquery.js" -->
|
||||
# <!--#include file="plugins/jquery.timer.js" -->
|
||||
#
|
||||
# Apache will replace it with the content from the specified files.
|
||||
|
||||
# <IfModule mod_include.c>
|
||||
# <FilesMatch "\.combined\.js$">
|
||||
# Options +Includes
|
||||
# AddOutputFilterByType INCLUDES application/javascript application/json
|
||||
# SetOutputFilter INCLUDES
|
||||
# </FilesMatch>
|
||||
# <FilesMatch "\.combined\.css$">
|
||||
# Options +Includes
|
||||
# AddOutputFilterByType INCLUDES text/css
|
||||
# SetOutputFilter INCLUDES
|
||||
# </FilesMatch>
|
||||
# </IfModule>
|
||||
@@ -1,157 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Page Not Found :(</title>
|
||||
<style>
|
||||
::-moz-selection {
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: #b3d4fc;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
html {
|
||||
padding: 30px 10px;
|
||||
font-size: 20px;
|
||||
line-height: 1.4;
|
||||
color: #737373;
|
||||
background: #f0f0f0;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
html,
|
||||
input {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 500px;
|
||||
_width: 500px;
|
||||
padding: 30px 20px 50px;
|
||||
border: 1px solid #b3b3b3;
|
||||
border-radius: 4px;
|
||||
margin: 0 auto;
|
||||
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
|
||||
background: #fcfcfc;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0 10px;
|
||||
font-size: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 span {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 1.5em 0 0.5em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0 0 0 40px;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 380px;
|
||||
_width: 380px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* google search */
|
||||
|
||||
#goog-fixurl ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#goog-fixurl form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#goog-wm-qt,
|
||||
#goog-wm-sb {
|
||||
border: 1px solid #bbb;
|
||||
font-size: 16px;
|
||||
line-height: normal;
|
||||
vertical-align: top;
|
||||
color: #444;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
#goog-wm-qt {
|
||||
width: 220px;
|
||||
height: 20px;
|
||||
padding: 5px;
|
||||
margin: 5px 10px 0 0;
|
||||
box-shadow: inset 0 1px 1px #ccc;
|
||||
}
|
||||
|
||||
#goog-wm-sb {
|
||||
display: inline-block;
|
||||
height: 32px;
|
||||
padding: 0 10px;
|
||||
margin: 5px 0 0;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
background-color: #f5f5f5;
|
||||
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
*overflow: visible;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
}
|
||||
|
||||
#goog-wm-sb:hover,
|
||||
#goog-wm-sb:focus {
|
||||
border-color: #aaa;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
#goog-wm-qt:hover,
|
||||
#goog-wm-qt:focus {
|
||||
border-color: #105cb6;
|
||||
outline: 0;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
input::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Not found <span>:(</span></h1>
|
||||
<p>Sorry, but the page you were trying to view does not exist.</p>
|
||||
<p>It looks like this was the result of either:</p>
|
||||
<ul>
|
||||
<li>a mistyped address</li>
|
||||
<li>an out-of-date link</li>
|
||||
</ul>
|
||||
<script>
|
||||
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
|
||||
</script>
|
||||
<script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="100%" height="100%" viewBox="0 0 256 256" xml:space="preserve">
|
||||
<path fill="#D65906" d="M128,32c52.935,0,96,43.065,96,96s-43.065,96-96,96s-96-43.065-96-96S75.065,32,128,32 M128,8
|
||||
C61.726,8,8,61.726,8,128s53.726,120,120,120s120-53.726,120-120S194.274,8,128,8L128,8z"/>
|
||||
<path fill="#D65906" d="M128,53c-41.422,0-75,33.579-75,75s33.578,75,75,75c41.421,0,75-33.579,75-75S169.421,53,128,53z
|
||||
M156.932,163.617c-1.012,1.29-2.353,2.451-4.02,3.483c-1.668,1.032-3.584,1.936-5.748,2.71s-4.398,1.42-6.7,1.936
|
||||
c-2.304,0.517-4.597,0.903-6.88,1.162c-2.283,0.258-4.397,0.387-6.343,0.387c-5.876,0-11.355-0.982-16.438-2.948
|
||||
c-5.083-1.966-9.491-4.845-13.222-8.636c-3.732-3.793-6.671-8.458-8.815-13.997s-3.216-11.882-3.216-19.028
|
||||
c0-7.227,1.062-13.688,3.187-19.388c2.124-5.697,5.092-10.512,8.904-14.442c3.812-3.932,8.348-6.939,13.609-9.023
|
||||
c5.261-2.084,11.028-3.127,17.302-3.127c4.964,0,9.28,0.308,12.954,0.924c3.672,0.615,6.721,1.459,9.143,2.531
|
||||
s4.229,2.342,5.42,3.811c1.191,1.47,1.787,3.059,1.787,4.766c0,1.151-0.238,2.154-0.715,3.008s-1.102,1.559-1.877,2.113
|
||||
c-0.773,0.557-1.637,0.964-2.59,1.222c-0.953,0.259-1.906,0.388-2.859,0.388c-0.557,0-1.111-0.011-1.668-0.03
|
||||
c-0.557-0.021-1.093-0.109-1.607-0.269c-1.51-0.396-2.949-0.783-4.318-1.161c-1.37-0.377-2.72-0.704-4.05-0.982
|
||||
c-1.331-0.278-2.661-0.507-3.991-0.685c-1.33-0.179-2.709-0.269-4.139-0.269c-2.979,0-5.787,0.446-8.428,1.341
|
||||
c-2.641,0.893-4.935,2.471-6.879,4.734c-1.945,2.264-3.484,5.33-4.616,9.202c-1.132,3.871-1.698,8.805-1.698,14.8
|
||||
c0,4.606,0.456,8.746,1.37,12.419c0.913,3.673,2.272,6.789,4.08,9.351s4.07,4.526,6.79,5.896c2.719,1.369,5.887,2.055,9.5,2.055
|
||||
c1.469,0,2.998-0.158,4.586-0.477c1.587-0.318,3.217-0.725,4.884-1.222c1.667-0.495,3.364-1.062,5.092-1.696
|
||||
c1.728-0.636,3.444-1.271,5.151-1.906c0.517-0.159,1.152-0.238,1.906-0.238c0.992,0,1.896,0.188,2.711,0.565
|
||||
c0.812,0.377,1.518,0.884,2.114,1.52c0.595,0.635,1.052,1.379,1.37,2.233c0.317,0.854,0.476,1.757,0.476,2.71
|
||||
C158.45,160.907,157.943,162.326,156.932,163.617z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -1,3 +0,0 @@
|
||||
# robotstxt.org/
|
||||
|
||||
User-agent: *
|
||||
7
client/app/scripts/local.js
Normal file
7
client/app/scripts/local.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is an entrypoint for development,
|
||||
// see main.js for the real entrypoint
|
||||
|
||||
// Inject websocket url to dev backend
|
||||
window.WS_URL = 'ws://' + location.hostname + ':4040';
|
||||
|
||||
require('./main');
|
||||
|
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 741 B |
@@ -14,10 +14,6 @@
|
||||
<div id="app"></div>
|
||||
</div>
|
||||
|
||||
<!-- @ifdef DEBUG -->
|
||||
<script>window.WS_URL = 'ws://' + location.hostname + ':4040';</script>
|
||||
<!-- @endif -->
|
||||
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Gulpfile based on https://github.com/kriasoft/react-starter-kit
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var $ = require('gulp-load-plugins')();
|
||||
var del = require('del');
|
||||
var path = require('path');
|
||||
var runSequence = require('run-sequence');
|
||||
var webpack = require('webpack');
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
var watch = false;
|
||||
var browserSync;
|
||||
|
||||
// The default task
|
||||
gulp.task('default', ['build']);
|
||||
|
||||
// Clean output directory
|
||||
gulp.task('clean', del.bind(
|
||||
null, ['.tmp', 'build/*'], {dot: true}
|
||||
));
|
||||
|
||||
// Favicon
|
||||
gulp.task('favicon', function() {
|
||||
return gulp.src(['app/favicon.ico'])
|
||||
.pipe(gulp.dest('build'));
|
||||
});
|
||||
|
||||
|
||||
// Static files
|
||||
gulp.task('html', function() {
|
||||
var release = !!argv.release;
|
||||
|
||||
return gulp.src('app/*.html')
|
||||
.pipe($.changed('build'))
|
||||
.pipe($.if(release, $.preprocess()))
|
||||
.pipe(gulp.dest('build'))
|
||||
.pipe($.size({title: 'html'}));
|
||||
});
|
||||
|
||||
// Bundle
|
||||
gulp.task('bundle', function(cb) {
|
||||
var started = false;
|
||||
var config = require('./webpack.config.js');
|
||||
var bundler = webpack(config);
|
||||
var verbose = !!argv.verbose;
|
||||
|
||||
function bundle(err, stats) {
|
||||
if (err) {
|
||||
throw new $.util.PluginError('webpack', err);
|
||||
}
|
||||
|
||||
console.log(stats.toString({
|
||||
colors: $.util.colors.supportsColor,
|
||||
hash: verbose,
|
||||
version: verbose,
|
||||
timings: verbose,
|
||||
chunks: verbose,
|
||||
chunkModules: verbose,
|
||||
cached: verbose,
|
||||
cachedAssets: verbose
|
||||
}));
|
||||
|
||||
if (!started) {
|
||||
started = true;
|
||||
return cb();
|
||||
}
|
||||
}
|
||||
|
||||
if (watch) {
|
||||
bundler.watch(200, bundle);
|
||||
} else {
|
||||
bundler.run(bundle);
|
||||
}
|
||||
});
|
||||
|
||||
// Build the app from source code
|
||||
gulp.task('build', ['clean'], function(cb) {
|
||||
runSequence(['html', 'favicon', 'bundle'], cb);
|
||||
});
|
||||
|
||||
// Build and start watching for modifications
|
||||
gulp.task('build:watch', function(cb) {
|
||||
watch = true;
|
||||
runSequence('build', function() {
|
||||
gulp.watch('app/*.html', ['html']);
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
||||
// Launch a Node.js/Express server
|
||||
gulp.task('serve', ['build:watch'], function() {
|
||||
$.connect.server({
|
||||
root: ['build'],
|
||||
port: 4041,
|
||||
middleware: function() {
|
||||
return [(function() {
|
||||
var url = require('url');
|
||||
var proxy = require('proxy-middleware');
|
||||
var options = url.parse('http://localhost:4040/api');
|
||||
options.route = '/api';
|
||||
return proxy(options);
|
||||
})()];
|
||||
},
|
||||
livereload: false
|
||||
});
|
||||
});
|
||||
|
||||
// Launch BrowserSync development server
|
||||
gulp.task('sync', ['serve'], function(cb) {
|
||||
browserSync = require('browser-sync');
|
||||
|
||||
browserSync({
|
||||
logPrefix: 'RSK',
|
||||
// Stop the browser from automatically opening
|
||||
open: false,
|
||||
notify: false,
|
||||
// Run as an https by setting 'https: true'
|
||||
// Note: this uses an unsigned certificate which on first access
|
||||
// will present a certificate warning in the browser.
|
||||
https: false,
|
||||
// Will not attempt to determine your network status, assumes you're OFFLINE
|
||||
online: false,
|
||||
port: 4042,
|
||||
// Informs browser-sync to proxy our Express app which would run
|
||||
// at the following location
|
||||
proxy: 'localhost:4041',
|
||||
// dont refresh immediately after successive changes
|
||||
reloadDebounce: 2000,
|
||||
// browserSync webapp
|
||||
ui: {
|
||||
port: 4043
|
||||
}
|
||||
}, cb);
|
||||
|
||||
process.on('exit', function() {
|
||||
browserSync.exit();
|
||||
});
|
||||
|
||||
gulp.watch('build/**/*.*', browserSync.reload);
|
||||
|
||||
// FIX this part to only reload styles parts that changed
|
||||
// gulp.watch(['build/**/*.*'].concat(
|
||||
// src.server.map(function(file) { return '!' + file; })
|
||||
// ), function(file) {
|
||||
// browserSync.reload(path.relative(__dirname, file.path));
|
||||
// });
|
||||
});
|
||||
|
||||
// Lint
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src(['app/**/*.js'])
|
||||
// eslint() attaches the lint output to the eslint property
|
||||
// of the file object so it can be used by other modules.
|
||||
.pipe($.eslint())
|
||||
// eslint.format() outputs the lint results to the console.
|
||||
// Alternatively use eslint.formatEach() (see Docs).
|
||||
.pipe($.eslint.format())
|
||||
// To have the process exit with an error code (1) on
|
||||
// lint error, return the stream and pipe to failOnError last.
|
||||
.pipe($.eslint.failOnError());
|
||||
});
|
||||
@@ -11,6 +11,7 @@
|
||||
"debug": "^2.2.0",
|
||||
"flux": "^2.0.3",
|
||||
"font-awesome": "^4.3.0",
|
||||
"font-awesome-webpack": "0.0.3",
|
||||
"keymirror": "^0.1.1",
|
||||
"lodash": "~3.9.3",
|
||||
"material-ui": "~0.7.5",
|
||||
@@ -28,27 +29,14 @@
|
||||
"babel-core": "^5.4.7",
|
||||
"babel-eslint": "^3.1.9",
|
||||
"babel-loader": "^5.1.3",
|
||||
"babelify": "^6.1.2",
|
||||
"browser-sync": "^2.7.6",
|
||||
"css-loader": "^0.14.4",
|
||||
"del": "^1.2.0",
|
||||
"eslint": "^0.21.2",
|
||||
"eslint-loader": "^0.11.2",
|
||||
"eslint-plugin-jasmine": "^1.0.0",
|
||||
"eslint-plugin-react": "^2.3.0",
|
||||
"express": "^4.13.3",
|
||||
"express-http-proxy": "^0.6.0",
|
||||
"file-loader": "^0.8.4",
|
||||
"font-awesome-webpack": "0.0.3",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-autoprefixer": "^2.3.0",
|
||||
"gulp-changed": "^1.2.1",
|
||||
"gulp-connect": "^2.2.0",
|
||||
"gulp-eslint": "^0.12.0",
|
||||
"gulp-filter": "^2.0.2",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-load-plugins": "^0.10.0",
|
||||
"gulp-preprocess": "^1.2.0",
|
||||
"gulp-size": "^1.2.1",
|
||||
"gulp-util": "^3.0.4",
|
||||
"istanbul-instrumenter-loader": "^0.1.3",
|
||||
"jasmine-core": "^2.3.4",
|
||||
"karma": "^0.13.3",
|
||||
@@ -59,24 +47,26 @@
|
||||
"karma-webpack": "^1.7.0",
|
||||
"less": "^2.5.1",
|
||||
"less-loader": "^2.2.0",
|
||||
"minimist": "^1.1.1",
|
||||
"node-libs-browser": "^0.5.2",
|
||||
"phantomjs": "^1.9.18",
|
||||
"postcss-loader": "^0.4.3",
|
||||
"proxy-middleware": "^0.12.0",
|
||||
"proxy-middleware": "^0.13.1",
|
||||
"react-hot-loader": "^1.2.8",
|
||||
"react-tools": "^0.13.3",
|
||||
"reactify": "^1.1.1",
|
||||
"run-sequence": "^1.1.0",
|
||||
"style-loader": "^0.12.3",
|
||||
"url": "^0.10.3",
|
||||
"url-loader": "^0.5.6",
|
||||
"vinyl-buffer": "^1.0.0",
|
||||
"vinyl-source-stream": "^1.1.0",
|
||||
"webpack": "^1.9.10"
|
||||
"webpack": "^1.9.10",
|
||||
"webpack-dev-server": "^1.10.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "gulp lint",
|
||||
"start": "gulp",
|
||||
"test": "karma start test/karma.conf.js --single-run"
|
||||
"postinstall": "npm run build",
|
||||
"build": "webpack -p --config webpack.production.config.js",
|
||||
"start": "node server.js",
|
||||
"start-production": "NODE_ENV=production node server.js",
|
||||
"test": "karma start test/karma.conf.js --single-run",
|
||||
"coveralls": "cat coverage/lcov.info | coveralls",
|
||||
"lint": "eslint app",
|
||||
"clean": "rm build/app.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
||||
88
client/server.js
Normal file
88
client/server.js
Normal file
@@ -0,0 +1,88 @@
|
||||
var express = require('express');
|
||||
var proxy = require('proxy-middleware');
|
||||
var httpProxy = require('express-http-proxy');
|
||||
var url = require('url');
|
||||
|
||||
var app = express();
|
||||
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Express routes for:
|
||||
* - app.js
|
||||
* - index.html
|
||||
*
|
||||
* Proxy requests to:
|
||||
* - /api -> :4040/api
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// Serve application file depending on environment
|
||||
app.get('/app.js', function(req, res) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
res.sendFile(__dirname + '/build/app.js');
|
||||
} else {
|
||||
res.redirect('//localhost:4041/build/app.js');
|
||||
}
|
||||
});
|
||||
|
||||
// Proxy to backend
|
||||
|
||||
// HACK need express-http-proxy, because proxy-middleware does
|
||||
// not proxy to /api itself
|
||||
app.use(httpProxy('localhost:4040', {
|
||||
filter: function(req) {
|
||||
return url.parse(req.url).path === '/api';
|
||||
},
|
||||
forwardPath: function(req) {
|
||||
return url.parse(req.url).path;
|
||||
}
|
||||
}));
|
||||
|
||||
app.use('/api', proxy('http://localhost:4040/api/'));
|
||||
|
||||
// Serve index page
|
||||
|
||||
app.use(express.static('build'));
|
||||
|
||||
|
||||
/*************************************************************
|
||||
*
|
||||
* Webpack Dev Server
|
||||
*
|
||||
* See: http://webpack.github.io/docs/webpack-dev-server.html
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var webpack = require('webpack');
|
||||
var WebpackDevServer = require('webpack-dev-server');
|
||||
var config = require('./webpack.local.config');
|
||||
|
||||
new WebpackDevServer(webpack(config), {
|
||||
publicPath: config.output.publicPath,
|
||||
hot: true,
|
||||
noInfo: true,
|
||||
historyApiFallback: true,
|
||||
stats: { colors: true }
|
||||
}).listen(4041, 'localhost', function (err, result) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
*
|
||||
* Express server
|
||||
*
|
||||
*****************/
|
||||
|
||||
var port = process.env.PORT || 4042;
|
||||
var server = app.listen(port, function () {
|
||||
var host = server.address().address;
|
||||
var port = server.address().port;
|
||||
|
||||
console.log('Scope UI listening at http://%s:%s', host, port);
|
||||
});
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Webpack config based on https://github.com/kriasoft/react-starter-kit
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var autoprefixer = require('autoprefixer-core');
|
||||
var _ = require('lodash');
|
||||
var webpack = require('webpack');
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
var DEBUG = !argv.release;
|
||||
var STYLE_LOADER = 'style-loader';
|
||||
var CSS_LOADER = DEBUG ? 'css-loader' : 'css-loader?minimize';
|
||||
var AUTOPREFIXER_LOADER = 'postcss-loader';
|
||||
|
||||
//
|
||||
// Common configuration chunk to be used for both
|
||||
// client-side (app.js) and server-side (server.js) bundles
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
var config = {
|
||||
output: {
|
||||
path: './build/',
|
||||
publicPath: './',
|
||||
sourcePrefix: ' '
|
||||
},
|
||||
|
||||
bail: !DEBUG, // fail on first error when building release
|
||||
cache: DEBUG,
|
||||
debug: DEBUG,
|
||||
devtool: DEBUG ? '#inline-source-map' : false,
|
||||
|
||||
stats: {
|
||||
colors: true,
|
||||
reasons: DEBUG
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new webpack.optimize.OccurenceOrderPlugin()
|
||||
],
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx']
|
||||
},
|
||||
|
||||
module: {
|
||||
preLoaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'eslint-loader'
|
||||
}
|
||||
],
|
||||
|
||||
loaders: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: STYLE_LOADER + '!' + CSS_LOADER + '!' + AUTOPREFIXER_LOADER
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
loader: STYLE_LOADER + '!' + CSS_LOADER + '!' + AUTOPREFIXER_LOADER +
|
||||
'!less-loader'
|
||||
},
|
||||
{
|
||||
test: /\.gif/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/gif'
|
||||
},
|
||||
{
|
||||
test: /\.jpg/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/jpg'
|
||||
},
|
||||
{
|
||||
test: /\.png/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/png'
|
||||
},
|
||||
{
|
||||
test: /\.svg/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
|
||||
},
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader'
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: 'url-loader?limit=10000&minetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: 'file-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
postcss: [
|
||||
autoprefixer({
|
||||
browsers: ['last 2 version']
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
//
|
||||
// Configuration for the client-side bundle (app.js)
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
var appConfig = _.merge({}, config, {
|
||||
entry: './app/scripts/main.js',
|
||||
output: {
|
||||
filename: 'app.js'
|
||||
},
|
||||
plugins: config.plugins.concat(DEBUG ? [] : [
|
||||
new webpack.optimize.DedupePlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}),
|
||||
new webpack.optimize.AggressiveMergingPlugin()
|
||||
]
|
||||
)
|
||||
});
|
||||
|
||||
module.exports = [appConfig];
|
||||
81
client/webpack.local.config.js
Normal file
81
client/webpack.local.config.js
Normal file
@@ -0,0 +1,81 @@
|
||||
var webpack = require('webpack');
|
||||
var autoprefixer = require('autoprefixer-core');
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* This is the Webpack configuration file for local development. It contains
|
||||
* local-specific configuration such as the React Hot Loader, as well as:
|
||||
*
|
||||
* - The entry point of the application
|
||||
* - Where the output file should be
|
||||
* - Which loaders to use on what files to properly transpile the source
|
||||
*
|
||||
* For more information, see: http://webpack.github.io/docs/configuration.html
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
// Efficiently evaluate modules with source maps
|
||||
devtool: 'eval',
|
||||
|
||||
// Set entry point include necessary files for hot load
|
||||
entry: [
|
||||
'webpack-dev-server/client?http://localhost:4041',
|
||||
'webpack/hot/only-dev-server',
|
||||
'./app/scripts/local'
|
||||
],
|
||||
|
||||
// This will not actually create a app.js file in ./build. It is used
|
||||
// by the dev server for dynamic hot loading.
|
||||
output: {
|
||||
path: path.join(__dirname, 'build/'),
|
||||
filename: 'app.js',
|
||||
publicPath: 'http://localhost:4041/build/'
|
||||
},
|
||||
|
||||
// Necessary plugins for hot load
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoErrorsPlugin()
|
||||
],
|
||||
|
||||
// Transform source code using Babel and React Hot Loader
|
||||
module: {
|
||||
preLoaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'eslint-loader'
|
||||
}
|
||||
],
|
||||
loaders: [
|
||||
{
|
||||
test: /\.less$/,
|
||||
loader: 'style-loader!css-loader!postcss-loader!less-loader'
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: 'url-loader?limit=10000&minetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: 'file-loader'
|
||||
},
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /node_modules/,
|
||||
loaders: ['react-hot', 'babel-loader?stage=0']
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
postcss: [
|
||||
autoprefixer({
|
||||
browsers: ['last 2 versions']
|
||||
})
|
||||
],
|
||||
|
||||
// Automatically transform files with these extensions
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx']
|
||||
}
|
||||
};
|
||||
64
client/webpack.production.config.js
Normal file
64
client/webpack.production.config.js
Normal file
@@ -0,0 +1,64 @@
|
||||
var webpack = require('webpack');
|
||||
var autoprefixer = require('autoprefixer-core');
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* This is the Webpack configuration file for production.
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
// fail on first error when building release
|
||||
bail: true,
|
||||
|
||||
entry: './app/scripts/main',
|
||||
|
||||
output: {
|
||||
path: path.join(__dirname, 'build/'),
|
||||
filename: 'app.js'
|
||||
},
|
||||
|
||||
module: {
|
||||
preLoaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'eslint-loader'
|
||||
}
|
||||
],
|
||||
loaders: [
|
||||
{
|
||||
test: /\.less$/,
|
||||
loader: 'style-loader!css-loader?minimize!postcss-loader!less-loader'
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: 'url-loader?limit=10000&minetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: 'file-loader'
|
||||
},
|
||||
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?stage=0' }
|
||||
]
|
||||
},
|
||||
|
||||
postcss: [
|
||||
autoprefixer({
|
||||
browsers: ['last 2 versions']
|
||||
})
|
||||
],
|
||||
|
||||
eslint: {
|
||||
failOnError: true
|
||||
},
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx']
|
||||
},
|
||||
|
||||
plugins: [new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
})]
|
||||
};
|
||||
Reference in New Issue
Block a user