# HG changeset patch # User cin # Date 2018-06-28 12:27:01 # Node ID f88a0de08cfb0b59e53c2055bf9dd45b9b7367be # Parent af6fce5deaab19bf8d4de1ce7f4c5b79bcab631d improved core/build.gradle script diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,27 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "amd": true, + "node": true + }, + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "sourceType": "module" + }, + "extends": "eslint:recommended", + "rules": { + "no-const-assign": "warn", + "no-this-before-super": "warn", + "no-undef": "error", + "no-unreachable": "warn", + "no-unused-vars": "warn", + "constructor-super": "warn", + "valid-typeof": "warn", + "semi" : "warn", + "no-invalid-this" : "error", + "no-console": "off" + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle --- a/build.gradle +++ b/build.gradle @@ -1,54 +1,59 @@ println "version: $version" -String makePackageName(String group, String name, String ver) { - def sb = new StringBuilder(); - if(group) - sb - .append('@') - .append(group) - .append('/'); - - sb.append(name); +def distDir = "$buildDir/dist" +def testDir = "$buildDir/test" - if (ver) - sb.append('@').append(ver); - - return sb.toString(); -} - -configurations { - compile - peer - dev +task clean { + doLast { + delete buildDir + } } -dependencies { - compile ":eslint:1.x || >=2.5.0 || 5.0.0 - 7.2.3" - compile (name: 'foo') { - ext.location = "http://some/package/location" +task cleanNpm { + doLast { + delete 'node_modules' } - peer "dojo:core" } -task prepare(type: Copy) { - from('src/js/') - from('.') { - include 'readme.md', 'license', 'history.md', 'package.json' - } - into(buildDir) -} - -task installDeps { - configurations.compile.allDependencies.forEach { d -> - println makePackageName(d.group, d.name, d.version); - if(d.hasProperty('location')) { - println d.location +task _npmInstall() { + inputs.file("package.json") + outputs.dir("node_modules") + doLast { + exec { + commandLine 'npm', 'install' } } } -task build(dependsOn: prepare) { +task _legacyJs(type:Copy) { + from 'src/js/' + into distDir +} + +task _packageMeta(type: Copy) { + inputs.property("version", version) + from('.') { + include 'package.json', 'readme.md', 'license', 'history.md' + } + into distDir + doLast { + exec { + workingDir distDir + commandLine 'npm', 'version', version + } + } +} + +task build(dependsOn: [_npmInstall, _legacyJs, _packageMeta]) { + +} + +task _localInstall(dependsOn: build, type: Exec) { + inputs.file("$distDir/package.json") + outputs.upToDateWhen { true } + + commandLine 'npm', 'install', '--no-save', '--force', distDir } task pack(dependsOn: build, type: Exec) { diff --git a/license b/license --- a/license +++ b/license @@ -0,0 +1,22 @@ +Copyright 2017-2018 Implab team + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/package.json b/package.json --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@implab/core", - "version": "1.0.1", + "version": "0.0.1-dev", "description": "Dependency injection, logging, simple and fast text template engine", "main": "main.js", "scripts": { @@ -13,6 +13,7 @@ "template engine", "dependency injection" ], - "author": "Sergey Smirnov", - "license": "MIT" + "author": "Implab team", + "license": "BSD", + "repository": "https://bitbucket.org/implab/implabjs" } diff --git a/src/js/safe.js b/src/js/safe.js --- a/src/js/safe.js +++ b/src/js/safe.js @@ -179,7 +179,7 @@ define([], return wrapresult(fn.apply(thisArg, arguments)); } catch (e) { return wrapresult(null, e); - }; + } }, create: function () {