From ed927897180895418ea398da6d7c38e80012fd67 Mon Sep 17 00:00:00 2001 From: Tom Valk Date: Wed, 1 Jun 2016 15:03:08 +0200 Subject: [PATCH 01/28] plugin interface 0.2.0 --- packages/maniajs-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/maniajs-plugin/package.json b/packages/maniajs-plugin/package.json index bb63178..364d0c4 100644 --- a/packages/maniajs-plugin/package.json +++ b/packages/maniajs-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@maniajs/plugin", - "version": "0.1.0", + "version": "0.2.0", "private": false, "main": "src/plugin.js", "description": "Plugin Interface for ManiaJS Plugin Structure", From 2d7ff28690adccaef0a71f087aae45e0040c0fa2 Mon Sep 17 00:00:00 2001 From: Tom Valk Date: Wed, 1 Jun 2016 16:12:55 +0200 Subject: [PATCH 02/28] Models injection of plugin is now done in the interface. --- packages/maniajs-plugin/src/plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/maniajs-plugin/src/plugin.js b/packages/maniajs-plugin/src/plugin.js index 1848907..f9739fc 100644 --- a/packages/maniajs-plugin/src/plugin.js +++ b/packages/maniajs-plugin/src/plugin.js @@ -75,6 +75,7 @@ module.exports.default = class extends EventEmitter { this.maps = app.maps; this.plugins = app.plugins; this.ui = app.ui; + this.models = app.models[this.name] || {}; } }; From cdce96765b8f3f66269ef17e5c95dc4fea714c46 Mon Sep 17 00:00:00 2001 From: Tom Valk Date: Wed, 1 Jun 2016 16:23:19 +0200 Subject: [PATCH 03/28] publish 0.2.1 of plugin interface. --- packages/maniajs-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/maniajs-plugin/package.json b/packages/maniajs-plugin/package.json index 364d0c4..bf1e816 100644 --- a/packages/maniajs-plugin/package.json +++ b/packages/maniajs-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@maniajs/plugin", - "version": "0.2.0", + "version": "0.2.1", "private": false, "main": "src/plugin.js", "description": "Plugin Interface for ManiaJS Plugin Structure", From 660701c44049c708799fb5cce1c23c8fa5980da4 Mon Sep 17 00:00:00 2001 From: Tom Valk Date: Mon, 13 Jun 2016 15:15:41 +0200 Subject: [PATCH 04/28] Prepare dedimania and projects for typescript --- .gitignore | 10 ++ packages/maniajs-dedimania/.npmignore | 2 + packages/maniajs-dedimania/Gruntfile.js | 38 ++++++ packages/maniajs-dedimania/grunt/clean.js | 7 ++ packages/maniajs-dedimania/grunt/copy.js | 11 ++ packages/maniajs-dedimania/grunt/nsp.js | 7 ++ packages/maniajs-dedimania/grunt/ts.js | 25 ++++ packages/maniajs-dedimania/grunt/tslint.js | 14 +++ packages/maniajs-dedimania/grunt/watch.js | 18 +++ packages/maniajs-dedimania/package.json | 30 ++++- packages/maniajs-dedimania/tsconfig.json | 34 ++++++ packages/maniajs-dedimania/tslint.json | 134 +++++++++++++++++++++ packages/maniajs-dedimania/typedoc.json | 15 +++ packages/maniajs-dedimania/typings.json | 6 + 14 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 packages/maniajs-dedimania/.npmignore create mode 100644 packages/maniajs-dedimania/Gruntfile.js create mode 100644 packages/maniajs-dedimania/grunt/clean.js create mode 100644 packages/maniajs-dedimania/grunt/copy.js create mode 100644 packages/maniajs-dedimania/grunt/nsp.js create mode 100644 packages/maniajs-dedimania/grunt/ts.js create mode 100644 packages/maniajs-dedimania/grunt/tslint.js create mode 100644 packages/maniajs-dedimania/grunt/watch.js create mode 100644 packages/maniajs-dedimania/tsconfig.json create mode 100644 packages/maniajs-dedimania/tslint.json create mode 100644 packages/maniajs-dedimania/typedoc.json create mode 100644 packages/maniajs-dedimania/typings.json diff --git a/.gitignore b/.gitignore index d958da9..bd40008 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,13 @@ node_modules *.ipr *.iws .idea/ + + +### Typescript/Babel +packages/*/lib/ +.grunt +.baseDir.ts +.tscache +tmp/* +packages/*/typings/* +!packages/*/typings/custom diff --git a/packages/maniajs-dedimania/.npmignore b/packages/maniajs-dedimania/.npmignore new file mode 100644 index 0000000..b1c1070 --- /dev/null +++ b/packages/maniajs-dedimania/.npmignore @@ -0,0 +1,2 @@ +### Sources (non-es6) +src/ diff --git a/packages/maniajs-dedimania/Gruntfile.js b/packages/maniajs-dedimania/Gruntfile.js new file mode 100644 index 0000000..d0c8d55 --- /dev/null +++ b/packages/maniajs-dedimania/Gruntfile.js @@ -0,0 +1,38 @@ +'use strict'; + +module.exports = function (grunt) { + require('load-grunt-config')(grunt, { + jitGrunt: {} + }); + require('time-grunt')(grunt); + + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-tslint'); + grunt.loadNpmTasks('grunt-ts'); + grunt.loadNpmTasks('grunt-nsp'); + + grunt.registerTask('build', [ + 'clean:default', + 'tslint:default', + 'ts:default', + 'copy:default' + ]); + + grunt.registerTask('dev', [ + 'clean:default', + 'tslint:default', + 'ts:default', + 'copy:default', + 'watch' + ]); + + grunt.registerTask('default', [ + 'clean:default', + 'tslint:default', + 'ts:default', + 'copy:default', + 'watch' + ]); +}; diff --git a/packages/maniajs-dedimania/grunt/clean.js b/packages/maniajs-dedimania/grunt/clean.js new file mode 100644 index 0000000..2f6f3e1 --- /dev/null +++ b/packages/maniajs-dedimania/grunt/clean.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = { + default: [ + 'lib/*' + ] +}; diff --git a/packages/maniajs-dedimania/grunt/copy.js b/packages/maniajs-dedimania/grunt/copy.js new file mode 100644 index 0000000..1816ce7 --- /dev/null +++ b/packages/maniajs-dedimania/grunt/copy.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = { + default: { + files: [ + { + expand: true, cwd: 'src', src: ['**/*', '!**/*.ts'], dest: 'lib/', filter: 'isFile' + } + ] + } +}; diff --git a/packages/maniajs-dedimania/grunt/nsp.js b/packages/maniajs-dedimania/grunt/nsp.js new file mode 100644 index 0000000..5624792 --- /dev/null +++ b/packages/maniajs-dedimania/grunt/nsp.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (grunt, options) { + return { + package: grunt.file.readJSON('package.json') + }; +}; diff --git a/packages/maniajs-dedimania/grunt/ts.js b/packages/maniajs-dedimania/grunt/ts.js new file mode 100644 index 0000000..6875599 --- /dev/null +++ b/packages/maniajs-dedimania/grunt/ts.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = { + default: { + tsconfig: true + + } +}; + +let t = { + files: [ + { + src: ['src/*/**.ts', 'src/*.ts'], + dest: 'lib' + }, + // { src: 'test/**.ts' , dest: 'lib/test' } + ], + + options: { + // tsconfig: __dirname + '/../../tsconfig.json', + // fast: 'never', + // module: 'es6', + // target: 'es6' + } +}; diff --git a/packages/maniajs-dedimania/grunt/tslint.js b/packages/maniajs-dedimania/grunt/tslint.js new file mode 100644 index 0000000..61c100a --- /dev/null +++ b/packages/maniajs-dedimania/grunt/tslint.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + default: { + files: { + src: [ + 'src/**.ts' + ] + } + }, + options: { + configuration: 'tslint.json' + } +}; diff --git a/packages/maniajs-dedimania/grunt/watch.js b/packages/maniajs-dedimania/grunt/watch.js new file mode 100644 index 0000000..d69981f --- /dev/null +++ b/packages/maniajs-dedimania/grunt/watch.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = { + ts: { + files: [ + 'src/**/*.ts', + 'src/**/*', + 'test/**/*.ts' + ], + tasks: ['clean:default', 'tslint', 'ts:default', 'copy:default'] + }, + test: { + files: [ + 'out/**/*.js' + ], + tasks: [] + } +}; diff --git a/packages/maniajs-dedimania/package.json b/packages/maniajs-dedimania/package.json index 415622a..d3ffb8a 100644 --- a/packages/maniajs-dedimania/package.json +++ b/packages/maniajs-dedimania/package.json @@ -24,10 +24,38 @@ "engines": { "node": ">=4.0.0" }, - "main": "src/plugin.js", + "scripts": { + "devtools": "npm i -g typescript typings grunt-cli typedoc && typings install", + "ts": "grunt ts", + "watch": "grunt watch", + "start": "node ./maniajs.js", + "dev": "npm run build && node ./maniajs.js", + "build": "grunt build", + "prepublish": "npm run build" + }, + "main": "lib/plugin.js", "dependencies": { "async": "^1.5.2", "@maniajs/plugin": "0.*", "@maniajs/xmlrpc": "^2.0.0-beta.4" + }, + "devDependencies": { + "chai": "^3.5.0", + "dts-generator": "^1.7.0", + "eslint": "^2.12.0", + "grunt": "^1.0.1", + "grunt-contrib-clean": "^1.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-watch": "^1.0.0", + "grunt-nsp": "^2.2.0", + "grunt-ts": "^5.5.1", + "grunt-tslint": "^3.1.0", + "load-grunt-config": "^0.19.2", + "source-map-support": "^0.4.0", + "time-grunt": "^1.3.0", + "tslint": "^3.11.0", + "typedoc": "^0.4.2", + "typescript": "^1.8.10", + "typings": "^1.0.5" } } diff --git a/packages/maniajs-dedimania/tsconfig.json b/packages/maniajs-dedimania/tsconfig.json new file mode 100644 index 0000000..2441a3c --- /dev/null +++ b/packages/maniajs-dedimania/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "moduleResolution": "classic", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "sourceMap": true, + "removeComments": false, + "noImplicitAny": false, + "outDir": "./lib" + }, + "exclude": [ + "node_modules", + "./typings/*/**.d.ts" + ], + "filesGlob": [ + "./src/**/*.ts", + "./src/*.ts", + "./test/**/*.ts", + "!./node_modules/**/*.ts" + ], + "awesomeTypescriptLoaderOptions": { + "resolveGlobs": true, + "forkChecker": true + }, + "compileOnSave": false, + "buildOnSave": false, + "atom": { + "rewriteTsconfig": false + }, + "files": [ + ] +} diff --git a/packages/maniajs-dedimania/tslint.json b/packages/maniajs-dedimania/tslint.json new file mode 100644 index 0000000..a907161 --- /dev/null +++ b/packages/maniajs-dedimania/tslint.json @@ -0,0 +1,134 @@ +{ + "rules": { + "member-access": false, + "member-ordering": [ + true, + "public-before-private", + "static-before-instance", + "variables-before-functions" + ], + "no-any": false, + "no-inferrable-types": false, + "no-internal-module": true, + "no-var-requires": false, + "typedef": false, + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + }, + { + "call-signature": "space", + "index-signature": "space", + "parameter": "space", + "property-declaration": "space", + "variable-declaration": "space" + } + ], + "ban": false, + "curly": false, + "forin": true, + "label-position": true, + "label-undefined": true, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-key": true, + "no-duplicate-variable": true, + "no-empty": false, + "no-eval": true, + "no-null-keyword": false, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-switch-case-fall-through": true, + "no-unreachable": true, + "no-unused-expression": true, + "no-unused-variable": false, + "no-use-before-declare": true, + "no-var-keyword": false, + "radix": true, + "switch-default": true, + "triple-equals": [ + true, + "allow-null-check" + ], + "use-strict": [ + true, + "check-module" + ], + "eofline": true, + "indent": [ + true, + "spaces" + ], + "max-line-length": [ + true, + 120 + ], + "no-require-imports": false, + "no-trailing-whitespace": true, + "object-literal-sort-keys": false, + "trailing-comma": [ + true, + { + "multiline": "never", + "singleline": "never" + } + ], + "align": false, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "interface-name": false, + "jsdoc-format": true, + "no-consecutive-blank-lines": false, + "no-constructor-vars": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-finally", + "check-whitespace" + ], + "quotemark": [ + true, + "single", + "avoid-escape" + ], + "semicolon": [ + true, + "always" + ], + "variable-name": [ + true, + "check-format", + "allow-leading-underscore", + "ban-keywords" + ], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ] + } +} diff --git a/packages/maniajs-dedimania/typedoc.json b/packages/maniajs-dedimania/typedoc.json new file mode 100644 index 0000000..186b50c --- /dev/null +++ b/packages/maniajs-dedimania/typedoc.json @@ -0,0 +1,15 @@ +{ + "mode": "modules", + "out": "doc", + "theme": "default", + "ignoreCompilerErrors": "true", + "experimentalDecorators": "true", + "emitDecoratorMetadata": "true", + "target": "ES6", + "moduleResolution": "node", + "preserveConstEnums": "true", + "stripInternal": "true", + "suppressExcessPropertyErrors": "true", + "suppressImplicitAnyIndexErrors": "true", + "module": "commonjs" +} diff --git a/packages/maniajs-dedimania/typings.json b/packages/maniajs-dedimania/typings.json new file mode 100644 index 0000000..b0c2006 --- /dev/null +++ b/packages/maniajs-dedimania/typings.json @@ -0,0 +1,6 @@ +{ + "name": "@maniajs/dedimania", + "globalDependencies": {}, + "devDependencies": {}, + "dependencies": {} +} From 06d8c9e884ea1dd74debe22ef28d07383ce8270e Mon Sep 17 00:00:00 2001 From: Tom Valk Date: Tue, 21 Jun 2016 11:39:39 +0200 Subject: [PATCH 05/28] Map widget support for ShootMania. --- packages/maniajs-mapwidget/src/plugin.js | 8 +++++++- packages/maniajs-mapwidget/src/view/mapwidget.hbs | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/maniajs-mapwidget/src/plugin.js b/packages/maniajs-mapwidget/src/plugin.js index 93f77f4..e8c1a26 100644 --- a/packages/maniajs-mapwidget/src/plugin.js +++ b/packages/maniajs-mapwidget/src/plugin.js @@ -165,7 +165,13 @@ module.exports.default = class extends Plugin { mapPromise.then((map) => { this.widgetSettings.mapname = map.Name; this.widgetSettings.author = map.Author; - this.widgetSettings.author_time = this.app.util.times.stringTime(map.AuthorTime); + + if (this.app.config.config.server.game === 'shootmania') { + this.widgetSettings.author_time = ''; + } else { + this.widgetSettings.author_time = this.app.util.times.stringTime(map.AuthorTime); + } + this.mapWidget.global(this.widgetSettings).update(); }); } diff --git a/packages/maniajs-mapwidget/src/view/mapwidget.hbs b/packages/maniajs-mapwidget/src/view/mapwidget.hbs index 7737b17..7ed6455 100644 --- a/packages/maniajs-mapwidget/src/view/mapwidget.hbs +++ b/packages/maniajs-mapwidget/src/view/mapwidget.hbs @@ -10,6 +10,9 @@