Skip to content

Commit f683c66

Browse files
authored
Gix Gitbook refs (#120)
* Gix Gitbook refs * New organization * Remove introduction duplicate link * Prepare to release new alpha
1 parent 935305a commit f683c66

File tree

11 files changed

+201
-120
lines changed

11 files changed

+201
-120
lines changed

.gitbook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
structure:
2-
readme: README.md
2+
readme: packages/structure/README.md
33
summary: docs/SUMMARY.md

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## 2.0.0-alpha.3 - 2020-03-20
2+
3+
- Reorganize md files
4+
5+
## 2.0.0-alpha.2 - 2020-03-19
6+
7+
- Invert symlinks
8+
9+
## 2.0.0-alpha.1 - 2020-03-19
10+
11+
- Add symlinks to md files to packages/structure
12+
13+
## 2.0.0-alpha.0 - 2020-03-19
14+
15+
Refactors:
16+
17+
- The whole part of schemas and attribute definitions was refactored
18+
- Tests are now run by Jest (and Electron for browser tests)
19+
- Prettier was added
20+
- Move to mono-repo
21+
22+
Enhancements
23+
24+
- Implement jest-structure assertions
25+
- It's possible to set custom getters e setters directly in the structure class
26+
27+
Breaking changes:
28+
29+
- Joi is updated to v16
30+
- Attribute path in validation _errors_ is an array instead of a string
31+
- Attribute path in validation _messages_ contains the whole path joined by '.'
32+
- The name used for the dynamic import should aways be the same as the name of its type or else a custom identifier must be used
33+
- Non-nullable attributes with value null will use default value the same way undefined does
34+
- Structure classes now have two methods to generically set and get the value of the attributes, `.get(attributeName)` and `.set(attributeName, attributeValue)`
35+
- Minimum Node version is now 10
36+
37+
## 1.8.0 - 2019-09-16
38+
39+
Enhancements:
40+
41+
- Add `unique` validation to arrays
42+
43+
## 1.7.0 - 2019-09-14
44+
45+
Enhancements:
46+
47+
- Add method to clone structures
48+
49+
## 1.6.0 - 2019-08-27
50+
51+
Enhancements:
52+
53+
- Allow custom error class to static mode
54+
55+
## 1.5.0 - 2019-07-08
56+
57+
Enhancements:
58+
59+
- Add `buildStrict` static method
60+
61+
## 1.4.0 - 2019-03-26
62+
63+
Enhancements:
64+
65+
- Add `nullable` option
66+
67+
## 1.3.2 - 2019-03-22
68+
69+
Fix:
70+
71+
- The actual instance is passed to the dynamic defaults
72+
73+
## 1.3.0 - 2018-03-23
74+
75+
Enhancements:
76+
77+
- When using default function to initialize attributes you can now refer to another attribute values to compose value
78+
79+
## 1.2.0 - 2017-02-01
80+
81+
Features:
82+
83+
- Allow circular reference on type definitions ([@talyssonoc](https://github.com/talyssonoc/structure/pull/30))
84+
85+
Enhancements:
86+
87+
- Make validation faster ([@talyssonoc](https://github.com/talyssonoc/structure/pull/28))
88+
89+
Dependencies update:
90+
91+
- Update joi from 9.2.0 to 10.2.0 ([@talyssonoc](https://github.com/talyssonoc/structure/pull/26))
92+
93+
## 1.1.0 - 2017-01-17
94+
95+
- Added static method `validate()` to structures ([@talyssonoc](https://github.com/talyssonoc/structure/pull/25))

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# <a href="https://structure.js.org/v/structure-2/"><img src="https://raw.githubusercontent.com/talyssonoc/structure/master/structure.jpg" width="300"></a>
2+
3+
## A simple schema/attributes library built on top of modern JavaScript
4+
5+
Structure provides a simple interface which allows you to add attributes to your ES6 classes based on a schema, with validations and type coercion.
6+
7+
## Packages
8+
9+
- [Structure](packages/structure)
10+
- [jest-structure](packages/jest-structure)
11+
12+
## Example Structure usage
13+
14+
For each attribute on your schema, a getter and a setter will be created into the given class. It'll also auto-assign those attributes passed to the constructor.
15+
16+
```js
17+
const { attributes } = require('structure');
18+
19+
const User = attributes({
20+
name: String,
21+
age: {
22+
type: Number,
23+
default: 18,
24+
},
25+
birthday: Date,
26+
})(
27+
class User {
28+
greet() {
29+
return `Hello ${this.name}`;
30+
}
31+
}
32+
);
33+
34+
const user = new User({
35+
name: 'John Foo',
36+
});
37+
38+
user.name; // 'John Foo'
39+
user.greet(); // 'Hello John Foo'
40+
```
41+
42+
## [Contributing](contributing.md)
43+
44+
## [LICENSE](license.md)

docs/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Table of contents
22

3-
- [Introduction](../README.md)
43
- [Schema concept](schema-concept/README.md)
54
- [Shorthand and complete type descriptor](schema-concept/shorthand-and-complete-type-descriptor.md)
65
- [Circular reference](schema-concept/circular-references-and-dynamic-types.md)
@@ -24,6 +23,7 @@
2423
- [Strict mode](strict-mode.md)
2524
- [Cloning an instance](cloning.md)
2625
- [Serialization](serialization.md)
26+
- [Support and compatibility](support.md)
2727
- [Changelog](../CHANGELOG.md)
2828
- [Contributing](../contributing.md)
2929
- [License](../license.md)

docs/support.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Support and compatibility
2+
3+
Structure is built on top of modern JavaScript, using new features like [Proxy](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy), [Reflect](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Reflect) and [Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol). That being so, there are some things regarding compatibility you should consider when using Structure.
4+
5+
## Node
6+
7+
Node has only implemented all the used features at version 10, so for using Structure for a backend application you'll need Node 10 or later.
8+
9+
## Browser
10+
11+
We have a UMD version for usage in browsers. Right now the tests are ran both in Node (using the original code) and in Electron (using the UMD version) and the whole test suite passes for both cases. Since we use modern JavaScript features inside the lib (like [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)), older browsers may not support it. Polyfilling them may be an option but it's not oficially supported.

packages/jest-structure/license.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 jest-tructure
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/jest-structure/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jest-structure",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.3",
44
"description": "Jest assertions to use with Structure",
55
"main": "index.js",
66
"author": "Talysson <[email protected]>",
@@ -12,7 +12,7 @@
1212
"node": ">=10.13.0"
1313
},
1414
"devDependencies": {
15-
"structure": "2.0.0-alpha.2"
15+
"structure": "2.0.0-alpha.3"
1616
},
1717
"peerDependencies": {
1818
"jest": "^25.1.0"

packages/structure/CHANGELOG.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)