Skip to content

Instantly share code, notes, and snippets.

View hypeJunction's full-sized avatar

Ismayil Khayredinov hypeJunction

View GitHub Profile
@hypeJunction
hypeJunction / Dockerfile
Last active June 15, 2022 10:18
Dockerfile for monorepo
FROM node:16-alpine as server-builder
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/app/.yarn/cache \
npx turbo prune --scope=@me/application-a && \
cp -R .yarn .yarnrc.yml tsconfig.json out/ && \
cd out && \
yarn install && \
@hypeJunction
hypeJunction / package.json
Created June 15, 2022 07:01
root package.json
{
"name": "@me/monorepo",
"private": true,
"workspaces": [
"packages/**/*",
"applications/**/*"
],
"scripts": {
"build": "turbo run build",
"dev": "concurrently \"yarn dev:init\" \"yarn watch\"",
@hypeJunction
hypeJunction / turbo.json
Created June 15, 2022 06:48
Turborepo config example
{
"$schema": "https://turborepo.org/schema.json",
"baseBranch": "origin/master",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"inputs": ["src/**/*", "package.json", "tsconfig.json"],
"outputs": ["dist/**"]
},
"test": {
@hypeJunction
hypeJunction / package.json
Created June 15, 2022 06:39
Sameple next.js package.json
{
"name": "@me/application-a",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "cypress run"
},
"dependencies": {
"@me/package-a": "workspace:^"
@hypeJunction
hypeJunction / package.json
Last active June 15, 2022 10:34
Same react app package.json
{
"name": "@me/package-a",
"scripts": {
"build": "concurrently \"yarn build:ts\" \"yarn build:css\" \"yarn build:assets\"",
"build:ts": "tsc --pretty",
"build:css": "postcss ./src/**/*.css --base ./src -d ./dist",
"build:assets": "mkdir -p ./dist/assets && cp -r ./src/assets ./dist",
"watch": "concurrently \"yarn watch:ts\" \"yarn watch:css\" \"yarn watch:assets\"",
"watch:ts": "chokidar \"src/**/*.ts\" \"src/**/*.tsx\" -c \"yarn build:ts\"",
"watch:css": "chokidar \"src/**/*.css\" -c \"yarn build:css\"",
import Chainable = Cypress.Chainable;
const getDialog = (name: string | RegExp) => {
return cy.findByRole('dialog', { name });
};
const getForm = (subject: Chainable, name: string | RegExp) => {
const chain = subject ? cy.wrap(subject) : cy;
return chain.findByRole('form', {
Cypress.Commands.add('press', { prevSubject: 'element' }, (subject: JQuery) => {
cy.wrap(subject)
.focus();
cy.focused()
.type('{enter}');
return cy.wrap(subject);
});
cy.getButton('Favorite animal')
.press()
.popup()
.its('visible')
.should('be', true);
cy.getListBox('Favorite animal')
.select('Elephant');
cy.getInput('Favorite animal')
<label>
<span id="select-label">Favorite animal</span>
<input type="hidden" name="animal" />
</label>
<button
aria-labelledby="select-label select-placeholder"
aria-controls="select-dropdown"
aria-haspopup="list"
aria-expanded="false"
>
cy.getInput('Add File').attach('bear.jpg');
// Wait for file to finish uploading
cy.getList('File List')
.getListItem('bear.jpg')
.progress()
.its('value')
.should('eq', '100');
// Remove uploaded file