-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from cayb0rg/ease-of-use-fixes
Ease of use fixes
- Loading branch information
Showing
7 changed files
with
120 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
#! /usr/bin/env node | ||
var shell = require("shelljs"); | ||
|
||
shell.exec("export NODE_ENV=development || set NODE_ENV=development && node ./node_modules/materia-widget-development-kit/express.js --mode=development"); | ||
// command line options | ||
const args = process.argv.slice(2); | ||
|
||
const shell = require("shelljs"); | ||
|
||
// check if the NODE_ENV is set to anything | ||
// if so, don't change it | ||
let node_env = process.env.NODE_ENV; | ||
if (node_env === undefined || node_env === null || node_env === '') { | ||
node_env = 'development'; | ||
} | ||
|
||
shell.exec(`export NODE_ENV=${node_env} || set NODE_ENV=${node_env} && node ./node_modules/materia-widget-development-kit/express.js ${args.join(' ')}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This is an example webpack for a React project | ||
|
||
const path = require('path') | ||
const srcPath = path.join(__dirname, 'src') + path.sep | ||
const outputPath = path.join(__dirname, 'build') + path.sep | ||
const widgetWebpack = require('materia-widget-development-kit/webpack-widget') | ||
|
||
const rules = widgetWebpack.getDefaultRules() | ||
const copy = [ | ||
...widgetWebpack.getDefaultCopyList() | ||
] | ||
|
||
const entries = { | ||
'player': [ | ||
path.join(srcPath, 'player.html'), | ||
path.join(srcPath, 'player.js'), | ||
path.join(srcPath, 'player.scss') | ||
], | ||
'creator': [ | ||
path.join(srcPath, 'creator.html'), | ||
path.join(srcPath, 'creator.js'), | ||
path.join(srcPath, 'creator.scss') | ||
], | ||
'scoreScreen': [ | ||
path.join(srcPath, 'scoreScreen.html'), | ||
path.join(srcPath, 'scoreScreen.js'), | ||
path.join(srcPath, 'scoreScreen.scss') | ||
] | ||
} | ||
|
||
|
||
const customRules = [ | ||
rules.loadHTMLAndReplaceMateriaScripts, | ||
rules.loadAndPrefixSASS, | ||
rules.copyImages, | ||
rules.reactLoader | ||
] | ||
|
||
const options = { | ||
entries: entries, | ||
copyList: copy, | ||
moduleRules: customRules | ||
} | ||
|
||
const buildConfig = widgetWebpack.getLegacyWidgetBuildConfig(options) | ||
|
||
module.exports = buildConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
<h1 class='centered'>Preview Blocked</h1> | ||
<div class='centered'> | ||
<p> | ||
<a href='/player/{{instance}}' target='_blank'>Try Again</a> | ||
</p> | ||
<!DOCTYPE html> | ||
|
||
<script type="text/javascript" src="/materia-assets/js/materia.enginecore.js"></script> | ||
<script src="/mwdk/mwdk-assets/js/mwdk-package.js"></script> | ||
<link rel='stylesheet' href='/mwdk/assets/css/mwdk-main.css' type='text/css' /> | ||
|
||
<h1 class='center centered'>Preview Blocked</h1> | ||
<div class='center centered'> | ||
<p> | ||
<a id='close-button' href='#'>Close</a> | ||
<a id='try-again-button' class='action_button' target='_blank'>Try Again</a> | ||
</p> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
document.getElementById('close-button').onclick = (e) => { | ||
window.parent.MWDK.Creator.onQuestionImportComplete(); | ||
document.getElementById('try-again-button').onclick = (e) => { | ||
MWDK.Package.showPlayer(); | ||
return false | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters