Skip to content

Commit d099747

Browse files
Merge pull request #53 from commitd/stuarthendren/public
fix: makes modules public
2 parents 891b767 + 8646b6d commit d099747

File tree

3 files changed

+57
-160
lines changed

3 files changed

+57
-160
lines changed

README.md

Lines changed: 25 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,185 +1,80 @@
11
<h1 align="center"> Components Graph </h1>
22
<br>
33
<p align="center">
4-
<img src="https://committed.software/Logo.svg" width="128px" alt="Project Logo"/>
4+
<img src="https://committed.io/Logo.svg" width="128px" alt="Project Logo"/>
55
</p>
66
<p align="center">
77
Committed Software Graph Component
88
</p>
99

10-
[![Committed Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fcommitted.software%2Fbadge)](https://committed.io)
10+
[![Committed Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fcommitted.io%2Fbadge)](https://committed.io)
1111
![Build Status](https://github.com/commitd/components-graph/workflows/build/badge.svg?branch=main)
1212
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=commitd_components-graph&metric=alert_status&token=aa002ca75e2f3a6d028af9074bceeda1ffa2f9f7)](https://sonarcloud.io/dashboard?id=commitd_components-graph)
1313
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=commitd_components-graph&metric=coverage&token=aa002ca75e2f3a6d028af9074bceeda1ffa2f9f7)](https://sonarcloud.io/dashboard?id=commitd_components-graph)
1414
![GitHub repo size](https://img.shields.io/github/repo-size/commitd/components-graph)
1515
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
1616

17-
A graph visualisation to be used in Committed products. It supports custom decoration, different layouts and user interactions.
17+
A graph visualisation. It supports custom decoration, different layouts and user interactions.
1818

1919
## Commands
2020

21-
TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.
21+
Install dependencies with
2222

23-
The recommended workflow is to run TSDX in one terminal:
23+
```bash
24+
npm install
25+
```
26+
27+
Build the modules
2428

2529
```bash
26-
yarn start
30+
npm run build
2731
```
2832

29-
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
33+
This builds to the relevant `/dist` folders.
3034

31-
Then run either Storybook or the example playground:
35+
### Modules
36+
37+
The project is published as `@committed/components-graph` but is further separated into modules so the non-ui code can be used in the backend.
38+
39+
- `@committed/graph` - contains the graph models, types and API
40+
- `@committed/component-graph-react` - contains the react specific UI components
3241

3342
### Storybook
3443

35-
Run inside another terminal:
44+
To view a storybook of the components, run:
3645

3746
```bash
38-
yarn storybook
47+
npm run storybook
3948
```
4049

41-
This loads the stories from `./stories`.
42-
43-
> NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.
44-
4550
### Example
4651

47-
Then run the example inside another:
52+
There is also an example project that uses the graph:
4853

4954
```bash
5055
cd example
51-
yarn install
52-
yarn start
56+
npm install
57+
npm run start
5358
```
5459

55-
The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
56-
57-
To do a one-off build, use `yarn build`.
58-
59-
To run tests, use `yarn test`.
60+
The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
6061

6162
## Configuration
6263

6364
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
6465

6566
### Jest
6667

67-
Jest tests are set up to run with `yarn test` and `testing-library`.
68-
69-
### Bundle analysis
70-
71-
Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `yarn size` and visulize it with `yarn analyze`.
72-
73-
#### Setup Files
74-
75-
This is the folder structure we set up for you:
76-
77-
```txt
78-
/example
79-
index.html
80-
index.tsx # test your component here in a demo app
81-
package.json
82-
tsconfig.json
83-
/src
84-
index.tsx # EDIT THIS
85-
/components
86-
/hooks
87-
/.storybook
88-
main.js
89-
preview.js
90-
.gitignore
91-
package.json
92-
README.md # EDIT THIS
93-
tsconfig.json
94-
```
95-
96-
### Generators
97-
98-
There are generators for components and hook these can be used to create the boilerplate files with:
99-
100-
```bash
101-
yarn generate
102-
```
68+
Jest tests are set up to run with `npm run test` and `testing-library`.
10369

10470
#### React Testing Library
10571

10672
Import `test/setup` in your test files to use `react-testing-library`.
10773

108-
### Rollup
109-
110-
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
111-
112-
### TypeScript
113-
114-
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
115-
116-
## Continuous Integration
117-
118-
### GitHub Actions
119-
120-
Two actions are added by default:
121-
122-
- `build` which installs deps w/ cache, lints, tests, and builds.
123-
- `release` Triggered on release with (commented) options to publish and deploy storybook
124-
- `size` which comments cost comparison of your library on every pull request using [size-limit](https://github.com/ai/size-limit)
125-
126-
You need to configure sonarcloud separately to analyse the project.
127-
128-
- Allow access on [github](https://github.com/organizations/commitd/settings/installations/)
129-
- Add the project on [sonarcloud](https://sonarcloud.io/projects/create)
130-
- Turn off the automated analysis in the sonorcloud settings.
131-
132-
## Optimizations
133-
134-
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
135-
136-
```js
137-
// ./types/index.d.ts
138-
declare var __DEV__: boolean
139-
140-
// inside your code...
141-
if (__DEV__) {
142-
console.log('foo')
143-
}
144-
```
145-
146-
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
147-
148-
## Module Formats
149-
150-
CJS, ESModules, and UMD module formats are supported.
151-
152-
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
153-
154-
## Deploying the Example Playground
155-
156-
The Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):
157-
158-
```bash
159-
cd example # if not already in the example folder
160-
npm run build # builds to dist
161-
netlify deploy # deploy the dist folder
162-
```
163-
164-
Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:
165-
166-
```bash
167-
netlify init
168-
# build command: yarn build && cd example && yarn && yarn build
169-
# directory to deploy: example/dist
170-
# pick yes for netlify.toml
171-
```
172-
17374
## Named Exports
17475

17576
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
17677

177-
## Including Styles
178-
179-
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
180-
181-
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
182-
18378
## Publishing to NPM
18479

185-
See `.github/workflows/release.yml`.
80+
Publish is handled by `semantic-release` use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). Use `npm run commit` for helper.

packages/graph/package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
{
22
"name": "@committed/graph",
3-
"version": "1.0.0",
4-
"description": "",
3+
"version": "0.0.0-development",
4+
"description": "Graph models, types and API",
5+
"author": "Committed",
6+
"private": false,
7+
"license": "MIT",
58
"main": "dist/committed-graph.cjs.js",
69
"module": "dist/committed-graph.esm.js",
710
"typings": "dist/index.d.ts",
811
"sideEffects": false,
9-
"publishConfig": {
10-
"registry": "https://registry.npmjs.org/"
11-
},
1212
"files": [
1313
"dist"
1414
],
15+
"publishConfig": {
16+
"registry": "https://registry.npmjs.org/"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/commitd/components-graph.git"
21+
},
22+
"bugs": {
23+
"url": "https://github.com/commitd/components-graph/issues"
24+
},
25+
"homepage": "https://github.com/commitd/components-graph#readme",
1526
"engines": {
1627
"node": ">=10"
1728
},
@@ -51,16 +62,6 @@
5162
"test:watch": "jest --watchAll",
5263
"precommit": "lint-staged"
5364
},
54-
"repository": {
55-
"type": "git",
56-
"url": "git+https://github.com/commitd/components-graph.git"
57-
},
58-
"author": "Committed",
59-
"license": "MIT",
60-
"bugs": {
61-
"url": "https://github.com/commitd/components-graph/issues"
62-
},
63-
"homepage": "https://github.com/commitd/components-graph#readme",
6465
"dependencies": {
6566
"n3": "^1.11.1",
6667
"rdf-literal": "^1.3.0",

packages/react/package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
{
22
"name": "@committed/components-graph-react",
3-
"version": "1.0.0",
4-
"description": "Committed Compoennts Graph for react",
3+
"version": "0.0.0-development",
4+
"description": "Committed Components Graph for react",
5+
"author": "Committed",
6+
"private": false,
7+
"license": "MIT",
58
"main": "dist/committed-components-graph-react.cjs.js",
69
"module": "dist/committed-components-graph-react.esm.js",
710
"typings": "dist/index.d.ts",
811
"sideEffects": false,
9-
"publishConfig": {
10-
"registry": "https://registry.npmjs.org/"
11-
},
1212
"files": [
1313
"dist"
1414
],
15+
"publishConfig": {
16+
"registry": "https://registry.npmjs.org/"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/commitd/components-graph.git"
21+
},
22+
"bugs": {
23+
"url": "https://github.com/commitd/components-graph/issues"
24+
},
25+
"homepage": "https://github.com/commitd/components-graph#readme",
1526
"engines": {
1627
"node": ">=10"
1728
},
@@ -55,16 +66,6 @@
5566
"storybook:build": "build-storybook",
5667
"storybook:deploy": "storybook-to-ghpages --ci"
5768
},
58-
"repository": {
59-
"type": "git",
60-
"url": "git+https://github.com/commitd/components-graph.git"
61-
},
62-
"author": "Committed",
63-
"license": "MIT",
64-
"bugs": {
65-
"url": "https://github.com/commitd/components-graph/issues"
66-
},
67-
"homepage": "https://github.com/commitd/components-graph#readme",
6869
"dependencies": {
6970
"@committed/graph": "*",
7071
"cytoscape-cola": "^2.4.0",

0 commit comments

Comments
 (0)