diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..a6dffab7b --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +* +!README.md +!MIT-LICENSE +!dist/zepto.js +!dist/zepto.min.js +!src/*.js +src/amd_layout.js diff --git a/make b/make index 12217bf88..beb26b942 100755 --- a/make +++ b/make @@ -2,7 +2,6 @@ require 'shelljs/make' fs = require 'fs' -version = '1.1.6' zepto_js = 'dist/zepto.js' zepto_min = 'dist/zepto.min.js' zepto_gz = 'dist/zepto.min.gz' @@ -63,6 +62,18 @@ target.compress = -> factor = fsize(zepto_js) / fsize(zepto_gz) echo "compression factor: #{format_number(factor)}" +target.publish = -> + tag = 'v' + package_version() + if git_version() == tag + rm '-r', zepto_js + env['MODULES'] = env['NOAMD'] = '' + target.dist() + res = exec 'npm publish' + exit res.code + else + console.error 'error: latest commit should be tagged with ' + tag + exit 1 + ## HELPERS ## stale = (file, source) -> @@ -83,9 +94,15 @@ format_number = (size, precision = 1) -> report_size = (file) -> echo "#{file}: #{format_number(fsize(file) / 1024)} KiB" -describe_version = -> +package_version = -> + JSON.parse(cat('package.json')).version + +git_version = -> desc = exec "git --git-dir='#{root + '.git'}' describe --tags HEAD", silent: true - if desc.code is 0 then desc.output.replace(/\s+$/, '') else version + desc.output.replace(/\s+$/, '') if desc.code is 0 + +describe_version = -> + git_version() || package_version() minify = (source_code) -> uglify = require('uglify-js') diff --git a/package.json b/package.json index 2419f3f16..4bfcd62c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "zepto" , "version": "1.1.6" + , "main": "dist/zepto.js" , "homepage": "http://zeptojs.com" , "scripts": { "test": "coffee make test"