Skip to content

Commit

Permalink
Next.js and other config
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Jan 9, 2024
1 parent 1927178 commit 055777d
Show file tree
Hide file tree
Showing 317 changed files with 1,063 additions and 30,719 deletions.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

75 changes: 0 additions & 75 deletions .eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "prettier"]
}
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: yarn install
# - run: yarn test:jest
- run: yarn build
24 changes: 17 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,33 @@
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build
/dist

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
*.pem

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

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
10 changes: 10 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require("path");

const buildEslintCommand = (filenames) =>
`next lint --fix --file ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(" --file ")}`;

module.exports = {
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
};
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.prettierignore
public/
.gitignore
.husky/
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"arrowParens:": "always",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 80,
"proseWrap": "always",
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
6 changes: 0 additions & 6 deletions CONTRIBUTING.md

This file was deleted.

12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
FROM ubuntu:22.04 as build

MAINTAINER SDF Ops Team <[email protected]>
LABEL maintainer="SDF Ops Team <[email protected]>"

RUN mkdir -p /app
WORKDIR /app

ENV DEBIAN_FRONTEND=noninteractive
# https://create-react-app.dev/docs/advanced-configuration/
ENV INLINE_RUNTIME_CHUNK=false
RUN apt-get update && apt-get install --no-install-recommends -y gpg curl git make ca-certificates apt-transport-https && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key|gpg --dearmor >/etc/apt/trusted.gpg.d/nodesource-key.gpg && \
echo "deb https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |gpg --dearmor >/etc/apt/trusted.gpg.d/yarnpkg.gpg && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn && apt-get clean


COPY . /app/
RUN yarn git-info
RUN yarn install

RUN yarn build

FROM nginx:1.17

COPY --from=build /app/build/ /usr/share/nginx/html/

# We're removing /laboratory/ prefix. To allow for transition
# period we'll support /laboratory/ links using rewrites
COPY nginx_default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Check if we need to prepend docker commands with sudo
SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo")

# If LABEL is not provided set default value
LABEL ?= $(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n))
# If TAG is not provided set default value
TAG ?= stellar/laboratory:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n))
TAG ?= stellar/laboratory:$(LABEL)
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
BUILD_DATE := $(shell date -u +%FT%TZ)

Expand Down
61 changes: 22 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,36 @@
# laboratory
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

The Stellar Laboratory is a suite of tools to help one learn about exploring the
Stellar network. See it in action:
[https://laboratory.stellar.org/](https://laboratory.stellar.org/).
## Getting Started

## Developing

```sh
yarn start
```

Testing hardware wallets requires an HTTPS connection to enable U2F. The
recommended way to do this is with [`ngrok`](https://ngrok.com/). Once
downloaded and authenticated, start ngrok, and tell the laboratory to start with
a public URL.
First, run the development server:

```bash
./ngrok http 3000
# in a separate terminal
# the subdomain will appear in ngrok's output
yarn start --public randomsubdomain.ngrok.io
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

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

```sh
yarn build
```
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

To build a production docker image using a clean docker build environment:
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

```sh
make docker-build
# or directly with docker
docker build -t lab:localbuild .
```
## Learn More

To build and run production build locally:
To learn more about Next.js, take a look at the following resources:

```sh
yarn production
# or
yarn prod:build
yarn prod:serve
```
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - 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!

Production uses Amplitude to emit metrics, so to fully emulate a production build, you'll need to set an `AMPLITUDE_API_KEY` variable in `/public/settings/env-config.js` file.
## Deploy on Vercel

## Internal documentation
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

The [docs.md](./docs.md) file contains code documentation on the laboratory. The
docs.md is only relevant for developing the laboratory.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
22 changes: 0 additions & 22 deletions babel.config.js

This file was deleted.

40 changes: 0 additions & 40 deletions docs.md

This file was deleted.

6 changes: 0 additions & 6 deletions jest.config.js

This file was deleted.

4 changes: 4 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig
Loading

0 comments on commit 055777d

Please sign in to comment.