-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from redwoodjs/main
update to 0.31.0
- Loading branch information
Showing
324 changed files
with
28,882 additions
and
6,334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
name: Lint, build and run tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
name: Cypress E2E tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Publish release candidate | ||
|
||
on: | ||
push: | ||
branches: ['release/**'] | ||
tags-ignore: | ||
- v** # We don't want this to run on release | ||
|
||
jobs: | ||
build: | ||
if: github.repository == 'redwoodjs/redwood' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # Required because lerna uses tags to determine the version. | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile --check-files | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Run ESLint | ||
run: yarn lint | ||
env: | ||
CI: true | ||
|
||
- name: Run tests | ||
run: yarn test | ||
env: | ||
CI: true | ||
|
||
- name: Publish | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc | ||
./tasks/publish-rc | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when | |
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Tom Preston-Werner [[email protected]](mailto:[email protected]), Peter Pistorius [[email protected]]([email protected]), and/or Rob Cameron [[email protected]]([email protected]). All complaints will be reviewed and investigated promptly and fairly. | ||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Tom Preston-Werner [[email protected]](mailto:[email protected]), Peter Pistorius [[email protected]]([email protected]), Rob Cameron [[email protected]](cannikin@fastmail.com), and/or [David Price](thedavid@thedavidprice.com). All complaints will be reviewed and investigated promptly and fairly. | ||
|
||
All community leaders are obligated to respect the privacy and security of the reporter of any incident. | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "0.27.1", | ||
"version": "0.31.0", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"command": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import express from 'express' | ||
import type { Response, Request, Application } from 'express' | ||
import morgan from 'morgan' | ||
|
||
// Base express app, with common config | ||
const createApp = (): Application => { | ||
const app = express() | ||
|
||
// Add common middleware | ||
app.use(morgan<Request, Response>('dev')) | ||
|
||
return app | ||
} | ||
|
||
export default createApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { getConfig } from '@redwoodjs/internal' | ||
|
||
import createApp from './app' | ||
import withApiProxy from './middleware/withApiProxy' | ||
import withFunctions from './middleware/withFunctions' | ||
import withWebServer from './middleware/withWebServer' | ||
import { startServer } from './server' | ||
import type { HttpServerParams } from './server' | ||
|
||
/* | ||
* This file has defines CLI handlers used by the redwood cli, for `rw serve` | ||
* Also used in index.ts for the api server | ||
*/ | ||
|
||
export const commonOptions = { | ||
port: { default: 8910, type: 'number', alias: 'p' }, | ||
socket: { type: 'string' }, | ||
} as const | ||
|
||
export const apiCliOptions = { | ||
port: { default: 8911, type: 'number', alias: 'p' }, | ||
socket: { type: 'string' }, | ||
apiRootPath: { | ||
alias: ['rootPath', 'root-path'], | ||
default: '/', | ||
type: 'string', | ||
desc: 'Root path where your api functions are served', | ||
coerce: coerceRootPath, | ||
}, | ||
} as const | ||
|
||
export const webCliOptions = { | ||
port: { default: 8910, type: 'number', alias: 'p' }, | ||
socket: { type: 'string' }, | ||
apiHost: { | ||
alias: 'api-host', | ||
type: 'string', | ||
desc: | ||
'Forward requests from the apiProxyPath, defined in redwood.toml to this host', | ||
}, | ||
} as const | ||
|
||
interface ApiServerArgs extends Omit<HttpServerParams, 'app'> { | ||
apiRootPath: string // either user supplied or '/' | ||
} | ||
|
||
export const apiServerHandler = ({ | ||
port, | ||
socket, | ||
apiRootPath, | ||
}: ApiServerArgs) => { | ||
let app = createApp() | ||
|
||
// Attach middleware | ||
app = withFunctions(app, apiRootPath) | ||
|
||
startServer({ | ||
port, | ||
socket, | ||
app, | ||
}).on('listening', () => { | ||
if (socket) { | ||
console.log(`Listening on ${socket}`) | ||
} | ||
console.log(`Listening on http://localhost:${port}${apiRootPath}`) | ||
}) | ||
} | ||
|
||
export const bothServerHandler = ({ | ||
port, | ||
socket, | ||
}: Omit<HttpServerParams, 'app'>) => { | ||
const apiRootPath = coerceRootPath(getConfig().web.apiProxyPath) | ||
let app = createApp() | ||
|
||
// Attach middleware | ||
app = withFunctions(app, apiRootPath) | ||
app = withWebServer(app) | ||
|
||
startServer({ | ||
port, | ||
socket, | ||
app, | ||
}).on('listening', () => { | ||
if (socket) { | ||
console.log(`Listening on ${socket}`) | ||
} | ||
|
||
console.log(`Web server started on http://localhost:${port} `) | ||
console.log(`APIs Listening on http://localhost:${port}${apiRootPath}`) | ||
}) | ||
} | ||
|
||
interface WebServerArgs extends Omit<HttpServerParams, 'app'> { | ||
apiHost?: string | ||
} | ||
|
||
export const webServerHandler = ({ port, socket, apiHost }: WebServerArgs) => { | ||
let app = createApp() | ||
|
||
// Attach middleware | ||
// We need to proxy api requests to prevent CORS issues | ||
if (apiHost) { | ||
const apiProxyPath = getConfig().web.apiProxyPath | ||
app = withApiProxy(app, { apiHost, apiProxyPath }) | ||
} | ||
|
||
app = withWebServer(app) | ||
|
||
startServer({ | ||
port, | ||
socket, | ||
app, | ||
}).on('listening', () => { | ||
if (socket) { | ||
console.log(`Listening on ${socket}`) | ||
} | ||
|
||
console.log(`Web server started on http://localhost:${port} `) | ||
}) | ||
} | ||
|
||
function coerceRootPath(path: string) { | ||
// Make sure that we create a root path that starts and ends with a slash (/) | ||
const prefix = path.charAt(0) !== '/' ? '/' : '' | ||
const suffix = path.charAt(path.length - 1) !== '/' ? '/' : '' | ||
|
||
return `${prefix}${path}${suffix}` | ||
} |
Oops, something went wrong.