Skip to content

Commit 207097e

Browse files
committed
UPDATE: progress, form displays but does nothing
1 parent b585bb0 commit 207097e

File tree

31 files changed

+1288
-98
lines changed

31 files changed

+1288
-98
lines changed

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Dockerfile
2+
.dockerignore
3+
.DS_Store
4+
.git
5+
.github
6+
.gitignore
7+
LICENSE.txt
8+
*.log
9+
*.md
10+
.next
11+
node_modules
12+
13+
*.pem
14+
*.sh

.github/workflows/gcr-deploy.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
# Environment variables available to all jobs and steps in this workflow
11+
# NOTE: these aren't really secret, but there aren't non-secret settings
12+
env:
13+
RUN_PROJECT: ${{ secrets.RUN_PROJECT }}
14+
RUN_REGION: ${{ secrets.RUN_REGION }}
15+
RUN_SERVICE: ${{ secrets.RUN_SERVICE }}
16+
17+
jobs:
18+
deploy:
19+
name: Deploy to CloudRun
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v1
25+
26+
- name: gcloud auth
27+
id: 'auth'
28+
uses: 'google-github-actions/auth@v2'
29+
with:
30+
credentials_json: '${{ secrets.GCP_SA_KEY }}'
31+
32+
# Setup gcloud CLI
33+
- name: gcloud setup
34+
uses: google-github-actions/setup-gcloud@v2
35+
36+
- name: gcloud docker-auth
37+
run: gcloud auth configure-docker
38+
39+
# Build and push image to Google Container Registry
40+
- name: Build
41+
run: |
42+
docker build \
43+
--build-arg COMMIT=${GITHUB_SHA:0:7} \
44+
--build-arg LASTMOD=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
45+
--tag gcr.io/${RUN_PROJECT}/${RUN_SERVICE}:$GITHUB_SHA \
46+
.
47+
48+
- name: GCloud auth to docker
49+
run: |
50+
gcloud auth configure-docker
51+
52+
- name: Push to registry
53+
run: |
54+
docker push gcr.io/${RUN_PROJECT}/${RUN_SERVICE}:$GITHUB_SHA
55+
56+
# Deploy image to Cloud Run
57+
- name: Deploy
58+
run: |
59+
gcloud run deploy ${RUN_SERVICE} \
60+
--allow-unauthenticated \
61+
--image gcr.io/${RUN_PROJECT}/${RUN_SERVICE}:$GITHUB_SHA \
62+
--platform managed \
63+
--project ${RUN_PROJECT} \
64+
--region ${RUN_REGION}

.gitignore

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,14 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.js
7-
.yarn/install-state.gz
8-
9-
# testing
1+
/build
102
/coverage
11-
12-
# next.js
3+
.DS_Store
4+
*.env
5+
*.log*
136
/.next/
7+
next-env.d.ts
8+
/node_modules
149
/out/
15-
16-
# production
17-
/build
18-
19-
# misc
20-
.DS_Store
2110
*.pem
22-
23-
# debug
24-
npm-debug.log*
25-
yarn-debug.log*
26-
yarn-error.log*
27-
28-
# local env files
29-
.env*.local
30-
31-
# vercel
32-
.vercel
33-
34-
# typescript
11+
*.tmp
12+
tmp/
3513
*.tsbuildinfo
36-
next-env.d.ts
14+
.vercel

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Change Log
2+
3+
* 2024-09-18: Started on revamped website with Next.js/Bootstrap 5
4+
* 2024-09-03: Alpha for Rust
5+
* 2021-12-24: Bumped XRegExp to 5.0.1
6+
* 2020-12-25: Moved XRegExp from AppEngine to CloudRun, bumped to 3.2.0
7+
* 2020-06-03: Bumped Ruby to latest version
8+
* 2019-12-19: Bumped Ruby to latest version
9+
* 2019-08-12: Moved Ruby from AppEngine to CloudRun
10+
* 2019-07-26: Moved Tcl to CloudRun
11+
* 2019-07-25: Moved Perl to CloudRun
12+
* 2019-07-10: Moved XRegExp from Now to AppEngine
13+
* 2018-10-16: Moved Tcl from NearlyFreeSpeech to Zeit
14+
* 2018-10-16: Moved XRegExp from Heroku to Now
15+
* 2015-09-28: Bumped XRegExp to 3.0.0
16+
* 2013-08-19: Perl contributions from Derek Meade
17+
* 2013-07-23: Perl revamped to use CGI.pm
18+
* 2013-03-09: Timeout support for Java
19+
* 2013-01-20: Beta for Tcl
20+
* 2013-01-12: Beta for Go
21+
* 2012-05-07: Beta for JavaScript
22+
* 2012-04-24: Beta translations (initially with machine translation for French & German)
23+
* 2012-02-26: Beta for PHP
24+
* 2012-02-18: Beta for Ruby
25+
* 2012-02-11: Beta for Python
26+
* 2012-01-07: Live for .Net
27+
* 2011-12-11: New version live for Java, Beta for .Net
28+
* 2011-11-07: Updated theme to Twitter Bootstrap
29+
* 2009-04-19: Moved to RegexPlanet.com
30+
* 2006-05-20: Initial version on FileFormat.Info

CONTRIBUTING.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Contributing
2+
3+
Contributions are welcome. Please follow the [standard Github pull request flow](https://docs.github.com/en/get-started/using-github/github-flow).
4+
5+
6+
## Adding a new backend
7+
8+
If you want to add support for a new regex engine, you need to do this is a separate repo.
9+
10+
The [existing regex backends](https://github.com/regexplanet) are on Github and a good place to start. Note: I am not an expert at all of the languages, so the code can definitely be sub-optimal.
11+
12+
Once you have a working backend, you need to host it somewhere. If you have it Docker-ized, I take it from here.
13+
14+
Once it is running on the internet, you need to add a new [RegexEngine](https://github.com/regexplanet/regexplanet-next/tree/main/src/engines/RegexEngine.ts). You can use [empty.ts](https://github.com/regexplanet/regexplanet-next/blob/main/src/engines/empty.ts) as a starting point. See [metadata](#metadata) below for details about each property.
15+
16+
You can try your engine by adding a `testurl` parameter to the query string of the advanced test page. I.e. something like:
17+
https://www.regexplanet.com/advanced/perl/index.html?testurl=http://localhost:8080/test.pl
18+
19+
20+
## Backend API
21+
22+
These are the API endpoints RegexPlanet uses to communicate with each backend regex engines.
23+
Note: the endpoints must support for JSON and [JSONP](https://en.wikipedia.org/wiki/JSONP). The JSONP version takes a `callback=` in the query string.
24+
25+
26+
## `test` endpoint
27+
28+
Input:
29+
* `callback` - the name of the JSONP callback function. This is the only parameter not visible in the page source. This will not be present for browsers (*cough* MSIE *cough*) that do not support CORS. They get get proxied instead.
30+
* `regex` - the regular expression
31+
* `option` - options that are set (can be multiple, see the current list)
32+
* `replacement` - replacement string.
33+
* `input` - text to test against (can be multiple)
34+
35+
Note that multiple parameters do not have any special suffixes (i.e. [0] or whatever). Web frameworks will just have to deal.
36+
37+
Output:
38+
* `success` - boolean, true only if no errors
39+
* `html` - html to display on the page
40+
41+
## `status` endpoint
42+
43+
Input:
44+
* (none)
45+
Output:
46+
JSON map of any items of interest. Mandatory items:
47+
* `success` - boolean, true only if no errors
48+
* `version` - String, human-readable version information. Do not include `short_name`.
49+
50+
## Other Standard Pages
51+
52+
* `/` - should redirect to the testing page
53+
* `/favicon.ico`
54+
* `/favicon.svg`
55+
* `/robots.txt`
56+
* `/humans.txt` - optional, if you want to take some credit
57+
58+
## Metadata
59+
60+
Details of what you need for the [RegexEngine interface](https://github.com/regexplanet/regexplanet-next/tree/main/src/engines/RegexEngine.ts).
61+
62+
- `short_name` - Name of the language or engine
63+
- `description` - library or module name (do not include `short_name`)
64+
- `help_label` - text for the help button on the testing page
65+
- `help_url` - URL destination for the help button on the testing page
66+
- `logo_ar21` - SVG logo (including language name) in a 2:1 aspect ratio
67+
- `logo_icon` - SVG icon (just the logo, no text) in a square
68+
- `links` - A map of (name: url) for other help links. These will be displayed on the support page under “Official Documentation”
69+
- `options` - A list of which options it supports. Please use the common (long) codes so options can be shared between engines. These need to be implemented the same way in the endpoint.
70+
- `source_url` - URL of source code
71+
- `status_url` - URL of the status endpoint
72+
- `test_url` - URL of the test endpoint

Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM node:20-alpine AS base
2+
3+
# Install dependencies only when needed
4+
FROM base AS deps
5+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
6+
RUN apk add --no-cache libc6-compat
7+
WORKDIR /app
8+
9+
# Install dependencies based on the preferred package manager
10+
COPY package*.json ./
11+
RUN npm ci
12+
13+
14+
# Rebuild the source code only when needed
15+
FROM base AS builder
16+
WORKDIR /app
17+
COPY --from=deps /app/node_modules ./node_modules
18+
COPY . .
19+
20+
ENV NEXT_TELEMETRY_DISABLED=1
21+
22+
RUN npm run build
23+
24+
FROM base AS runner
25+
WORKDIR /app
26+
27+
ARG COMMIT="(not set)"
28+
ARG LASTMOD="(not set)"
29+
ENV COMMIT=$COMMIT
30+
ENV LASTMOD=$LASTMOD
31+
ENV NODE_ENV=production
32+
ENV NEXT_TELEMETRY_DISABLED=1
33+
34+
RUN addgroup --system --gid 1001 nodejs
35+
RUN adduser --system --uid 1001 nextjs
36+
37+
COPY --from=builder /app/public ./public
38+
39+
# Set the correct permission for prerender cache
40+
RUN mkdir .next
41+
RUN chown nextjs:nodejs .next
42+
43+
# Automatically leverage output traces to reduce image size
44+
# https://nextjs.org/docs/advanced-features/output-file-tracing
45+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
46+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
47+
48+
USER nextjs
49+
50+
EXPOSE 3000
51+
52+
ENV PORT=3000
53+
54+
# server.js is created by next build from the standalone output
55+
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
56+
ENV HOSTNAME="0.0.0.0"
57+
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)