Skip to content

Commit

Permalink
build: add pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Aug 10, 2022
1 parent 8c3b505 commit ee338f6
Show file tree
Hide file tree
Showing 183 changed files with 19,441 additions and 18,363 deletions.
9 changes: 8 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ node_modules
npm-debug.log
README.md
.next
.git
.git
.github
.turbo

landing-page
docs
scripts
wordpress
7 changes: 4 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ jobs:
- name: Log Info
run: echo ${{ github.event.deployment_status.target_url }} && echo ${{ github.event.deployment }} && echo ${{ github.event.deployment_status.environment }}
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.2
- name: Install dependencies
run: yarn
run: pnpm i --frozen-lockfile
- name: Build dependencies
run: yarn turbo run build --scope=builder --include-dependencies
run: pnpm turbo run build --filter="builder^..."
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run tests
working-directory: ./apps/builder
run: yarn test
run: pnpm test
env:
PLAYWRIGHT_BUILDER_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/publish-lib-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ jobs:
working-directory: ./packages/typebot-js
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: yarn
- run: yarn test
- run: yarn build
- uses: pnpm/action-setup@v2.2.2
- run: pnpm i --frozen-lockfile
- run: pnpm test
- run: pnpm build
- uses: JS-DevTools/npm-publish@v1
with:
package: './packages/typebot-js/package.json'
Expand Down
37 changes: 25 additions & 12 deletions .github/workflows/publish_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
branches: [main]

jobs:
push_images_to_docker_hub:
name: Push images to Docker Hub
push_builder:
name: Builder
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand All @@ -27,6 +27,29 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push builder image
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.builder-meta.outputs.tags }}
labels: ${{ steps.builder-meta.outputs.labels }}
build-args: |
SCOPE=builder
push_viewer:
name: Viewer
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Extract Viewer meta
id: viewer-meta
uses: docker/metadata-action@v4
Expand All @@ -45,16 +68,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push builder image
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.builder-meta.outputs.tags }}
labels: ${{ steps.builder-meta.outputs.labels }}
build-args: |
SCOPE=builder
- name: Build and push viewer image
uses: docker/build-push-action@v3
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_modules
workspace.code-workspace
.DS_Store
.turbo
yarn-error.log
authenticatedState.json
playwright-report
dist
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public-hoist-pattern[]=*prisma*
46 changes: 16 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,37 @@
# https://github.com/vercel/turborepo/issues/215#issuecomment-1027058056
FROM node:16-slim AS base
FROM node:18-slim AS base
WORKDIR /app
ARG SCOPE
ENV SCOPE=${SCOPE}

FROM base AS pruner
RUN yarn global add turbo@1.2.9
COPY . .
RUN turbo prune --scope="${SCOPE}" --docker

FROM base AS installer
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/yarn.lock ./yarn.lock
RUN yarn install --frozen-lockfile
RUN npm --global install pnpm

FROM base AS builder
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY --from=installer /app/ .
COPY --from=pruner /app/out/full/ .
COPY ./apps/${SCOPE}/.env.docker ./apps/${SCOPE}/.env.production
COPY ./apps/${SCOPE}/.env.docker ./apps/${SCOPE}/.env.local
RUN apt-get -qy update && apt-get -qy --no-install-recommends install openssl
RUN yarn turbo run build --scope="${SCOPE}" --include-dependencies --no-deps
RUN find . -name node_modules | xargs rm -rf
RUN apt-get -qy update && apt-get -qy --no-install-recommends install openssl git
COPY pnpm-lock.yaml .npmrc pnpm-workspace.yaml ./
RUN pnpm fetch
ADD . ./
RUN pnpm install -r --offline
RUN pnpm turbo run build --filter=${SCOPE}...

FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
COPY ./packages/db/prisma ./prisma
COPY --from=installer /app/node_modules ./node_modules
COPY --from=builder /app/apps/${SCOPE}/next.config.js ./
COPY --from=builder /app/apps/${SCOPE}/public ./public
COPY --from=builder /app/apps/${SCOPE}/package.json ./package.json
COPY --from=builder /app/apps/${SCOPE}/.next/standalone ./
COPY --from=builder /app/apps/${SCOPE}/.next/static ./.next/static
COPY --from=builder /app/apps/${SCOPE}/.env.docker ./.env.production
RUN apt-get -qy update \
&& apt-get -qy --no-install-recommends install \
openssl \
&& apt-get autoremove -yq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY ./packages/db/prisma ./prisma
COPY ./apps/${SCOPE}/.env.docker ./apps/${SCOPE}/.env.production
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/${SCOPE}/public ./apps/${SCOPE}/public
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/.next/standalone ./
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/.next/static ./apps/${SCOPE}/.next/static

COPY env.sh ${SCOPE}-entrypoint.sh ./
RUN chmod +x ./"${SCOPE}"-entrypoint.sh \
RUN chmod +x ./${SCOPE}-entrypoint.sh \
&& chmod +x ./env.sh
ENTRYPOINT ./"${SCOPE}"-entrypoint.sh
ENTRYPOINT ./${SCOPE}-entrypoint.sh

EXPOSE 3000
ENV PORT 3000
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Interested in self-hosting Typebot on your server? Take a look at the [self-host

```sh
cd typebot.io
yarn
pnpm i
```

3. Set up environment variables
Expand All @@ -69,7 +69,7 @@ Interested in self-hosting Typebot on your server? Take a look at the [self-host
5. Start the builder and viewer

```sh
yarn dev
pnpm dev
```

Builder is available at `http://localhost:3000`
Expand All @@ -86,14 +86,14 @@ Interested in self-hosting Typebot on your server? Take a look at the [self-host

```sh
cd apps/landing-page
yarn dev
pnpm dev
```

7. (Optionnal) Start the docs

```sh
cd apps/docs
yarn start
pnpm start
```

## Contribute
Expand Down
1 change: 1 addition & 0 deletions apps/builder/.env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ NEXT_PUBLIC_GIPHY_API_KEY=
NEXT_PUBLIC_STRIPE_PUBLIC_KEY=
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_VIEWER_INTERNAL_URL=
NEXT_PUBLIC_E2E_TEST=
10 changes: 8 additions & 2 deletions apps/builder/components/auth/DividerWithText.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { FlexProps, Flex, Box, Divider, Text } from '@chakra-ui/react'
import { useColorModeValue } from '@chakra-ui/system'
import {
FlexProps,
Flex,
Box,
Divider,
Text,
useColorModeValue,
} from '@chakra-ui/react'
import React from 'react'

export const DividerWithText = (props: FlexProps) => {
Expand Down
3 changes: 2 additions & 1 deletion apps/builder/components/dashboard/OnboardingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useUser } from 'contexts/UserContext'
import { Answer, Typebot } from 'models'
import React, { useEffect, useRef, useState } from 'react'
import { parseTypebotToPublicTypebot } from 'services/publicTypebot'
import { sendRequest } from 'utils'
import { getViewerUrl, sendRequest } from 'utils'
import confetti from 'canvas-confetti'
import { useToast } from 'components/shared/hooks/useToast'

Expand Down Expand Up @@ -119,6 +119,7 @@ export const OnboardingModal = ({ totalTypebots }: Props) => {
<ModalBody>
{typebot && (
<TypebotViewer
apiHost={getViewerUrl({ isBuilder: true })}
typebot={parseTypebotToPublicTypebot(typebot)}
predefinedVariables={{
Name: user?.name?.split(' ')[0] ?? undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flex, HStack, StackProps } from '@chakra-ui/layout'
import { CloseButton } from '@chakra-ui/react'
import { CloseButton, Flex, HStack, StackProps } from '@chakra-ui/react'
import React, { useEffect, useState } from 'react'

type VerifyEmailBannerProps = { id: string } & StackProps
Expand Down
2 changes: 2 additions & 0 deletions apps/builder/components/editor/preview/PreviewDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
import { Log } from 'db'
import React, { useMemo, useState } from 'react'
import { parseTypebotToPublicTypebot } from 'services/publicTypebot'
import { getViewerUrl } from 'utils'

export const PreviewDrawer = () => {
const { typebot } = useTypebot()
Expand Down Expand Up @@ -100,6 +101,7 @@ export const PreviewDrawer = () => {
pointerEvents={isResizing ? 'none' : 'auto'}
>
<TypebotViewer
apiHost={getViewerUrl({ isBuilder: true })}
typebot={publicTypebot}
onNewGroupVisible={setPreviewingEdge}
onNewLog={handleNewLog}
Expand Down
7 changes: 4 additions & 3 deletions apps/builder/components/results/ResultsTable/Cell.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { chakra, Fade, Button } from '@chakra-ui/react'
import { Cell as CellProps } from '@tanstack/react-table'
import { Cell as CellProps, flexRender } from '@tanstack/react-table'
import { ExpandIcon } from 'assets/icons'
import { memo } from 'react'
import { TableData } from 'services/typebots/results'

type Props = {
cell: CellProps<any>
cell: CellProps<TableData, unknown>
size: number
isExpandButtonVisible: boolean
cellIndex: number
Expand Down Expand Up @@ -34,7 +35,7 @@ const Cell = ({
maxWidth: size,
}}
>
{cell.renderCell()}
{flexRender(cell.column.columnDef.cell, cell.getContext())}
<chakra.span
pos="absolute"
top="0"
Expand Down
10 changes: 6 additions & 4 deletions apps/builder/components/results/ResultsTable/HeaderRow.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Box, BoxProps, chakra } from '@chakra-ui/react'
import { HeaderGroup } from '@tanstack/react-table'
import { flexRender, HeaderGroup } from '@tanstack/react-table'
import React from 'react'
import { TableData } from 'services/typebots/results'

type Props = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
headerGroup: HeaderGroup<any>
headerGroup: HeaderGroup<TableData>
}

export const HeaderRow = ({ headerGroup }: Props) => {
Expand All @@ -28,7 +28,9 @@ export const HeaderRow = ({ headerGroup }: Props) => {
maxWidth: header.getSize(),
}}
>
{header.isPlaceholder ? null : header.renderHeader()}
{header.isPlaceholder
? null
: flexRender(header.column.columnDef.header, header.getContext())}
{header.column.getCanResize() && (
<ResizeHandle
onMouseDown={header.getResizeHandler()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
convertResultsToTableData,
getAllResults,
deleteResults as deleteFetchResults,
} from 'services/typebots'
} from 'services/typebots/results'

type ResultsActionButtonsProps = {
selectedResultsId: string[]
Expand Down Expand Up @@ -93,7 +93,9 @@ export const ResultsActionButtons = ({

const dataToUnparse = isSelectAll
? await getAllTableData()
: tableData.filter((data) => selectedResultsId.includes(data.id))
: tableData.filter((data) =>
selectedResultsId.includes(data.id.plainText)
)
const csvData = new Blob(
[
unparse({
Expand Down
Loading

5 comments on commit ee338f6

@vercel
Copy link

@vercel vercel bot commented on ee338f6 Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ee338f6 Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs.typebot.io
docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ee338f6 Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2-alpha – ./apps/viewer

8jours.top
vhpage.cr8.ai
finplex.be
bt.id8rs.com
yobot.me
247987.com
bot.aws.bj
am.nigerias.io
bot.aipr.kr
sat.cr8.ai
an.nigerias.io
ar.nigerias.io
bot.lalmon.com
ticketfute.com
bot.artiweb.app
apr.nigerias.io
apo.nigerias.io
aso.nigerias.io
eventhub.com.au
chat.sureb4.com
sakuranembro.it
games.klujo.com
bot.piccinato.co
typebot.aloe.do
bot.upfunnel.art
faqs.nigerias.io
stan.vselise.com
feedback.ofx.one
kw.wpwakanda.com
clo.closeer.work
voicehelp.cr8.ai
typebot.aloe.bot
bot.agfunnel.tech
gentleman-shop.fr
bot.phuonghub.com
cares.urlabout.me
app.chatforms.net
bot.maitempah.com
fmm.wpwakanda.com
k1.kandabrand.com
lb.ticketfute.com
ov1.wpwakanda.com
andreimayer.com.br
ov2.wpwakanda.com
ov3.wpwakanda.com
dicanatural.online
bot.neferlopez.com
1988.bouclidom.com
goalsettingbot.com
zap.techadviser.in
this-is-a-test.com
bot.digitalbled.com
carsalesenquiry.com
bot.eventhub.com.au
forms.webisharp.com
bot.cotemeuplano.com
chat.hayurihijab.com
bot.ansuraniphone.my
order.maitempah.com
bium.gratirabbit.com
typebot.stillio.com
quest.wpwakanda.com
click.sevenoways.com
connect.growthguy.in
get.freebotoffer.xyz
abutton.wpwakanda.com
chat.missarkansas.org
aidigitalmarketing.kr
bot.meuesocial.com.br
bot.incusservices.com
cdd.searchcube.com.sg
bbutton.wpwakanda.com
sbutton.wpwakanda.com
bbutton.wpwwakanda.com
apply.ansuraniphone.my
c23111azqw.nigerias.io
form.searchcube.com.sg
felipewelington.com.br
kodawariab736.skeep.it
gcase.barrettamario.it
report.gratirabbit.com
info.clickasuransi.com
view.onlinebotdemo.xyz
resume.gratirabbit.com
83242573.actualizar.xyz
bot.blackboxtips.com.br
mainmenu.diddancing.com
bot.upgradesolutions.eu
91181264.your-access.one
subfooter.wpwakanda.com
signup.hypemarketing.in
survey.hypemarketing.in
hunterbot.saleshunter.ai
type.opaulovieira.com.br
form.sergiolimajr.com.br
aibot.angrybranding.co.uk
bot.aidigitalmarketing.kr
bot.blackboxsports.com.br
boyfriend-breakup.riku.ai
chat.ertcrebateportal.com

@vercel
Copy link

@vercel vercel bot commented on ee338f6 Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ee338f6 Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.