Publish django-select2 JavaScript code on NPM (#479)

This commit is contained in:
Thomas Grainger 2018-08-22 11:04:02 +01:00 committed by Johannes Hoppe
parent 0f18958099
commit de7e7a1903
4 changed files with 70 additions and 7 deletions

View file

@ -52,12 +52,17 @@ script:
- tox -e $TOXENV
after_success:
- codecov
before_deploy: ./set_version.py
deploy:
provider: pypi
user: codingjoe
password:
secure: fEP9K7y0ZF9fRvQEUN4kgPXQEZvi3Cx3ikUebG2UM/2uhcaUQm0+KpgZ2S+lvOTYcBnNgzPzFsVIZMcVcTxwIKuQDEMq9y2eop2hnisb9KXsIm9qPYSzOnRm74VuiOt4hNOZMe0qVBK2cO3vC9NDXuzdI8A0JynJhthfl4t+kFM=
- provider: pypi
distributions: sdist bdist_wheel
user: codingjoe
password:
secure: fEP9K7y0ZF9fRvQEUN4kgPXQEZvi3Cx3ikUebG2UM/2uhcaUQm0+KpgZ2S+lvOTYcBnNgzPzFsVIZMcVcTxwIKuQDEMq9y2eop2hnisb9KXsIm9qPYSzOnRm74VuiOt4hNOZMe0qVBK2cO3vC9NDXuzdI8A0JynJhthfl4t+kFM=
- provider: npm
email: info@johanneshoppe.com
api_key:
secure: PV38cQx9qhEFkpSdytbM72UzIMCfhpjmRJ8dzT+bCAaOIs5rEcyKN+h1r5ranunCxWyuFsMW4A2iW/SCxnKCR/oPAguuwUbT5ogBXlsskqPFWUxuoTHYMrd+zB+SC6+bMgq+o5ul+kJCYtEkWP6cMlIEzKyTLab7m5PsnDXNVnI=
on:
tags: true
distributions: sdist bdist_wheel
repo: applegrew/django-select2

View file

@ -1,4 +1,15 @@
(function ($) {
/* global define, jQuery */
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory)
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('jquery'))
} else {
// Browser globals
factory(jQuery)
}
}(function ($) {
'use strict'
var init = function ($element, options) {
$element.select2(options)
}
@ -53,4 +64,6 @@
$(function () {
$('.django-select2').djangoSelect2()
})
}(this.jQuery))
return $.fn.djangoSelect2
}))

34
package.json Normal file
View file

@ -0,0 +1,34 @@
{
"name": "django-select2",
"version": "0.0.0",
"description": "This is a Django integration of Select2.",
"files": [
"django_select2/static/**/*"
],
"main": "django_select2/static/django_select2/django_select2.js",
"directories": {
"doc": "docs",
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/applegrew/django-select2.git"
},
"keywords": [
"django",
"select2"
],
"author": "Johannes Hoppe",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/applegrew/django-select2/issues"
},
"homepage": "https://github.com/applegrew/django-select2#readme",
"peerDependencies": {
"select2": "*",
"jquery": ">= 1.2"
}
}

11
set_version.py Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env python3
import json
import os
def main():
with open('package.json', 'r+') as f:
data = json.load(f)
f.seek(0)
data['version'] = os.environ['TRAVIS_TAG']
json.dump(data, f)
f.truncate()