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

Refactor GraferController and add remove layer functions #31

Merged
merged 17 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: pages
on:
push:
branches:
- master
jobs:
clean-lint-build-test:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- name: checkout
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn

- name: install
run: yarn

- name: clean
run: yarn clean

- name: lint
run: yarn lint

- name: build
run: yarn examples

- name: test
run: yarn test

- name: Deploy
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: build/examples
2 changes: 1 addition & 1 deletion examples/src/bundledEdgesLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async function loadGraph(container: HTMLElement, info: LayoutInfo): Promise<void
type: 'CurvedPath',
data: [],
options: {
alpha: 0.25,
alpha: 0.04,
nearDepth: 0.9,
},
};
Expand Down
30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"clean:cache": "rimraf .rts2_cache",
"develop": "yarn build:dev --watch --config-dev-server",
"docs": "typedoc --out ./docs ./src --exclude 'node_modules/**/*' --mode file --includeVersion --stripInternal --skipLibCheck",
"examples": "rollup --config --config-examples",
"lint": "eslint --config ./.eslintrc.cjs \"./{src,tests,examples}/**/*.{js,ts}\"",
"test": "karma start --single-run --browsers ChromeHeadless karma.conf.cjs",
"prepack": "run-s clean test lint",
Expand All @@ -48,22 +49,22 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-node-resolve": "^11.1.0",
"@rollup/plugin-replace": "^2.3.4",
"@types/chai": "^4.2.14",
"@types/chroma-js": "^2.1.2",
"@types/chroma-js": "^2.1.3",
"@types/mocha": "^8.2.0",
"@types/resize-observer-browser": "^0.1.4",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
"@types/resize-observer-browser": "^0.1.5",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"chai": "^4.2.0",
"eslint": "^7.15.0",
"eslint": "^7.18.0",
"eslint-config-esnext": "^4.1.0",
"eslint-plugin-import": "^2.22.1",
"globby": "^11.0.0",
"globby": "^11.0.2",
"glslify-import": "^3.1.0",
"husky": "^4.3.5",
"karma": "^5.1.1",
"husky": "^4.3.8",
"karma": "^6.0.2",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^2.0.1",
Expand All @@ -73,14 +74,15 @@
"mocha": "^8.2.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^2.34.2",
"rollup": "^2.38.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-glslify": "^1.2.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.29.0",
"tslib": "^2.0.3",
"tweakpane": "^1.5.7",
"typedoc": "^0.19.2",
"typescript": "^4.1.2"
"tslib": "^2.1.0",
"tweakpane": "^1.5.8",
"typedoc": "^0.20.19",
"typescript": "^4.1.3"
},
"dependencies": {
"@dekkai/data-source": "^0.1.0",
Expand Down
19 changes: 16 additions & 3 deletions rollup.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const commonjs = require('@rollup/plugin-commonjs');
const resolve = require('@rollup/plugin-node-resolve').nodeResolve;
const replace = require('@rollup/plugin-replace');
const glslify = require('rollup-plugin-glslify');
const copy = require('rollup-plugin-copy');
const globby = require('globby');
const server = require('live-server');

Expand All @@ -25,13 +26,15 @@ const types = {
DIST: 'dist',
DEV: 'dev',
TEST: 'test',
EXAMPLES: 'examples',
};

// Directories where the build files will be written
const buildDir = path.resolve(__dirname, 'build');
const outputDirs = {
[types.LIB]: path.join(buildDir, 'lib'),
[types.DEV]: path.join(buildDir, 'dev'),
[types.EXAMPLES]: path.join(buildDir, 'examples'),
[types.DIST]: path.join(buildDir, 'dist'),
};

Expand Down Expand Up @@ -81,7 +84,7 @@ function inputForType (type) {
});
}

if (type === types.DEV) {
if (type === types.DEV || type === types.EXAMPLES) {
globby.sync([
path.join('examples/src/', '/**/*.{ts,js}'),
`!${path.join('examples/src/', '/**/*.d.ts')}`,
Expand Down Expand Up @@ -144,7 +147,7 @@ function outputForType (type) {

function pluginsForType (type) {
const plugins = [];
if (type === types.DEV || type === types.TEST) {
if (type === types.DEV || type === types.TEST || type === types.EXAMPLES) {
plugins.push(
resolve({
extensions,
Expand Down Expand Up @@ -172,11 +175,19 @@ function pluginsForType (type) {
);
}

if (type === types.EXAMPLES) {
plugins.push(copy({
targets: [
{ src: 'examples/static/**/*', dest: 'build/examples' },
],
}));
}

return { plugins };
}

function chunksForType (type) {
if (type === types.DEV) {
if (type === types.DEV || type === types.EXAMPLES) {
return {
manualChunks: function (id) {
if (id.includes('tslib.js')) {
Expand Down Expand Up @@ -279,6 +290,8 @@ module.exports = function generator (args) {
type = types.TEST;
} else if (args['config-dev'] || args['config-dev-server']) {
type = types.DEV;
} else if (args['config-examples']) {
type = types.EXAMPLES;
} else {
type = types.LIB;
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/GraphPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const kGLTypes: GLDataTypes<PointData> = {
};

export class GraphPoints {
public static fromNodesArray<R extends GraphPoints>(context: App, nodes: unknown[][], mappings: Partial<PointDataMappings> = {}): R {
public static createGraphFromNodes<R extends GraphPoints>(context: App, nodes: unknown[][], mappings: Partial<PointDataMappings> = {}): R {
let pointIndex = 0;
const dataMappings: PointDataMappings = Object.assign({}, kDefaultMappings, {
id: () => pointIndex++,
Expand Down
Loading