Skip to content
Permalink
Browse files

new debug structure

  • Loading branch information...
mikekasprzak committed Nov 16, 2017
1 parent 6f3c206 commit cd64fa2a74ffd787b642ce12a55a242a81bdb5ad
1 .npmrc
@@ -1 +1,2 @@
package-lock=false
save=false
@@ -19,6 +19,12 @@ endif # MAIN_FOLDER
JOBS := -j $(JOBS)
endif # JOBS

ifndef MAIN_FOLDER
ifdef DEBUG
$(info [*] Debug output enabled)
endif # DEBUG
endif # MAIN_FOLDER

# TODO: REMOVE THIS
STATIC_DOMAIN ?= static.jammer.work

@@ -27,7 +33,7 @@ ifdef WINDOWS_HOST
ifndef MAIN_FOLDER
$(info [*] Running on WINDOWS_HOST)
endif # MAIN_FOLDER
COPY_UNMIN := true
#COPY_UNMIN := true
endif # WINDOWS_HOST

# Include Folders (modified by recursive scripts) #
@@ -89,6 +95,9 @@ BUBLE = $(NODEJS)/buble/bin/buble $(BUBLE_ARGS) $(1) -o $(2)
# ES Include/Require Resolver: http://rollupjs.org/guide/
ROLLUP_ARGS := -c src/config/rollup.config.js
ROLLUP = $(NODEJS)/rollup/bin/rollup $(ROLLUP_ARGS) $(1) > $(2)
# JS Preprocessor: https://github.com/moisesbaez/preprocess-cli-tool
JS_PP_DEBUG = $(NODEJS)/preprocess-cli-tool/bin/preprocess.js -f $(1) -d $(2) -c '{"DEBUG": true}' -t js
JS_PP_RELEASE = $(NODEJS)/preprocess-cli-tool/bin/preprocess.js -f $(1) -d $(2) -t js
# JS Minifier: https://github.com/mishoo/UglifyJS2
MINIFY_JS_RESERVED := VERSION_STRING,STATIC_DOMAIN
MINIFY_JS_ARGS := --compress --mangle -r "$(MINIFY_JS_RESERVED)"
@@ -127,9 +136,11 @@ default: target

report: $(TARGET_FILES)
@echo \
"[JS] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.min.js 2>/dev/null)` (`$(call GZIP_SIZE,$(BUILD_FOLDER)/all.js 2>/dev/null)`) [Minified: `$(call SIZE,$(TARGET_FOLDER)/all.min.js 2>/dev/null)`] [Original: `$(call SIZE,$(BUILD_FOLDER)/all.js 2>/dev/null)`]\n" \
"[CSS] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.min.css 2>/dev/null)` (`$(call GZIP_SIZE,$(BUILD_FOLDER)/all.css 2>/dev/null)`) [Minified: `$(call SIZE,$(TARGET_FOLDER)/all.min.css 2>/dev/null)`] [Original: `$(call SIZE,$(BUILD_FOLDER)/all.css 2>/dev/null)`]\n" \
"[SVG] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.min.svg 2>/dev/null)` (`$(call GZIP_SIZE,$(BUILD_FOLDER)/all.svg 2>/dev/null)`) [Minified: `$(call SIZE,$(TARGET_FOLDER)/all.min.svg 2>/dev/null)`] [Original: `$(call SIZE,$(BUILD_FOLDER)/all.svg 2>/dev/null)`]\n" \
"[JS_RAW] GZIP: `$(call GZIP_SIZE,$(BUILD_FOLDER)/all.js 2>/dev/null)` MINIFY: N/A ORIGINAL: `$(call SIZE,$(BUILD_FOLDER)/all.js 2>/dev/null)`\n" \
"[JS_DEBUG] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.debug.js 2>/dev/null)` MINIFY: `$(call SIZE,$(TARGET_FOLDER)/all.debug.js 2>/dev/null)`* ORIGINAL: `$(call SIZE,$(BUILD_FOLDER)/all.debug.js 2>/dev/null)`\n" \
"[JS_RELEASE] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.min.js 2>/dev/null)` MINIFY: `$(call SIZE,$(TARGET_FOLDER)/all.min.js 2>/dev/null)` ORIGINAL: `$(call SIZE,$(BUILD_FOLDER)/all.release.js 2>/dev/null)`\n" \
"[CSS] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.min.css 2>/dev/null)` MINIFY: `$(call SIZE,$(TARGET_FOLDER)/all.min.css 2>/dev/null)` ORIGINAL: `$(call SIZE,$(BUILD_FOLDER)/all.css 2>/dev/null)`\n" \
"[SVG] GZIP: `$(call GZIP_SIZE,$(TARGET_FOLDER)/all.min.svg 2>/dev/null)` MINIFY: `$(call SIZE,$(TARGET_FOLDER)/all.min.svg 2>/dev/null)` ORIGINAL: `$(call SIZE,$(BUILD_FOLDER)/all.svg 2>/dev/null)`\n" \
| column -t

# If not called recursively, figure out who the targes are and call them #
@@ -273,11 +284,18 @@ $(BUILD_FOLDER)/buble.js: $(OUT_MAIN_JS) $(OUT_ES_FILES)
mv $@.tmp $@
$(BUILD_FOLDER)/all.js: $(BUILD_FOLDER)/js.js $(BUILD_FOLDER)/buble.js
cat $^ > $@
$(TARGET_FOLDER)/all.min.js: $(BUILD_FOLDER)/all.js
$(BUILD_FOLDER)/all.release.js: $(BUILD_FOLDER)/all.js
$(call JS_PP_DEBUG,$<,$(@D)/all.debug.js)
$(call JS_PP_RELEASE,$<,$@)
$(TARGET_FOLDER)/all.min.js: $(BUILD_FOLDER)/all.release.js
$(call MINIFY_JS,$<,$@)
ifdef COPY_UNMIN
cp -f --remove-destination $< $(subst all.min.js,all.js,$@)
endif # COPY_UNMIN
ifdef DEBUG
cp -f --remove-destination $(<D)/all.debug.js $(@D)/all.debug.js
endif

#ifdef COPY_UNMIN
# cp -f --remove-destination $< $(subst all.min.js,all.js,$@)
#endif # COPY_UNMIN

# CSS #
$(BUILD_FOLDER)/css.css: $(OUT_CSS_FILES)
@@ -288,9 +306,9 @@ $(BUILD_FOLDER)/all.css: $(BUILD_FOLDER)/css.css $(BUILD_FOLDER)/less.css
cat $^ > $@
$(TARGET_FOLDER)/all.min.css: $(BUILD_FOLDER)/all.css
$(call MINIFY_CSS,$<,$@)
ifdef COPY_UNMIN
cp -f --remove-destination $< $(subst all.min.css,all.css,$@)
endif # COPY_UNMIN
#ifdef COPY_UNMIN
# cp -f --remove-destination $< $(subst all.min.css,all.css,$@)
#endif # COPY_UNMIN

# SVG # src/icons/icomoon/icons.svg
$(BUILD_FOLDER)/svg.svg: $(OUT_SVG_FILES)
@@ -302,9 +320,9 @@ $(BUILD_FOLDER)/all.svg: $(BUILD_FOLDER)/svg.svg
cat $^ > $@
$(TARGET_FOLDER)/all.min.svg: $(BUILD_FOLDER)/all.svg
$(call MINIFY_SVG,$<,$@)
ifdef COPY_UNMIN
cp -f --remove-destination $< $(subst all.min.svg,all.svg,$@)
endif # COPY_UNMIN
#ifdef COPY_UNMIN
# cp -f --remove-destination $< $(subst all.min.svg,all.svg,$@)
#endif # COPY_UNMIN

# Target #
target: $(OUT_FOLDERS) $(BUILD_FOLDER)/buble.lint $(BUILD_FOLDER)/less.lint $(TARGET_FILES) report
@@ -15,6 +15,7 @@
"rollup-plugin-node-resolve": "*",
"rollup-plugin-nodent": "*",
"uglify-js": "*",
"preprocess-cli-tool": "*",

"less": "*",
"less-plugin-autoprefix": "*",
@@ -0,0 +1,9 @@

console.log("Hey");

// @ifdef DEBUG
console.log("DEBUG MODE");
// @endif

console.log("Fafter");

@@ -11,15 +11,15 @@ cd $SCRIPTPATH
(cd apache ; sh add-ports.sh)

# Add Symlinks to output files
ln -svf ../../.output/.build/public-ludumdare.com/all.js /vagrant/www/public-ludumdare.com/-/all.js
ln -svf ../../.output/.build/public-ludumdare.com/all.css /vagrant/www/public-ludumdare.com/-/all.css
ln -svf ../../.output/.build/public-ludumdare.com/all.svg /vagrant/www/public-ludumdare.com/-/all.svg
ln -svf ../../.output/.build/public-jammer.vg/all.js /vagrant/www/public-jammer.vg/-/all.js
ln -svf ../../.output/.build/public-jammer.vg/all.css /vagrant/www/public-jammer.vg/-/all.css
ln -svf ../../.output/.build/public-jammer.vg/all.svg /vagrant/www/public-jammer.vg/-/all.svg
ln -svf ../../.output/.build/public-jammer.bio/all.js /vagrant/www/public-jammer.bio/-/all.js
ln -svf ../../.output/.build/public-jammer.bio/all.css /vagrant/www/public-jammer.bio/-/all.css
ln -svf ../../.output/.build/public-jammer.bio/all.svg /vagrant/www/public-jammer.bio/-/all.svg
#ln -svf ../../.output/.build/public-ludumdare.com/all.js /vagrant/www/public-ludumdare.com/-/all.js
#ln -svf ../../.output/.build/public-ludumdare.com/all.css /vagrant/www/public-ludumdare.com/-/all.css
#ln -svf ../../.output/.build/public-ludumdare.com/all.svg /vagrant/www/public-ludumdare.com/-/all.svg
#ln -svf ../../.output/.build/public-jammer.vg/all.js /vagrant/www/public-jammer.vg/-/all.js
#ln -svf ../../.output/.build/public-jammer.vg/all.css /vagrant/www/public-jammer.vg/-/all.css
#ln -svf ../../.output/.build/public-jammer.vg/all.svg /vagrant/www/public-jammer.vg/-/all.svg
#ln -svf ../../.output/.build/public-jammer.bio/all.js /vagrant/www/public-jammer.bio/-/all.js
#ln -svf ../../.output/.build/public-jammer.bio/all.css /vagrant/www/public-jammer.bio/-/all.css
#ln -svf ../../.output/.build/public-jammer.bio/all.svg /vagrant/www/public-jammer.bio/-/all.svg

# Create tables
(cd /vagrant/www/src/shrub/tools; echo YES | php table-create)
@@ -1,6 +1,6 @@
import includePaths from 'rollup-plugin-includepaths';
//import nodeResolve from 'rollup-plugin-node-resolve';
import nodent from 'rollup-plugin-nodent';
//import nodent from 'rollup-plugin-nodent';

export default {
'output': {
@@ -20,12 +20,12 @@ export default {
}),

// NOTE: nodent doesn't fully supports rest-spread (yet). Neither does Buble/Rollup though
nodent({
'promises': true,
'noRuntime': true,
//'sourcemap': true,
//'es6target': true,
}),
// nodent({
// 'promises': true,
// 'noRuntime': true,
// //'sourcemap': true,
// //'es6target': true,
// }),

// nodeResolve({
// 'jsnext': true
@@ -1,3 +1,4 @@
// @ifdef DEBUG
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */

import { options } from '../preact/preact';
@@ -389,3 +390,7 @@ export function initDevTools() {
options.beforeUnmount = nextBeforeUnmount;
};
}

// MK
initDevTools();
// @endif
@@ -4,6 +4,7 @@
echo "<h1>Update in progress</h1><p>Please check back in a few minutes.</p>";
die();
}
if ( !isset($_GET['ignore']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE') !== false ) {
include __DIR__."/../embed/obsolete-browser.php";
die();
@@ -12,8 +13,8 @@
@include __DIR__."/../shrub/config.php";
// TODO: Figure out if this is the live server, and disable this feature if it is //
define( 'SITE_DEBUG', isset($_GET['debug'])?1:0 );
define( 'USE_MINIFIED', SITE_DEBUG ? '' : '.min' );
define( 'DEBUG', isset($_GET['debug'])?1:0 );
define( 'USE_MINIFIED', DEBUG ? '.debug' : '.min' );
define( 'VERSION_STRING', defined('GIT_VERSION') ? 'v='.GIT_VERSION : '' );
const STATIC_DOMAINS = [
'ludumdare.org' => 'static.jammer.work',
@@ -26,13 +27,14 @@
define( 'STATIC_DOMAIN', array_key_exists( $_SERVER['SERVER_NAME'], STATIC_DOMAINS ) ? STATIC_DOMAINS[$_SERVER['SERVER_NAME']] : DEFAULT_STATIC_DOMAIN );
define( 'STATIC_ENDPOINT', '//'.STATIC_DOMAIN );
define( 'LINK_SUFFIX', isset($_GET['nopush']) ? '; nopush' : '' );
if ( !defined('API_DOMAIN') )
if ( !defined('API_DOMAIN') ) {
define( 'API_DOMAIN', 'api.'.$_SERVER['SERVER_NAME'] );
define( 'API_ENDPOINT', '//'.API_DOMAIN /* '/-/' */);
}
define( 'API_ENDPOINT', '//'.API_DOMAIN );
define( 'JS_FILE', "/-/all".USE_MINIFIED.".js?".VERSION_STRING );
define( 'CSS_FILE', "/-/all".USE_MINIFIED.".css?".VERSION_STRING );
define( 'SVG_FILE', "/-/all".USE_MINIFIED.".svg?".VERSION_STRING );
define( 'CSS_FILE', "/-/all.min.css?".VERSION_STRING );
define( 'SVG_FILE', "/-/all.min.svg?".VERSION_STRING );
define( 'FONT_FILE', "//fonts.googleapis.com/css?family=Raleway:600,600italic,800,800italic|Roboto:300,300italic,700,700italic" );
if ( !isset($_GET['nopreload']) ) {
@@ -54,7 +56,7 @@
<body>
<script>
<?php /* Output PHP Variables for JS */ ?>
var SITE_DEBUG = <?=SITE_DEBUG?>;
var DEBUG = <?=DEBUG?>;
var VERSION_STRING = "<?=VERSION_STRING?>";
var STATIC_DOMAIN = "<?=STATIC_DOMAIN?>";
var STATIC_ENDPOINT = "<?=STATIC_ENDPOINT?>";
@@ -1,5 +1,9 @@
import {h, render, Component, options} from 'preact/preact';
import {initDevTools} from 'preact-devtools/devtools';

// @ifdef DEBUG
import {} from 'preact-devtools/devtools';
// @endif

import Sanitize from 'internal/sanitize/sanitize';

import Router from 'com/router/router';
@@ -45,9 +49,6 @@ import $NodeLove from 'shrub/js/node/node_love';
window.LUDUMDARE_ROOT = '/';
window.SITE_ROOT = 1;

if ( SITE_DEBUG ) {
initDevTools();
}

// NOTE: Deprecated
// Add special behavior: when class attribute is an array, flatten it to a string
@@ -66,11 +67,16 @@ options.vnode = function(vnode) {
class Main extends Component {
constructor( props ) {
super(props);
console.log('[constructor]');
console.log("[constructor]");
// @ifdef DEBUG
console.log("Running in DEBUG mode");
// @endif

var clean = this.cleanLocation(window.location);
if ( window.location.origin+clean.path !== window.location.href ) {
// @ifdef DEBUG
console.log("Cleaned URL: "+window.location.href+" => "+window.location.origin+clean.path);
// @endif

this.storeHistory(window.history.state, null, clean.path);
}

0 comments on commit cd64fa2

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.