From 3613bca8e1e99ea66a0e5a2b18edf9e2ebc5db41 Mon Sep 17 00:00:00 2001 From: Stefan Wimmer Date: Sat, 24 Sep 2016 15:12:20 +0200 Subject: [PATCH] Pre-release 1.0.0-alpha.1 --- .gitignore | 3 +++ LICENSE | 13 +++++++++++++ README.md | 3 +++ bin/build | 9 +++++++++ bin/publish | 9 +++++++++ package.json | 26 ++++++++++++++++++++++++++ tmjs-core.js | 34 ++++++++++++++++++++++++++++++++++ 7 files changed, 97 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100755 bin/build create mode 100755 bin/publish create mode 100644 package.json create mode 100644 tmjs-core.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08e2ab9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea/ +/build/ +/test/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6411d20 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2016, Team Mion + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4014920 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# TM.js Core (tmjs-core) + +TM.js Core is used in all TM.js modules diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..464141a --- /dev/null +++ b/bin/build @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +version="$(nodejs <<< "console.log(require(\"./package\").version);")" + +test -d build && rm -dr build +mkdir build + +cp tmjs-core.js build/tmjs-core.js +sed -i "s#\${version}#${version}#" build/tmjs-core.js diff --git a/bin/publish b/bin/publish new file mode 100755 index 0000000..fcdddf8 --- /dev/null +++ b/bin/publish @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +version="$(nodejs <<< "console.log(require(\"./package\").version);")" + +test -d files || mkdir files + +cp "build/tmjs-core.js" "files/tmjs-core_${version}.js" + +git tag "${version}" diff --git a/package.json b/package.json new file mode 100644 index 0000000..cacf9bc --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "tmjs-core", + "version": "1.0.0-alpha.1", + "description": "TM.js Core is used in all TM.js modules", + "main": "tmjs-core.js", + "scripts": { + "build": "bin/build", + "publish": "bin/publish" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/teammion/tmjs-core.git" + }, + "keywords": [ + "tmjs-core", + "tmjs", + "core", + "tm.js" + ], + "author": "Stefan Wimmer ", + "license": "ISC", + "bugs": { + "url": "https://github.com/teammion/tmjs-core/issues" + }, + "homepage": "https://github.com/teammion/tmjs-core#readme" +} diff --git a/tmjs-core.js b/tmjs-core.js new file mode 100644 index 0000000..8d29001 --- /dev/null +++ b/tmjs-core.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016, Team Mion + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * TM.js Core (tmjs-core) ${version} + * @author Stefan Wimmer + */ + +let g = typeof window !== "undefined" ? window : global; + +g.tmjs = g.tmjs || {}; + +g.tmjs.__defineGetter__("core", () => "${version}"); + +g.tmjs.module = (name, version, getter) => + g.tmjs.__defineGetter__(name, () => + { + let module = getter(g.tmjs); + module.__defineGetter__("version", () => version); + return module; + });