Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redo repo #42

Merged
merged 15 commits into from Jan 13, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 3 additions & 7 deletions .gitignore
Expand Up @@ -2,15 +2,11 @@
*.tmp.txt
node_modules
build
local/
.tscache/
coverage

# IDEs
.idea/
# Emacs
.#*

# vim
*.swp
*~

# Eclipse
*.project
4 changes: 4 additions & 0 deletions .istanbul.yml
@@ -0,0 +1,4 @@
check:
each:
statements: 90
lines: 90
9 changes: 1 addition & 8 deletions .npmignore
@@ -1,15 +1,8 @@
build/
bower_components/
docs/
src/
test/
typings/
bower.json
coverage/
circle.yml
Gruntfile.js
index.html
index.js
license_header.txt
tsd.json
tslint.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we now include these?

Copy link
Contributor

@adidahiya adidahiya Jan 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all *.yml files are now ignored.

it would be safer to write this file like https://github.com/palantir/plottable/blob/develop/.npmignore, which whitelists files in the package rather than blacklists them, but we don't do that consistently everywhere (blueprint doesn't do it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice

12 changes: 8 additions & 4 deletions package.json
Expand Up @@ -5,15 +5,17 @@
"main": "build/src/index.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build folder is gitignored; will it exist when we publish to npm? How is publishing done now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so i think the build dir is gitignored but NOT npmignored. I think that means it'll be included when we run npm publish. Haven't tried that yet though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we'll have to make sure we run yarn build or something before npm publish right?

"types": "build/src/index.d.ts",
"buildPath": "build",
"testsGlob": "build/test/*Tests.js",
"scripts": {
"build": "npm-run-all build:clean build:compile build:namespace",
"build:clean": "rimraf ${npm_package_buildPath}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is rimraf better than rm -rf? Also, can you explain the ${npm_package_buildPath} syntax

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rimraf is platform-agnostic

"build:compile": "tsc --project .",
"build:namespace": "echo \"\\nexport as namespace SVGTypewriter;\" >> ${npm_package_types}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa what is export as namespace? Is this some crazy Typescript magic that converts a module into a namespace?!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"docs": "typedoc -out docs src",
"lint:ts": "tslint src/**/*.ts test/**/*.ts",
"test": "npm-run-all build lint:ts test:mocha",
"test:mocha": "mochify --reporter spec ${npm_package_buildPath}/test/**/*Tests.js"
"test": "npm-run-all build lint:ts test:mocha test:coverage",
"test:mocha": "mochify --reporter spec --plugin [ mochify-istanbul --report text --report json --dir coverage --exclude '**/test/**/*' ] ${npm_package_testsGlob}",
"test:coverage": "istanbul check-coverage"
},
"keywords": [
"svg",
Expand All @@ -25,19 +27,21 @@
"dependencies": {
"@types/d3": "3.5.36",
"@types/es6-shim": "^0.31.32",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd peg @types versions to a specific version since they seem to change and break all the time

"d3": "3.5.16",
"tslint": "^4.3.1"
"d3": "3.5.16"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, we shouldn't peg our actual code dependencies to a specific version. Is there a reason why we specifically need d3 3.5.16 vs any other version? I think ^3.5.0 is good

},
"devDependencies": {
"@types/chai": "3.4.34",
"@types/mocha": "2.2.33",
"@types/node": "^6.0.52",
"chai": "3.5.0",
"istanbul": "^0.4.5",
"mocha": "3.2.0",
"mochify-istanbul": "^2.4.1",
"mochify": "2.18.1",
"npm-run-all": "3.1.2",
"phantomjs-prebuilt": "2.1.14",
"rimraf": "2.5.4",
"tslint": "^4.3.1",
"typedoc": "^0.5.3",
"typescript": "2.1.4"
}
Expand Down
6 changes: 6 additions & 0 deletions src/animators/baseAnimator.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(probably a separate PR) you could use the file-header lint rule to enforce this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and added that. Pretty simple

* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

export class BaseAnimator {
Expand Down
5 changes: 5 additions & 0 deletions src/animators/index.ts
@@ -1,3 +1,8 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the big pros/cons of re-exporting in index vs. consumers doing

import * as BaseAnimator from "./animators/baseAnimator"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-exporting is better; it allows you to reduce your API surface area. if consumers have to know about the folder structure to import symbols, then that becomes part of your public API.

* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export * from "./baseAnimator";
export * from "./opacityAnimator";
Expand Down
6 changes: 6 additions & 0 deletions src/animators/opacityAnimator.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

import { BaseAnimator } from "./baseAnimator";
Expand Down
5 changes: 5 additions & 0 deletions src/animators/unveilAnimator.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as Utils from "../utils";
import { BaseAnimator } from "./baseAnimator";
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as Animators from "./animators";
import * as Measurers from "./measurers";
Expand Down
6 changes: 6 additions & 0 deletions src/measurers/abstractMeasurer.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

import * as Utils from "../utils";
Expand Down
6 changes: 6 additions & 0 deletions src/measurers/cacheCharacterMeasurer.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";
import * as Utils from "../utils";

Expand Down
6 changes: 6 additions & 0 deletions src/measurers/cacheMeasurer.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";
import * as Utils from "../utils";

Expand Down
6 changes: 6 additions & 0 deletions src/measurers/characterMeasurer.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

import { IDimensions } from "./abstractMeasurer";
Expand Down
5 changes: 5 additions & 0 deletions src/measurers/index.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export * from "./abstractMeasurer";
export * from "./cacheCharacterMeasurer";
Expand Down
5 changes: 5 additions & 0 deletions src/measurers/measurer.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

Expand Down
6 changes: 6 additions & 0 deletions src/utils/cache.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

export class Cache<T> {
Expand Down
6 changes: 6 additions & 0 deletions src/utils/dom.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

export class DOM {
Expand Down
5 changes: 5 additions & 0 deletions src/utils/index.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export * from "./cache";
export * from "./dom";
Expand Down
5 changes: 5 additions & 0 deletions src/utils/methods.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export class Methods {
/**
Expand Down
6 changes: 6 additions & 0 deletions src/utils/stringMethods.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export class StringMethods {
/**
* Treat all sequences of consecutive whitespace as a single " ".
Expand Down
5 changes: 5 additions & 0 deletions src/utils/tokenizer.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export class Tokenizer {
private WordDividerRegExp = new RegExp("\\W");
Expand Down
5 changes: 5 additions & 0 deletions src/wrappers/index.ts
@@ -1,3 +1,8 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export * from "./singleLineWrapper";
export * from "./wrapper";
6 changes: 6 additions & 0 deletions src/wrappers/singleLineWrapper.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as Measurers from "../measurers";
import { IWrappingResult, Wrapper } from "./wrapper";

Expand Down
6 changes: 6 additions & 0 deletions src/wrappers/wrapper.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as Measurers from "../measurers";
import * as Utils from "../utils";

Expand Down
5 changes: 5 additions & 0 deletions src/writers/index.ts
@@ -1,2 +1,7 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

export * from "./writer";
6 changes: 6 additions & 0 deletions src/writers/writer.ts
@@ -1,3 +1,9 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

import * as d3 from "d3";

import * as Animators from "../animators";
Expand Down
10 changes: 8 additions & 2 deletions test/tests/animatorTests.ts → test/animatorTests.ts
@@ -1,8 +1,14 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

/// <reference types="mocha"/>

import { assert } from "chai";
import * as SVGTypewriter from "../../src";
import { generateSVG } from "../utils";
import * as SVGTypewriter from "../src";
import { generateSVG } from "./utils";

describe("Animator Test Suite", () => {

Expand Down
8 changes: 7 additions & 1 deletion test/tests/cacheTests.ts → test/cacheTests.ts
@@ -1,6 +1,12 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

/// <reference types="mocha"/>
import { assert } from "chai";
import * as SVGTypewriter from "../../src";
import * as SVGTypewriter from "../src";

describe("Cache", () => {
let callbackCalled = false;
Expand Down
10 changes: 8 additions & 2 deletions test/tests/domTests.ts → test/domTests.ts
@@ -1,7 +1,13 @@
/**
* Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
* Licensed under the MIT License (the "License"); you may obtain a copy of the
* license at https://github.com/palantir/svg-typewriter/blob/develop/LICENSE
*/

/// <reference types="mocha"/>
Copy link
Contributor

@hellochar hellochar Jan 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our tests still need <reference> comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out no, will remove

import { assert } from "chai";
import * as SVGTypewriter from "../../src";
import { generateSVG } from "../utils";
import * as SVGTypewriter from "../src";
import { generateSVG } from "./utils";

describe("Utils.DOM Test Suite", () => {
const domUtils = SVGTypewriter.Utils.DOM;
Expand Down