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

Extract graph components and utils to separate package #2319

Merged
merged 1 commit into from
Mar 2, 2022
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
4 changes: 2 additions & 2 deletions .storybook/Container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ limitations under the License.

@import '../src/scss/App';

@import '@tektoncd/dashboard-components/src/components/Graph/Graph.scss';
@import '@tektoncd/dashboard-components/src/components/Graph/ZoomablePipelineGraph.scss';
@import '@tektoncd/dashboard-graph/src/components/Graph.scss';
@import '@tektoncd/dashboard-graph/src/components/ZoomablePipelineGraph.scss';
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
},
stories: [
'../src/**/*.stories.js',
'../packages/components/src/**/*.stories.js'
'../packages/**/*.stories.js'
],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
Expand Down
57 changes: 39 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"//": "Workspaces must be listed explicitly to ensure they're processed in the correct order until npm natively supports detecting the topological order",
"workspaces": [
"packages/utils",
"packages/components"
"packages/components",
"packages/graph"
]
}
4 changes: 0 additions & 4 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
},
"dependencies": {
"@tektoncd/dashboard-utils": "file:../utils",
"@visx/event": "^2.1.0",
"@visx/network": "^2.1.0",
"d3-path": "^1.0.8",
"elkjs": "^0.5.1",
"js-yaml": "^3.13.0",
"linkify-it": "^3.0.2",
"prop-types": "^15.7.2",
Expand Down
4 changes: 1 addition & 3 deletions packages/components/src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2021 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -19,7 +19,6 @@ export { default as DotSpinner } from './DotSpinner';
export { default as ErrorBoundary } from './ErrorBoundary';
export { default as FormattedDate } from './FormattedDate';
export { default as FormattedDuration } from './FormattedDuration';
export { default as Graph } from './Graph/Graph';
export { default as Header } from './Header';
export { default as KeyValueList } from './KeyValueList';
export { default as LabelFilter } from './LabelFilter';
Expand All @@ -31,7 +30,6 @@ export { default as LogsToolbar } from './LogsToolbar';
export { default as Modal } from './Modal';
export { default as PageErrorBoundary } from './PageErrorBoundary';
export { default as Param } from './Param';
export { default as PipelineGraph } from './Graph/PipelineGraph';
export { default as PipelineResources } from './PipelineResources';
export { default as PipelineRun } from './PipelineRun';
export { default as PipelineRuns } from './PipelineRuns';
Expand Down
51 changes: 51 additions & 0 deletions packages/graph/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@tektoncd/dashboard-graph",
"version": "0.1.0",
"author": {
"name": "The Tekton Authors"
},
"keywords": [
"tekton",
"tektoncd",
"components",
"graph",
"visualization",
"react"
],
"license": "Apache-2.0",
"private": false,
"main": "./src/index.js",
"scripts": {
"version": "npm pkg set \"dependencies.@tektoncd/dashboard-utils=$npm_new_version\"",
"postpublish": "npm pkg set \"dependencies.@tektoncd/dashboard-utils=file:../utils\""
},
"dependencies": {
"@tektoncd/dashboard-utils": "file:../utils",
"@visx/event": "^2.1.0",
"@visx/network": "^2.1.0",
"classnames": "^2.2.6",
"d3-path": "^1.0.8",
"elkjs": "^0.5.1"
},
"peerDependencies": {
"@carbon/icons-react": "^10.44.0",
"carbon-components-react": "^7.50.0",
"react": "^16.14.0 || ^17.0.1",
"react-intl": "^5.10.2"
},
"engines": {
"node": "^16.13.2",
"npm": "^8.1.2"
},
"publishConfig": {
"access": "public"
},
"sideEffects": [
"*.scss"
],
"repository": {
"type": "git",
"url": "https://github.com/tektoncd/dashboard.git",
"directory": "packages/graph"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
/* istanbul ignore file */
import { getStatus } from './status';
import { getStatus } from '@tektoncd/dashboard-utils';

const defaultHeight = 30;
const defaultWidth = 200;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2020 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -23,7 +23,7 @@ export default {
default: 'white'
}
},
title: 'Experimental/Components/Graph/Graph'
title: 'Experimental/Graph/Graph'
};

export const Base = () => <Graph graph={graph} />;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2021 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -69,7 +69,7 @@ export default {
default: 'white'
}
},
title: 'Experimental/Components/Graph/Node'
title: 'Experimental/Graph/Node'
};

export const Start = () => <Node type="Start" width="60" height="60" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ limitations under the License.
*/
/* istanbul ignore file */
import React, { Component } from 'react';
import { buildGraphData } from '@tektoncd/dashboard-utils';
import buildGraphData from '../buildGraphData';

import Graph from './Graph';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2020 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -26,7 +26,7 @@ export default {
default: 'white'
}
},
title: 'Experimental/Components/Graph/PipelineGraph'
title: 'Experimental/Graph/PipelineGraph'
};

export const Base = () => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2020 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -26,7 +26,7 @@ export default {
default: 'white'
}
},
title: 'Experimental/Components/Graph/ZoomablePipelineGraph'
title: 'Experimental/Graph/ZoomablePipelineGraph'
};

export const Base = () => (
Expand Down
18 changes: 18 additions & 0 deletions packages/graph/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* istanbul ignore file */

export { default as buildGraphData } from './buildGraphData';

export { default as Graph } from './components/Graph';
export { default as PipelineGraph } from './components/PipelineGraph';
1 change: 0 additions & 1 deletion packages/utils/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
import { labels as labelConstants } from './constants';
import { getStatus } from './status';

export { default as buildGraphData } from './buildGraphData';
export * from './constants';
export * from './hooks';
export { paths, urls } from './router';
Expand Down