# Basic case

{% code title="init-wrangler.sh" lineNumbers="true" %}

```bash
#!/bin/bash

sed -i "s/ACCOUNT_ID/$(printenv CLOUDFLARE_ACCOUNT_ID)/" wrangler.toml
sed -i "s/ZONE_ID_STAGE/$(printenv CLOUDFLARE_ZONE_ID_STAGE)/" wrangler.toml

export CLOUDFLARE_API_KEY=$(printenv CLOUDFLARE_API_TOKEN)
export CLOUDFLARE_EMAIL=$(printenv CLOUDFLARE_EMAIL)
```

{% endcode %}

{% code title="install.sh" lineNumbers="true" %}

```bash
#!/bin/bash

yarn install --frozen-lockfile
```

{% endcode %}

{% code title="build.sh" lineNumbers="true" %}

```bash
#!/bin/bash

cp .env.stage .env
yarn build
```

{% endcode %}

{% code title="push.sh" lineNumbers="true" %}

```bash
#!/bin/bash

wrangler deploy --env=stage
```

{% endcode %}

{% code title="deploy.yaml" lineNumbers="true" %}

```yaml
version: '1.0'
from: 'romainlavabrefairfair/deploy-react'

steps:
    -   name: '@init-wrangler'
        script: '/init-wrangler.sh'

    -   name: '@install'
        script: '/install.sh'
        
    -   name: '@build'
        script: '/build.sh'
        
    -   name: '@push'
        script: '/push.sh'
```

{% endcode %}

This in about 50 repositories, then one fine day, we had enough of the slowness of yarn, and we cried, because we had to change 50 repositories. (Yes im stupid)

So, please, store your global script in your docker image (in /app)

And in your repository, you just have

{% code title="deploy.yaml" lineNumbers="true" %}

```yaml
version: '1.0'
from: 'romainlavabrefairfair/deploy-react'

steps:
    -   name: '@init-wrangler'
        script: /init-wrangler.sh STAGE

    -   name: '@install'
        script: /install.sh

    -   name: '@build'
        script: /build.sh stage

    -   name: '@push'
        script: /push.sh stage
```

{% endcode %}

And if you want to switch from yarn to npm, you just have to change your base image
