Skip to content

Commit

Permalink
Merge pull request #1 from redwoodjs/main
Browse files Browse the repository at this point in the history
Brining up to speed
  • Loading branch information
jeliasson authored Oct 8, 2020
2 parents 4c1d951 + 4784588 commit 6d23f98
Show file tree
Hide file tree
Showing 63 changed files with 1,094 additions and 669 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-eslint-jest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
fail-fast: true
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} | Node ${{ matrix.node-version }} latest
if: github.event.pull_request.merged == false
steps:
- uses: actions/checkout@v2

Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Before interacting with the Redwood community, please read and understand our [C

- [Contributing](#contributing)
- [Local Development](#local-development)
- [Install Dependencies](#install-dependencies)
- [Copy and Watch](#copy-and-watch)
- [Specifying a RW_PATH](#specifying-a-rw_path)
- [Local Package Registry Emulation](#local-package-registry-emulation)
Expand Down Expand Up @@ -40,6 +41,14 @@ We offer two workflows for making this possible: "copy and watch", which has som

> Both workflows use `redwood-tools` (alias `rwt`), Redwood's companion CLI development tool.
### Install Dependencies
Before running the application for the first time you should run `yarn` in the root directory to install the necessary dependencies.

```terminal
cd redwood
yarn
```

### Copy and Watch

> Are you on Windows? If so, you most likely first have to [install rsync](https://tlundberg.com/blog/2020-06-15/installing-rsync-on-windows/). Also, unfortunately you can't use "copy and watch". You'll have to manually run `yarn rwt cp ../path/to/redwood` when you've made changes to the Redwood Framework (this is tracked in [issue #701](https://github.com/redwoodjs/redwood/issues/701)).
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use:
- [Prisma](https://www.prisma.io/)
- [Jest](https://jestjs.io/) (coming soon)
- [Storybook](https://storybook.js.org/) (coming soon)
- [Babel](https://babeljs.io/)
- [Babel](https://babeljs.io/)
- [Webpack](https://webpack.js.org/)

## Features
Expand Down Expand Up @@ -392,6 +392,19 @@ And there you have it.
<tr>
<td align="center"><a href="https://github.com/CR1AT0RS"><img src="https://avatars1.githubusercontent.com/u/4299288?v=4" width="100px;" alt=""/><br /><sub><b>cr1at0rs</b></sub></a></td>
<td align="center"><a href="https://github.com/qooqu"><img src="https://avatars0.githubusercontent.com/u/23623824?v=4" width="100px;" alt=""/><br /><sub><b>qooqu</b></sub></a></td>
<td align="center"><a href="https://www.youtube.com/c/awesomedevnotes"><img src="https://avatars2.githubusercontent.com/u/66256957?v=4" width="100px;" alt=""/><br /><sub><b>Android Dev Notes</b></sub></a></td>
<td align="center"><a href="http://jeremykratz.com/"><img src="https://avatars3.githubusercontent.com/u/1337020?v=4" width="100px;" alt=""/><br /><sub><b>Jeremy Kratz</b></sub></a></td>
<td align="center"><a href="http://kriscoulson.com/"><img src="https://avatars3.githubusercontent.com/u/6943688?v=4" width="100px;" alt=""/><br /><sub><b>Kris Coulson</b></sub></a></td>
</tr>
<tr>
<td align="center"><a href="https://www.aboutmonica.com/"><img src="https://avatars0.githubusercontent.com/u/6998954?v=4" width="100px;" alt=""/><br /><sub><b>Monica Powell</b></sub></a></td>
<td align="center"><a href="https://github.com/bboygary"><img src="https://avatars0.githubusercontent.com/u/65660344?v=4" width="100px;" alt=""/><br /><sub><b>Ganesh Rane</b></sub></a></td>
<td align="center"><a href="https://github.com/ryanmdoyle"><img src="https://avatars2.githubusercontent.com/u/20651020?v=4" width="100px;" alt=""/><br /><sub><b>Ryan Doyle</b></sub></a></td>
<td align="center"><a href="https://ajcwebdev.substack.com/"><img src="https://avatars0.githubusercontent.com/u/12433465?v=4" width="100px;" alt=""/><br /><sub><b>Anthony Campolo</b></sub></a></td>
<td align="center"><a href="https://github.com/matthewcarlreetz"><img src="https://avatars0.githubusercontent.com/u/1760821?v=4" width="100px;" alt=""/><br /><sub><b>Matt Reetz</b></sub></a></td>
</tr>
<tr>
<td align="center"><a href="https://in.linkedin.com/in/punit-makwana/"><img src="https://avatars1.githubusercontent.com/u/16760252?v=4" width="100px;" alt=""/><br /><sub><b>Punit Makwana</b></sub></a></td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.19.1",
"version": "0.19.2",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"cross-env": "^7.0.2",
"jest": "^26.1.0",
"lerna": "^3.20.2",
"msw": "0.20.5",
"msw": "0.21.2",
"nodemon": "^2.0.2",
"rimraf": "^3.0.2",
"typescript": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@redwoodjs/api-server",
"description": "Redwood's HTTP server for Serverless Functions",
"version": "0.19.1",
"version": "0.19.2",
"bin": {
"api-server": "./dist/index.js"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"name": "@redwoodjs/api",
"version": "0.19.1",
"version": "0.19.2",
"files": [
"dist"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"dependencies": {
"@prisma/client": "2.7.1",
"@redwoodjs/internal": "^0.19.1",
"@prisma/client": "2.8.1",
"@redwoodjs/internal": "^0.19.2",
"apollo-server-lambda": "2.17.0",
"core-js": "3.6.5",
"graphql": "^15.3.0",
"graphql-scalars": "^1.2.7",
"graphql-tools": "6.2.2",
"graphql-tools": "6.2.4",
"jsonwebtoken": "^8.5.1",
"jwks-rsa": "^1.8.1",
"lodash.merge": "^4.6.2",
"lodash.omitby": "^4.6.0",
"merge-graphql-schemas": "^1.7.6"
},
"devDependencies": {
"@redwoodjs/auth": "^0.19.1",
"@redwoodjs/dev-server": "^0.19.1",
"@redwoodjs/auth": "^0.19.2",
"@redwoodjs/dev-server": "^0.19.2",
"@types/jsonwebtoken": "^8.3.9",
"@types/lodash.merge": "^4.6.6",
"@types/lodash.omitby": "^4.6.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@redwoodjs/auth",
"version": "0.19.1",
"version": "0.19.2",
"files": [
"dist"
],
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@redwoodjs/cli",
"description": "The Redwood Command Line",
"version": "0.19.1",
"version": "0.19.2",
"license": "MIT",
"bin": {
"redwood": "./dist/index.js",
Expand All @@ -13,9 +13,9 @@
"dist"
],
"dependencies": {
"@prisma/sdk": "2.7.1",
"@redwoodjs/internal": "^0.19.1",
"@redwoodjs/structure": "^0.19.1",
"@prisma/sdk": "2.8.1",
"@redwoodjs/internal": "^0.19.2",
"@redwoodjs/structure": "^0.19.2",
"boxen": "^4.2.0",
"camelcase": "^6.0.0",
"chalk": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/dbCommands/studio.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const handler = async () => {
{
title: 'Starting Prisma Studio...',
cmd: 'yarn prisma',
args: ['studio', '--experimental'],
args: ['studio'],
},
],
{ verbose: true }
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const command = 'deploy <command>'
export const description = 'Deploy your Redwood project.'
export const description = 'Deploy your Redwood project'
import terminalLink from 'terminal-link'

export const builder = (yargs) =>
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/commands/destroy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const command = 'destroy <type>'
export const aliases = ['d']
export const description = 'Rollback changes made by the generate command'
import terminalLink from 'terminal-link'

export const builder = (yargs) =>
yargs.commandDir('./destroy', { recurse: true }).demandCommand()
yargs
.commandDir('./destroy', { recurse: true })
.demandCommand()
.epilogue(
`Also see the ${terminalLink(
'Redwood CLI Reference',
'https://redwoodjs.com/reference/command-line-interface#destroy'
)}`
)
4 changes: 2 additions & 2 deletions packages/cli/src/commands/generate/__tests__/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const FooBarPage = () => {
<>
<h1>FooBarPage</h1>
<p>
Find me in <tt>./web/src/pages/FooBarPage/FooBarPage.js</tt>
Find me in <code>./web/src/pages/FooBarPage/FooBarPage.js</code>
</p>
<p>
My default route is named <tt>fooBar</tt>, link to me with \`
My default route is named <code>fooBar</code>, link to me with \`
<Link to={routes.fooBar()}>FooBar</Link>\`
</p>
</>
Expand Down
46 changes: 42 additions & 4 deletions packages/cli/src/commands/generate/auth/__tests__/auth.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
global.__dirname = __dirname
// import { loadGeneratorFixture } from 'src/lib/test'

// import * as auth from '../auth'
import {
waitFor,
} from '@testing-library/react'

test('true', () => {
expect(true).toEqual(true)
jest.mock('fs')
jest.mock('src/lib', () => ({
getPaths: () => ({
api: { functions: '', src: '', lib: '' },
web: { src: '' },
}),
}))

import fs from 'fs'
import chalk from 'chalk'

import * as auth from '../auth'

const EXISTING_AUTH_PROVIDER_ERROR = 'Existing auth provider found.\nUse --force to override existing provider.';

test(`no error thrown when auth provider not found`, async () => {
// Mock process.exit to make sure CLI quites
const cSpy = jest.spyOn(console, 'log').mockImplementation(() => {})

auth.handler({ provider: 'netlify' })
await waitFor(() => expect(console.log).toHaveBeenCalledTimes(1))
expect(console.log).not.toHaveBeenCalledWith(chalk.bold.red(EXISTING_AUTH_PROVIDER_ERROR))

// Restore mocks
cSpy.mockRestore()
})

test('throws an error if auth provider exists', async () => {
// Mock process.exit to make sure CLI quites
const fsSpy = jest.spyOn(fs, 'readFileSync').mockImplementation(() => `import { AuthProvider } from '@redwoodjs/auth'`)
const cSpy = jest.spyOn(console, 'log').mockImplementation(() => {})

auth.handler({ provider: 'netlify' })
await waitFor(() => expect(console.log).toHaveBeenCalledTimes(1))
expect(console.log).toHaveBeenCalledWith(chalk.bold.red(EXISTING_AUTH_PROVIDER_ERROR))

// Restore mocks
fsSpy.mockRestore()
cSpy.mockRestore()
})
Loading

0 comments on commit 6d23f98

Please sign in to comment.