Skip to content

Commit

Permalink
Setup repo structure
Browse files Browse the repository at this point in the history
  • Loading branch information
richthornton committed Dec 12, 2022
1 parent 2f23104 commit efee1bd
Show file tree
Hide file tree
Showing 26 changed files with 5,209 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
};
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js
.yarn

# testing
coverage

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
.turbo

# Cypress test outputs
**/cypress/videos/
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: "node-modules"
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
# cypress-cloud
# Cypress Cloud

This is an official Yarn (Berry) starter turborepo.

## What's inside?

This turborepo uses [Yarn](https://yarnpkg.com/) as a package manager. It includes the following packages/apps:

### Examples and Packages

- `nextjs`: an example [Next.js](https://nextjs.org/) app with Currents Cypress Cloud setup
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)

Each package/example is 100% [TypeScript](https://www.typescriptlang.org/).

### Utilities

This turborepo has some additional tools already setup for you:

- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting

### Build

To build all apps and packages, run the following command:

```
cd cypress-cloud
yarn run build
```

### Develop

To develop all apps and packages, run the following command:

```
cd cypress-cloud
yarn run dev
```
4 changes: 4 additions & 0 deletions examples/nextjs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["custom"],
};
30 changes: 30 additions & 0 deletions examples/nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Getting Started

First, run the development server:

```bash
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
20 changes: 20 additions & 0 deletions examples/nextjs/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { defineConfig } = require("cypress");
const { loadEnvConfig } = require("@next/env");

function loadEnvVariables() {
const projectDir = process.cwd();
loadEnvConfig(projectDir);
}

loadEnvVariables();
const projectId = process.env.CYPRESS_PROJECT_ID;

module.exports = defineConfig({
projectId,
e2e: {
supportFile: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
17 changes: 17 additions & 0 deletions examples/nextjs/cypress/e2e/navigation-again.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { homeUrl } from "../../homeUrl";

describe("Navigation Again", () => {
it("should navigate to the about page", () => {
// Start from the index page
cy.visit(homeUrl);

// Find a link with an href attribute containing "about" and click it
cy.get('a[href*="about"]').click();

// The new url should include "/about"
cy.url().should("include", "/about");

// The new page should contain an h1 with "About page"
cy.get("h1").contains("About Page");
});
});
17 changes: 17 additions & 0 deletions examples/nextjs/cypress/e2e/navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { homeUrl } from "../../homeUrl";

describe("Navigation", () => {
it("should navigate to the about page", () => {
// Start from the index page
cy.visit(homeUrl);

// Find a link with an href attribute containing "about" and click it
cy.get('a[href*="about"]').click();

// The new url should include "/about"
cy.url().should("include", "/about");

// The new page should contain an h1 with "About page"
cy.get("h1").contains("About Page");
});
});
1 change: 1 addition & 0 deletions examples/nextjs/homeUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const homeUrl = "http://localhost:3000";
6 changes: 6 additions & 0 deletions examples/nextjs/loadEnvVariables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { loadEnvConfig } from "@next/env";

export function loadEnvVariables() {
const projectDir = process.cwd();
loadEnvConfig(projectDir);
}
5 changes: 5 additions & 0 deletions examples/nextjs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
6 changes: 6 additions & 0 deletions examples/nextjs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
reactStrictMode: true,
experimental: {
transpilePackages: ["cypress-runner"],
},
};
29 changes: 29 additions & 0 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "web",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"cypress-runner": "*",
"next": "13.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"cypress": "^11.2.0",
"eslint": "7.32.0",
"eslint-config-custom": "*",
"start-server-and-test": "^1.14.0",
"tsconfig": "*",
"typescript": "^4.5.3"
}
}
7 changes: 7 additions & 0 deletions examples/nextjs/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function About() {
return (
<div>
<h1>About Page</h1>
</div>
);
}
9 changes: 9 additions & 0 deletions examples/nextjs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Link from "next/link";

export default function Home() {
return (
<nav>
<Link href="/about">About</Link>
</nav>
);
}
29 changes: 29 additions & 0 deletions examples/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"inlineSources": false,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@currents/cypress-cloud",
"version": "1.0.0",
"description": "",
"private": true,
"author": "",
"license": "ISC",
"workspaces": [
"examples/*",
"packages/*"
],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"eslint-config-custom": "*",
"prettier": "latest",
"turbo": "latest"
},
"engines": {
"node": ">=14.0.0"
},
"packageManager": "[email protected]"
}
3 changes: 3 additions & 0 deletions packages/cypress-runner/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function run() {

};
30 changes: 30 additions & 0 deletions packages/cypress-runner/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "cypress-runner",
"version": "0.0.0",
"main": "./index.ts",
"types": "./index.ts",
"license": "ISC",
"scripts": {
"lint": "TIMING=1 eslint \"**/*.ts*\""
},
"devDependencies": {
"@types/babel__code-frame": "^7.0.3",
"@types/getos": "^3.0.1",
"@types/randomstring": "^1.1.8",
"@types/stack-utils": "^2.0.1",
"eslint": "^7.32.0",
"eslint-config-custom": "*",
"tsconfig": "*",
"typescript": "^4.5.2"
},
"dependencies": {
"@babel/code-frame": "^7.18.6",
"@cypress/commit-info": "^2.2.0",
"axios": "^1.2.0",
"colors": "^1.4.0",
"getos": "^3.2.1",
"image-size": "^1.0.2",
"randomstring": "^1.2.3",
"stack-utils": "^2.0.6"
}
}
25 changes: 25 additions & 0 deletions packages/cypress-runner/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"composite": false,
"declarationMap": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"outDir": "dist",
"module": "commonjs",
"target": "es2016",
"declaration": true,
"emitDeclarationOnly": true,
"esModuleInterop": true,
"strictNullChecks": true,
"resolveJsonModule": true
},
"lib": ["es2016"],
"exclude": ["node_modules", "./src/__tests__/*.ts"]
}
7 changes: 7 additions & 0 deletions packages/eslint-config-custom/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ["next", "turbo", "prettier"],
rules: {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
},
};
Loading

0 comments on commit efee1bd

Please sign in to comment.