dag-rs 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dag-rs
2
2
 
3
- `dag-rs` parses workspace and constructs a Directed Acyclic Graph (DAG) of local package dependencies within a monorepo or similar setups. Each edge in the graph represents a `dependent → dependency` relationship.
3
+ `dag-rs` (Directed Acyclic Graph) parses workspace and constructs a Directed Acyclic Graph (DAG) of local package dependencies within a monorepo or similar setups. Each edge in the graph represents a `dependent → dependency` relationship.
4
4
 
5
5
 
6
6
  ## Installation
@@ -11,30 +11,152 @@ npm install dag-rs
11
11
  yarn add dag-rs
12
12
  ```
13
13
 
14
+ > [!NOTE]
15
+ > Right now `getAffectedPkg` doesnt support circular dependency it might log `[1] 867885 segmentation fault (core dumped) node usage.cjs
16
+
14
17
  ## Usage
18
+
19
+ ### CommonJS
15
20
  ```
16
- import dag from 'dag-rs';
21
+ const { dag, getAffectedPkg } = require('dag-rs');
17
22
 
18
23
  for (const obj of dag()) {
19
24
  console.log(obj);
20
25
  }
26
+
27
+ for (const obj of getAffectedPkg("@rocket.chat/fuselage")) {
28
+ console.log(obj);
29
+ }
21
30
  ```
22
31
 
23
- ## Example Output `(dependent → dependency)`:
32
+ ### ESM
33
+ ```
34
+ import { dag, getAffectedPkg } from 'dag-rs';
35
+
36
+ for (const obj of dag()) {
37
+ console.log(obj);
38
+ }
39
+
40
+ for (const obj of getAffectedPkg("@rocket.chat/fuselage")) {
41
+ console.log(obj);
42
+ }
43
+ ```
44
+
45
+ ## Example Output :
46
+ ### getAffectedPkg("@rocket.chat/fuselage") → returns all the direct , transitive dependencies
47
+ ```
48
+ // dependents of @rocket.chat/fuselage package
49
+
50
+ @rocket.chat/layout
51
+ @rocket.chat/fuselage-toastbar
52
+ @rocket.chat/fuselage-forms
53
+ @rocket.chat/onboarding-ui
54
+
24
55
  ```
25
- { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage' }
26
- { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage-hooks' }
27
- { '@rocket.chat/onboarding-ui': '@rocket.chat/icons' }
28
- { '@rocket.chat/onboarding-ui': '@rocket.chat/layout' }
29
56
 
57
+ ## Example Output:
58
+ ### dag() → returns all packages in the project
59
+
60
+ ```
61
+ // dependent : dependency
62
+
63
+ { '@rocket.chat/fuselage-monorepo': '@rocket.chat/prettier-config' }
64
+ { '@rocket.chat/fuselage-monorepo': 'update-readme' }
65
+ { '@rocket.chat/css-in-js': '@rocket.chat/css-supports' }
66
+ { '@rocket.chat/css-in-js': '@rocket.chat/memo' }
67
+ {
68
+ '@rocket.chat/css-in-js': '@rocket.chat/stylis-logical-props-middleware'
69
+ }
70
+ { '@rocket.chat/css-in-js': 'lint-all' }
71
+ { '@rocket.chat/css-supports': '@rocket.chat/memo' }
72
+ { '@rocket.chat/css-supports': 'lint-all' }
73
+ { '@rocket.chat/emitter': 'lint-all' }
74
+ { '@rocket.chat/fuselage': '@rocket.chat/css-in-js' }
75
+ { '@rocket.chat/fuselage': '@rocket.chat/css-supports' }
76
+ { '@rocket.chat/fuselage': '@rocket.chat/fuselage-tokens' }
77
+ { '@rocket.chat/fuselage': '@rocket.chat/memo' }
78
+ { '@rocket.chat/fuselage': '@rocket.chat/styled' }
79
+ { '@rocket.chat/fuselage': '@rocket.chat/fuselage-hooks' }
80
+ { '@rocket.chat/fuselage': '@rocket.chat/icons' }
81
+ { '@rocket.chat/fuselage': '@rocket.chat/fuselage-hooks' }
82
+ { '@rocket.chat/fuselage': '@rocket.chat/icons' }
83
+ { '@rocket.chat/fuselage': '@rocket.chat/storybook-dark-mode' }
30
84
  { '@rocket.chat/fuselage': 'lint-all' }
31
85
  { '@rocket.chat/fuselage': 'testing-utils' }
32
-
33
86
  { '@rocket.chat/fuselage-forms': '@rocket.chat/emitter' }
34
87
  { '@rocket.chat/fuselage-forms': '@rocket.chat/fuselage' }
35
88
  { '@rocket.chat/fuselage-forms': '@rocket.chat/fuselage-hooks' }
89
+ { '@rocket.chat/fuselage-forms': '@rocket.chat/fuselage' }
36
90
  { '@rocket.chat/fuselage-forms': '@rocket.chat/fuselage-tokens' }
91
+ { '@rocket.chat/fuselage-forms': '@rocket.chat/storybook-dark-mode' }
37
92
  { '@rocket.chat/fuselage-forms': 'lint-all' }
93
+ { '@rocket.chat/fuselage-hooks': '@rocket.chat/emitter' }
94
+ { '@rocket.chat/fuselage-hooks': '@rocket.chat/fuselage-tokens' }
95
+ { '@rocket.chat/fuselage-hooks': '@rocket.chat/emitter' }
96
+ { '@rocket.chat/fuselage-hooks': '@rocket.chat/fuselage-tokens' }
97
+ { '@rocket.chat/fuselage-hooks': 'lint-all' }
98
+ { '@rocket.chat/fuselage-hooks': 'testing-utils' }
99
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/fuselage' }
100
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/fuselage-hooks' }
101
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/styled' }
102
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/fuselage' }
103
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/fuselage-hooks' }
104
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/fuselage-tokens' }
105
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/layout' }
106
+ {
107
+ '@rocket.chat/fuselage-toastbar': '@rocket.chat/storybook-dark-mode'
108
+ }
109
+ { '@rocket.chat/fuselage-toastbar': '@rocket.chat/styled' }
110
+ { '@rocket.chat/fuselage-toastbar': 'lint-all' }
111
+ { '@rocket.chat/fuselage-tokens': 'build-design-tokens' }
112
+ { '@rocket.chat/fuselage-tokens': 'lint-all' }
113
+ { '@rocket.chat/icons': 'build-icons' }
114
+ { '@rocket.chat/icons': 'lint-all' }
115
+ { '@rocket.chat/layout': '@rocket.chat/fuselage' }
116
+ { '@rocket.chat/layout': '@rocket.chat/fuselage' }
117
+ { '@rocket.chat/layout': '@rocket.chat/fuselage-tokens' }
118
+ { '@rocket.chat/layout': '@rocket.chat/storybook-dark-mode' }
119
+ { '@rocket.chat/layout': 'lint-all' }
120
+ { '@rocket.chat/logo': '@rocket.chat/fuselage-hooks' }
121
+ { '@rocket.chat/logo': '@rocket.chat/styled' }
122
+ { '@rocket.chat/logo': '@rocket.chat/fuselage-tokens' }
123
+ { '@rocket.chat/logo': 'build-logo' }
124
+ { '@rocket.chat/logo': 'lint-all' }
125
+ { '@rocket.chat/memo': 'lint-all' }
126
+ { '@rocket.chat/mp3-encoder': 'lint-all' }
127
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage' }
128
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage-hooks' }
129
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/icons' }
130
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/layout' }
131
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/logo' }
132
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/styled' }
133
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage' }
134
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage-hooks' }
135
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/fuselage-tokens' }
136
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/icons' }
137
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/layout' }
138
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/logo' }
139
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/storybook-dark-mode' }
140
+ { '@rocket.chat/onboarding-ui': '@rocket.chat/styled' }
141
+ { '@rocket.chat/onboarding-ui': 'lint-all' }
142
+ { '@rocket.chat/prettier-config': 'lint-all' }
143
+ { '@rocket.chat/storybook-dark-mode': 'lint-all' }
144
+ { '@rocket.chat/string-helpers': 'lint-all' }
145
+ { '@rocket.chat/styled': '@rocket.chat/css-in-js' }
146
+ { '@rocket.chat/styled': 'lint-all' }
147
+ {
148
+ '@rocket.chat/stylis-logical-props-middleware': '@rocket.chat/css-supports'
149
+ }
150
+ { '@rocket.chat/stylis-logical-props-middleware': 'lint-all' }
151
+ { 'build-design-tokens': 'tools-utils' }
152
+ { 'build-design-tokens': 'lint-all' }
153
+ { 'build-icons': 'tools-utils' }
154
+ { 'build-icons': 'lint-all' }
155
+ { 'build-logo': 'lint-all' }
156
+ { 'build-logo': 'tools-utils' }
157
+ { 'testing-utils': 'lint-all' }
158
+ { 'tools-utils': 'lint-all' }
159
+ { 'update-readme': 'lint-all' }
38
160
  ```
39
161
 
40
162
  ## Building dag-rs
@@ -50,19 +172,6 @@ $ yarn build
50
172
 
51
173
  ## Project Layout
52
174
 
53
- The directory structure of this project is:
54
-
55
- ```
56
- dag/
57
- ├── Cargo.toml
58
- ├── README.md
59
- ├── src/
60
- | └── lib.rs
61
- ├── index.node
62
- ├── package.json
63
- └── target/
64
- ```
65
-
66
175
  | Entry | Purpose |
67
176
  |----------------|------------------------------------------------------------------------------------------------------------------------------------------|
68
177
  | `Cargo.toml` | The Cargo [manifest file](https://doc.rust-lang.org/cargo/reference/manifest.html), which informs the `cargo` command. |
@@ -73,4 +182,5 @@ dag/
73
182
  | `package.json` | The npm [manifest file](https://docs.npmjs.com/cli/v7/configuring-npm/package-json), which informs the `npm` command. |
74
183
  | `target/` | Binary artifacts generated by the Rust build. |
75
184
 
76
-
185
+ ## Contribution
186
+ All forms of contribution are welcome!
package/index.node CHANGED
Binary file
package/lib/index.cjs ADDED
@@ -0,0 +1,6 @@
1
+ const native = require('../index.node');
2
+
3
+ module.exports = {
4
+ dag: native.dag,
5
+ getAffectedPkg: native.getAffectedPkg
6
+ };
package/lib/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import cjs from './index.cjs';
2
+
3
+ export const dag = cjs.dag;
4
+ export const getAffectedPkg = cjs.getAffectedPkg;
5
+
6
+ export default cjs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dag-rs",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "publishConfig": {
@@ -10,6 +10,12 @@
10
10
  "lib",
11
11
  "*.node"
12
12
  ],
13
+ "exports": {
14
+ ".": {
15
+ "require": "./lib/index.cjs",
16
+ "import": "./lib/index.mjs"
17
+ }
18
+ },
13
19
  "scripts": {
14
20
  "test": "cargo test",
15
21
  "cargo-build": "cargo build --message-format=json-render-diagnostics > cargo.log",
package/lib/index.js DELETED
@@ -1,3 +0,0 @@
1
- const native = require('../index.node');
2
-
3
- module.exports = native.dag;