Skip to content

Commit 395aebc

Browse files
committed
Added versionining to webpack output
* added versionining to webpack output * updated bundle file
1 parent d8025a0 commit 395aebc

File tree

6 files changed

+55
-19
lines changed

6 files changed

+55
-19
lines changed

.jscsrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"preset": "google",
3+
"disallowSpacesInsideObjectBrackets": null,
4+
"requireSpacesInsideObjectBrackets": {
5+
"allExcept": [ "[", "]", "{", "}" ]
6+
},
7+
"disallowSpacesInsideArrayBrackets": null,
8+
"requireSpacesInsideArrayBrackets": {
9+
"allExcept": [ "[", "]", "{", "}" ]
10+
},
11+
"disallowKeywordsOnNewLine": [ ],
12+
"disallowMultipleVarDecl": null,
13+
"maximumLineLength": 120,
14+
"requireSemicolons": true
15+
}

bundle.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*!
2+
* json-schema-form
3+
* @version 1.0.0-alpha.1
4+
* Copyright 2016 JSON Schema Form
5+
*/
16
(function webpackUniversalModuleDefinition(root, factory) {
27
if(typeof exports === 'object' && typeof module === 'object')
38
module.exports = factory();
@@ -608,8 +613,12 @@ return /******/ (function(modules) { // webpackBootstrap
608613
var rules = schemaTypes[stripNullType(schema.type)];
609614
if (rules) {
610615
var def = void 0;
616+
// We give each rule a possibility to recurse it's children.
617+
var innerDefaultFormDefinition = function innerDefaultFormDefinition(childName, childSchema, childOptions) {
618+
return defaultFormDefinition(schemaTypes, childName, childSchema, childOptions);
619+
};
611620
for (var i = 0; i < rules.length; i++) {
612-
def = rules[i](name, schema, options);
621+
def = rules[i](name, schema, options, innerDefaultFormDefinition);
613622

614623
//first handler in list that actually returns something is our handler!
615624
if (def) {
@@ -747,14 +756,15 @@ return /******/ (function(modules) { // webpackBootstrap
747756
}
748757
}
749758

750-
function fieldset(name, schema, options) {
759+
function fieldset(name, schema, options, defaultFormDef) {
751760
if (stripNullType(schema.type) === 'object') {
752761
var _ret = function () {
753762
var f = stdFormObj(name, schema, options);
754763
f.type = 'fieldset';
755764
f.items = [];
756765
options.lookup[(0, _sfPath.stringify)(options.path)] = f;
757766

767+
console.log('fieldset', f, schema);
758768
//recurse down into properties
759769
if (schema.properties) {
760770
Object.keys(schema.properties).forEach(function (key) {
@@ -764,7 +774,7 @@ return /******/ (function(modules) { // webpackBootstrap
764774
if (options.ignore[(0, _sfPath.stringify)(path)] !== true) {
765775
var required = schema.required && schema.required.indexOf(key) !== -1;
766776

767-
var def = defaultFormDefinition(key, value, {
777+
var def = defaultFormDef(key, value, {
768778
path: path,
769779
required: required || false,
770780
lookup: options.lookup,
@@ -786,7 +796,7 @@ return /******/ (function(modules) { // webpackBootstrap
786796
}
787797
}
788798

789-
function array(name, schema, options) {
799+
function array(name, schema, options, defaultFormDef) {
790800
if (stripNullType(schema.type) === 'array') {
791801
var f = stdFormObj(name, schema, options);
792802
f.type = 'array';
@@ -803,7 +813,7 @@ return /******/ (function(modules) { // webpackBootstrap
803813
var arrPath = options.path.slice();
804814
arrPath.push('');
805815

806-
f.items = [defaultFormDefinition(name, schema.items, {
816+
f.items = [defaultFormDef(name, schema.items, {
807817
path: arrPath,
808818
required: required || false,
809819
lookup: options.lookup,
@@ -823,8 +833,7 @@ return /******/ (function(modules) { // webpackBootstrap
823833
object: [fieldset],
824834
number: [number],
825835
integer: [integer],
826-
boolean: [checkbox],
827-
array: [checkboxes, array]
836+
boolean: [checkbox], defaultForm: defaultForm
828837
};
829838
}
830839

lib/canonicalTitleMap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ export default function(titleMap, originalEnum) {
55
const canonical = [];
66
if (originalEnum) {
77
originalEnum.forEach((value) => {
8-
canonical.push({name: titleMap[value], value});
8+
canonical.push({ name: titleMap[value], value });
99
});
1010
} else {
1111
Object.keys(titleMap).forEach((value) => {
12-
canonical.push({name: titleMap[value], value});
12+
canonical.push({ name: titleMap[value], value });
1313
});
1414
}
1515
return canonical;

lib/select.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
import sfPath from './sfPath';
33

4-
54
const numRe = /^\d+$/;
65

76
/**
@@ -35,7 +34,7 @@ export function select(projection, obj, valueToSet) {
3534

3635
if (typeof valueToSet !== 'undefined' &&
3736
typeof obj[parts[0]] === 'undefined') {
38-
// We need to look ahead to check if array is appropriate
37+
// We need to look ahead to check if array is appropriate
3938
obj[parts[0]] = parts.length > 2 && numRe.test(parts[1]) ? [] : {};
4039
}
4140

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-schema-form-core",
3-
"version": "1.0.0",
3+
"version": "1.0.0-alpha.1",
44
"description": "Core library",
55
"main": "bundle.js",
66
"scripts": {
@@ -15,6 +15,8 @@
1515
},
1616
"keywords": [
1717
"angular-schema-form",
18+
"json-schema-form",
19+
"json-ui-schema",
1820
"json-schema"
1921
],
2022
"authors": "David Jensen <david.lgj@gmail.com>",
@@ -33,5 +35,11 @@
3335
"chai": "^3.5.0",
3436
"mocha": "^2.4.5",
3537
"webpack": "^1.12.14"
36-
}
38+
},
39+
"licenses": [
40+
{
41+
"type": "MIT",
42+
"url": "https://raw.githubusercontent.com/json-schema-form/json-schema-form-core/master/LICENSE"
43+
}
44+
]
3745
}

webpack.config.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
/* global __dirname */
2-
// var webpack = require('webpack');
2+
var webpack = require('webpack');
33
var path = require('path');
4+
var pjson = require('./package.json');
5+
console.log('JSON Schema Form Core v' + pjson.version);
46

57
module.exports = {
6-
entry: ['./index.js'],
8+
entry: [ './index.js' ],
79
output: {
810
path: __dirname,
911
filename: 'bundle.js',
1012
libraryTarget: 'umd'
1113
},
12-
resolve: {extensions: ['', '.js']},
14+
resolve: { extensions: [ '', '.js' ] },
1315
module: {
1416
loaders: [
1517
{
1618
test: /\.js$/,
17-
include: [__dirname],
18-
exclude: ['node_modules'],
19+
include: [ __dirname ],
20+
exclude: [ 'node_modules' ],
1921
loader: 'babel',
2022
}
2123
]
22-
}
24+
},
25+
plugins: [
26+
new webpack.BannerPlugin('json-schema-form\n@version ' + pjson.version + '\nCopyright 2016 JSON Schema Form')
27+
]
2328
};

0 commit comments

Comments
 (0)