Skip to content

Commit bc5c4f2

Browse files
authored
test: add test helper and generator
2 parents 84454e1 + 6033413 commit bc5c4f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+12436
-3700
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/*"],
4+
"plugins": ["@nx"],
5+
"overrides": [
6+
{
7+
"files": "*.json",
8+
"parser": "jsonc-eslint-parser",
9+
"rules": {}
10+
},
11+
{
12+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
13+
"rules": {
14+
"@nx/enforce-module-boundaries": [
15+
"error",
16+
{
17+
"enforceBuildableLibDependency": true,
18+
"allow": [],
19+
"depConstraints": [
20+
{
21+
"sourceTag": "*",
22+
"onlyDependOnLibsWithTags": ["*"]
23+
}
24+
]
25+
}
26+
]
27+
}
28+
},
29+
{
30+
"files": ["*.ts", "*.tsx"],
31+
"extends": ["plugin:@nx/typescript"],
32+
"rules": {}
33+
},
34+
{
35+
"files": ["*.js", "*.jsx"],
36+
"extends": ["plugin:@nx/javascript"],
37+
"rules": {}
38+
}
39+
]
40+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
dist
55
tmp
66
/out-tsc
7+
.code-pushup
78

89
# dependencies
910
node_modules

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Add files here to ignore them from prettier formatting
2+
/dist
3+
/coverage
4+
/.nx/cache
5+
/.nx/workspace-data

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.vscode/extensions.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
3-
4-
"nrwl.angular-console"
3+
"nrwl.angular-console",
4+
"esbenp.prettier-vscode",
5+
"firsttris.vscode-jest-runner"
56
]
67
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.validate": ["json"]
3+
}

CONTRIBUTING.MD

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,27 @@
1010

1111
#### Setup
1212

13+
**Add a library**
1314
To create a new library in the monorepo, run the following command:
1415

1516
```bash
1617

17-
npx nx g @nx/js:lib [package-name] --tags=scope:plugin --projectNameAndRootFormat=derived --unitTestRunner=vitest --bundler=esbuild
18+
npx nx g @nx/js:lib [package-name] --directory=packages/[package-name] --projectNameAndRootFormat=as-provided --bundler=esbuild --unitTestRunner=vitest --module=esm --tags=scope:plugin
1819

1920
```
21+
22+
**Add an e2e test project**
23+
24+
To create a new e2e test project in the monorepo, run the following command:
25+
26+
```bash
27+
npx nx g @nx/js:lib e2e-[package-name] --directory=e2e/[package-name] --projectNameAndRootFormat=as-provided --bundler=none --unitTestRunner=vitest --tags=type:e2e
28+
```
29+
30+
31+
32+
Notes:
33+
- The project bundle-size is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.
34+
For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/nx-api/eslint-plugin/documents/dependency-checks).
35+
36+
// generate testing helper lib testing/utils with name testing-utils

README.md

Lines changed: 3 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,5 @@
1-
# CodePushupCommunityPlugins
1+
# CodePushup Plugin Examples
22

3-
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
3+
<a alt="code-pushup logo" href="https://code-pushup.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/code-pushup/cli/master/packages/cli/docs/images/logo.png" width="45"></a>
44

5-
**This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)**
6-
7-
## Integrate with editors
8-
9-
Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console
10-
provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and
11-
comes with a LSP for Vim users.
12-
13-
## Nx plugins and code generators
14-
15-
Add Nx plugins to leverage their code generators and automated, inferred tasks.
16-
17-
```
18-
# Add plugin
19-
npx nx add @nx/react
20-
21-
# Use code generator
22-
npx nx generate @nx/react:app demo
23-
24-
# Run development server
25-
npx nx serve demo
26-
27-
# View project details
28-
npx nx show project demo --web
29-
```
30-
31-
Run `npx nx list` to get a list of available plugins and whether they have generators. Then run `npx nx list <plugin-name>` to see what generators are available.
32-
33-
Learn more about [code generators](https://nx.dev/features/generate-code) and [inferred tasks](https://nx.dev/concepts/inferred-tasks) in the docs.
34-
35-
## Running tasks
36-
37-
To execute tasks with Nx use the following syntax:
38-
39-
```
40-
npx nx <target> <project> <...options>
41-
```
42-
43-
You can also run multiple targets:
44-
45-
```
46-
npx nx run-many -t <target1> <target2>
47-
```
48-
49-
..or add `-p` to filter specific projects
50-
51-
```
52-
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
53-
```
54-
55-
Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks).
56-
57-
## Set up CI!
58-
59-
Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.
60-
61-
- [Set up remote caching](https://nx.dev/features/share-your-cache)
62-
- [Set up task distribution across multiple machines](https://nx.dev/nx-cloud/features/distribute-task-execution)
63-
- [Learn more how to setup CI](https://nx.dev/recipes/ci)
64-
65-
## Explore the project graph
66-
67-
Run `npx nx graph` to show the graph of the workspace.
68-
It will show tasks that you can run with Nx.
69-
70-
- [Learn more about Exploring the Project Graph](https://nx.dev/core-features/explore-graph)
71-
72-
## Connect with us!
73-
74-
- [Join the community](https://nx.dev/community)
75-
- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools)
76-
- [Follow us on Twitter](https://twitter.com/nxdevtools)
5+
**This is the repository for all our plugin examples.**

global-setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export async function setup() {
2+
process.env.TZ = 'UTC';
3+
}

0 commit comments

Comments
 (0)