Skip to content

Commit

Permalink
chore(cli-plugins): make depcruise reusable (#8568)
Browse files Browse the repository at this point in the history
* chore(packages): make depcruise reusable

* feat(cli-plugins): make data migrate a plugin

* Revert "feat(cli-plugins): make data migrate a plugin"

This reverts commit 437eeb9.

* refactor to script

* fix readmes

* fix excluding tests in src

* add shebang, constant casing

* rename

* add open flag

* add script to pkg json

* rm directive

* update dependency graphs

* change alias to short

* Revert "rm directive"

This reverts commit 18aa7f1.

* revert to @ts-ignore
  • Loading branch information
jtoar authored Jun 15, 2023
1 parent 358993a commit 267a521
Show file tree
Hide file tree
Showing 14 changed files with 1,572 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,6 @@ export default {
},

/* rules you might want to tweak for your specific situation: */
{
name: 'not-to-test',
comment:
"This module depends on code within a folder that should only contain tests. As tests don't " +
"implement functionality this is odd. Either you're writing a test outside the test folder " +
"or there's something in the test folder that isn't a test.",
severity: 'error',
from: {
pathNot: '^(src/__tests__)'
},
to: {
path: '^(src/__tests__)'
}
},
{
name: 'not-to-spec',
comment:
Expand Down Expand Up @@ -206,7 +192,7 @@ export default {

/* conditions specifying which files not to follow further when encountered:
- path: a regular expression to match
- dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot
- dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/main/doc/rules-reference.md#dependencytypes-and-dependencytypesnot
for a complete list
*/
doNotFollow: {
Expand Down Expand Up @@ -283,14 +269,14 @@ export default {
to dependency-cruiser's current working directory. When not provided defaults
to './webpack.conf.js'.
The (optional) `env` and `args` attributes contain the parameters to be passed if
The (optional) `env` and `arguments` attributes contain the parameters to be passed if
your webpack config is a function and takes them (see webpack documentation
for details)
*/
// webpackConfig: {
// fileName: './webpack.config.js',
// env: {},
// args: {},
// arguments: {},
// },

/* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use
Expand Down Expand Up @@ -366,7 +352,7 @@ export default {
collapsePattern: 'node_modules/(@[^/]+/[^/]+|[^/]+)',

/* Options to tweak the appearance of your graph.See
https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions
https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions
for details and some examples. If you don't specify a theme
don't worry - dependency-cruiser will fall back to the default one.
*/
Expand Down Expand Up @@ -447,7 +433,7 @@ export default {
collapsePattern: '^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/(@[^/]+/[^/]+|[^/]+)',

/* Options to tweak the appearance of your graph.See
https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions
https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions
for details and some examples. If you don't specify a theme
for 'archi' dependency-cruiser will use the one specified in the
dot section (see above), if any, and otherwise use the default one.
Expand All @@ -461,4 +447,4 @@ export default {
}
}
};
// generated: dependency-cruiser@12.11.0 on 2023-03-23T23:57:13.098Z
// generated: dependency-cruiser@13.0.3 on 2023-06-08T22:17:09.126Z
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"check": "yarn node ./tasks/check/check.mjs",
"clean:prisma": "rimraf node_modules/.prisma/client && node node_modules/@prisma/client/scripts/postinstall.js",
"e2e": "node ./tasks/run-e2e",
"generate-dependency-graph": "node ./tasks/generateDependencyGraph.mjs",
"lint": "RWJS_CWD=packages/create-redwood-app/templates/ts eslint --config .eslintrc.js --ignore-pattern Routes.jsx packages",
"lint:fix": "yarn lint --fix",
"project:copy": "node ./tasks/framework-tools/frameworkFilesToProject.mjs",
Expand Down Expand Up @@ -72,6 +73,7 @@
"core-js": "3.30.2",
"cypress": "12.14.0",
"cypress-wait-until": "1.7.2",
"dependency-cruiser": "13.0.3",
"eslint": "8.42.0",
"fast-glob": "3.2.12",
"fs-extra": "11.1.1",
Expand Down
18 changes: 18 additions & 0 deletions packages/cli-packages/storybook/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# CLI Packages - Storybook

**WIP**: This package is the first example of extracting a command from `@redwoodjs/cli` into it's own CLI plugin package.

<!-- Until we get rid of `@redwoodjs/telemetry` or solve its or one of its dependencies circular dependency issue, we can't use packagephobia to calcuate the size. It times out. -->

<!-- ## Package size
| Version | Publish | Install |
| :-------------------------------------------------------------------------------- | :------ | :------ |
| [v6.0.0-...](https://packagephobia.com/result?p=%40redwoodjs%2Fcli-storybook) | | | -->

## Dependency graphs

### src

![src](./dependencyGraph.src.svg)

### dist

![dist](./dependencyGraph.dist.svg)
Loading

0 comments on commit 267a521

Please sign in to comment.