Skip to content

Commit

Permalink
Merge pull request #440 from GrimoireGL/semantic-release
Browse files Browse the repository at this point in the history
Enable semantic-release on CI
  • Loading branch information
kyasbal authored Feb 12, 2017
2 parents 0b64d86 + 5a21345 commit fa17570
Show file tree
Hide file tree
Showing 14 changed files with 970 additions and 78 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ register
ref
test-es5
src/index.ts
yarn.lock
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Guideline for contribution[WIP]

## Got a questions or problem?

Using slack is the best way to ask main contributors.
Stack overflow is another choice to ask.

## Found bugs?

Please report them with issues. You can write it in English or Japanese.
If reporter write an issue with Japanese and it is fatal problem of this library,
main contributors would translate them for convenience.

## Contributing to translation

We prepare to translate all of our documents written in Japanese to English.
Currently official site and most of documents are written in Japanese, but we will move the main language as English.
This is including a lot of stuff to do, we need contributors. Even if you correct our English syntax, we are welcome.

## Contributing to code

Reducing works we need to do manually is very important.
Please read this guideline for keeping clean repository and keeping developing environment efficiently.

### Coding rule

Most of the coding rules are checked with `TSLint`. You can run `npm run lint` to check whether your code is fitting to coding rule.
Lint task would run on CI also.

But, there are some coding rule not listed in tslint configurations. These rules are listed below.

#### Rules of methods

```ts
public publicMethod(): void;
private _privateMethod(): void;
protected __protectedMethod(): void;
```

Public method name must begin with lower case and should following names are `camelCase`.
Private method name must begin with `_`, and following characters are same as public method name.
Protected method name must begin with two `__`, and following characters are same as public method name.

### Commit message guideline

Currently the version of this package is managed by `semantic-release`.
To generate changelog and release new version automatically, please follow this rule.

#### When the commit is bug fix,refactor or chore (Anything no effect for API).

```
fix: COMMIT MESSAGE HERE
```

#### When the commit contains new feature not containing breaking change.

```
feat: COMMIT MESSAGE HERE
```

#### When the commit contains breaking change

But, keeping in mind that we should not break public API.

```
perf: COMMIT MESSAGE HERE
```
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Logics like drawing formulas for canvas even needs DOM for easier way.
* **Web development friendly**・・・Use with the other Web front-end frameworks. Very easy to coop with them.
* **No more redundant codes**・・・Include only `tag`s you actually need.

## Download

The file you might want to download is not included this repository since even set of WebGL operations are treated as plugins.
Basic set for using Grimoire.js is bundled and published here([unpkg](https://unpkg.com/grimoirejs-preset-basic@1.8.5/register/grimoire-preset-basic.min.js)).
This file includes `grimoirejs`,`grimoirejs-math` and `grimoirejs-fundamental`.

## First Interact

**HTML file**
Expand Down
27 changes: 19 additions & 8 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
general:
branches:
ignore:
- gh-pages
machine:
timezone: Asia/Tokyo
node:
version: 6.5.0
node:
version: 6.9.5

post:
- curl -o- -L https://yarnpkg.com/install.sh | bash

dependencies:
cache_directories:
- "~/.cache/yarn"

pre:
- yarn --version

override:
- yarn install

test:
post:
- npm run semantic-release || true
override:
- npm run build && npm test
- npm run lint && npm run build && npm test
12 changes: 0 additions & 12 deletions index.html

This file was deleted.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grimoirejs",
"version": "0.14.1-beta4",
"version": "1.0.0",
"description": "A service-oriented WebGL framework.",
"main": "./ref/index.js",
"typings": "./ref/index.d.ts",
Expand All @@ -25,11 +25,14 @@
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-stage-2": "^6.18.0",
"condition-circle": "^1.5.0",
"jsdom": "^9.8.3",
"lodash": "^4.17.2",
"proxyquire": "^1.7.10",
"semantic-release": "^6.3.2",
"sinon": "^1.17.6",
"ts-loader": "^1.3.2",
"tslint": "^4.4.2",
"typescript": "^2.0.9",
"typescript-awaiter": "^1.0.0",
"webpack": "^1.13.3",
Expand All @@ -42,11 +45,13 @@
"repository": "http://github.com/GrimoireGL/GrimoireJS",
"scripts": {
"test": "tsc --outDir ./lib && babel ./lib --presets es2015,stage-2 --plugin transform-runtime --out-dir ./lib-es5 && babel ./test --presets es2015,stage-2 --plugin transform-runtime --out-dir ./test-es5 && ava ./test-es5/**/*Test.js --verbose --serial",
"lint":"tslint -c tslint.json ./src/**/*.ts",
"prepublish": "npm run build -- --prod&& npm test",
"start": "webpack --progress --watch",
"build": "webpack --progress",
"generate-expose": "cauldron generate-exposure --src ./src --dest ./src/index.ts --ts --main ./src/main.ts",
"generate-reference": "cauldron generate-reference --src ./src --dest ./src/index.ts --ts --main ./src/main.ts --dts ./ref"
"generate-reference": "cauldron generate-reference --src ./src --dest ./src/index.ts --ts --main ./src/main.ts --dts ./ref",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"grimoire": {
"doc": {
Expand All @@ -56,5 +61,8 @@
"dest": "./lib-md/index.md"
}
},
"license": "MIT"
"license": "MIT",
"release": {
"verifyConditions": "condition-circle"
}
}
4 changes: 4 additions & 0 deletions src/Base/AttributeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export default class AttributeManager {
if (this._attributesFQNMap[attr.name.fqn]) {
Utility.remove(this._attributesFQNMap[attr.name.fqn], attr);
Utility.remove(this._attributesMap[attr.name.name], attr);
delete this._attributesFQNMap[attr.name.fqn];
if (this._attributesMap[attr.name.name].length === 0) {
delete this._attributesMap[attr.name.name];
}
return true;
}
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/Base/NSDictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class NSDictionary<V> {
break;
}
}
if (theMap.length === 0) {
delete this._nameObjectMap[key.name];
}
return true;
}
return false;
Expand Down
6 changes: 5 additions & 1 deletion src/Base/XMLReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class XMLReader {
let errorneousParse = XMLReader._parser.parseFromString("<", "text/xml");
delete console.error; // restore...
console.error = defaultError;

if ((errorneousParse as any).documentURI === void 0) {
return false;
}
Expand All @@ -22,7 +23,10 @@ class XMLReader {
return parsedDocument.getElementsByTagNameNS(parsererrorNS, "parsererror").length > 0;
};
const parsed = XMLReader._parser.parseFromString(doc as string, "text/xml");
if (isParseError(parsed)) {
// if (isParseError(parsed)) {
// throw new Error("Error parsing XML");
// }
if (!parsed || parsed.getElementsByTagName("parsererror").length > 0) {
throw new Error("Error parsing XML");
}
if (rootElementName) {
Expand Down
15 changes: 11 additions & 4 deletions src/Interface/NodeInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ class NodeInterface {
});
return this;
}
public map<T>(func: (node: GomlNode, gomlIndex: number, nodeIndex: number) => T): T[][] {
return this.nodes.map((array, gomlIndex) => {
return array.map((node, nodeIndex) => {
return func(node, gomlIndex, nodeIndex);
});
});
}
public find(predicate: (node: GomlNode, gomlIndex: number, nodeIndex: number) => boolean): GomlNode {
const nodes = this.nodes;
for (let i = 0; i < nodes.length; i++) {
Expand Down Expand Up @@ -239,10 +246,10 @@ class NodeInterface {
return Utility.flat(this.nodes);
}

public addChildByName(nodeName: string | NSIdentity, attributes: { [attrName: string]: any }): void {
this.forEach(node => {
node.addChildByName(nodeName, attributes);
});
public addChildByName(nodeName: string | NSIdentity, attributes: { [attrName: string]: any }): NodeInterface {
return new NodeInterface(this.map(node => {
return node.addChildByName(nodeName, attributes);
}));
}
public sendMessage(message: string, args?: any): void {
this.forEach(node => {
Expand Down
3 changes: 2 additions & 1 deletion src/Node/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ export default class Component extends IDObject {
this.attributes.delete(attrId);
this._additionalAttributesNames.splice(index, 1);
} else {
this._additionalAttributesNames.forEach(id => {
const arr = [].concat(this._additionalAttributesNames);
arr.forEach(id => {
this.__removeAttributes(id.name);
});
}
Expand Down
12 changes: 9 additions & 3 deletions src/Node/GomlNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,17 @@ class GomlNode extends EEObject {
}

public getComponentsInChildren<T>(name: string | NSIdentity | (new () => T)): T[] {
if (name === null) {
throw new Error("getComponentsInChildren recieve null or undefined");
}
return this.callRecursively(node => node.getComponent<T>(name)).filter(c => !!c);
}
public getComponentInAncestor<T>(name: string | NSIdentity | (new () => T)): T {
if (name === null) {
throw new Error("getComponentInAncestor recieve null or undefined");
}
if (this.parent) {
return this.parent._getComponentInAncesotor(name);
return this.parent._getComponentInAncestor(name);
}
return null;
}
Expand Down Expand Up @@ -651,13 +657,13 @@ class GomlNode extends EEObject {



private _getComponentInAncesotor<T>(name: string | NSIdentity | (new () => T)): T {
private _getComponentInAncestor<T>(name: string | NSIdentity | (new () => T)): T {
const ret = this.getComponent(name);
if (ret) {
return ret;
}
if (this.parent) {
return this.parent._getComponentInAncesotor(name);
return this.parent._getComponentInAncestor(name);
}
return null;
}
Expand Down
11 changes: 1 addition & 10 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"eofline": true,
"indent": [true, "spaces"],
"label-position": true,
"label-undefined": true,
"member-access": true,
"member-ordering": [true,
"public-before-private",
Expand All @@ -23,7 +22,6 @@
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
Expand All @@ -32,8 +30,6 @@
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-unreachable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"one-line": [true,
Expand All @@ -60,11 +56,6 @@
"check-operator",
"check-separator",
"check-type"
],
"private-method-name":true,
"public-method-name":true,
"protected-method-name":true,
"no-implicit-return-type":true,
"no-unprivate-method-without-comment":false
]
}
}
Loading

0 comments on commit fa17570

Please sign in to comment.