Skip to content

Commit

Permalink
Merge branch 'main' of github.com:redwoodjs/redwood into chore/smoke-…
Browse files Browse the repository at this point in the history
…test

* 'main' of github.com:redwoodjs/redwood: (23 commits)
  Netlify client getToken fix when GoTrue client refreshes JWT (redwoodjs#4539)
  Update dependency @supabase/supabase-js to v1.30.4 (redwoodjs#4536)
  Envelop: Don't use useImmediateIntrospection as it causes auth bug (redwoodjs#4538)
  Update dependency react-hook-form to v7.27.1 (redwoodjs#4521)
  try increasing timeout for flaky test (redwoodjs#4526)
  Update dependency stacktracey to v2.1.8 (redwoodjs#4519)
  Update dependency msw to v0.38.1 (redwoodjs#4525)
  Update dependency eslint-config-prettier to v8.4.0 (redwoodjs#4522)
  Provide a Revised Runtime Error Page (redwoodjs#4167)
  update yarn.lock
  v0.46.0
  Update dependency esbuild to v0.14.23 (redwoodjs#4518)
  Fix Storybook build args (redwoodjs#4455)
  Update dependency react-helmet-async to v1.2.3 (redwoodjs#4502)
  Bump url-parse in /__fixtures__/example-todo-main-with-errors (redwoodjs#4511)
  Bump url-parse from 1.5.1 to 1.5.7 in /__fixtures__/example-todo-main (redwoodjs#4512)
  Update dependency fastify to v3.27.2 (redwoodjs#4516)
  Uncomment role checks (redwoodjs#4476)
  Update dependency zx to v5.1.0 (redwoodjs#4505)
  Update dependency firebase to v9.6.7 (redwoodjs#4514)
  ...
  • Loading branch information
dac09 committed Feb 21, 2022
2 parents 4f4bff0 + 12d17bd commit 95a13e6
Show file tree
Hide file tree
Showing 43 changed files with 1,149 additions and 474 deletions.
12 changes: 6 additions & 6 deletions __fixtures__/example-todo-main-with-errors/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9211,9 +9211,9 @@ querystring@0.2.0:
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=

querystringify@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"
integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==
version "2.2.0"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==

ramda@0.21.0:
version "0.21.0"
Expand Down Expand Up @@ -11075,9 +11075,9 @@ url-loader@4.0.0:
schema-utils "^2.6.5"

url-parse@^1.4.3, url-parse@^1.4.7:
version "1.4.7"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278"
integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==
version "1.5.7"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.7.tgz#00780f60dbdae90181f51ed85fb24109422c932a"
integrity sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"
Expand Down
16 changes: 4 additions & 12 deletions __fixtures__/example-todo-main/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16722,18 +16722,10 @@ url-parse-lax@^3.0.0:
dependencies:
prepend-http "^2.0.0"

url-parse@^1.4.3:
version "1.5.1"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.1.tgz#d5fa9890af8a5e1f274a2c98376510f6425f6e3b"
integrity sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"

url-parse@^1.5.3:
version "1.5.4"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.4.tgz#e4f645a7e2a0852cc8a66b14b292a3e9a11a97fd"
integrity sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg==
url-parse@^1.4.3, url-parse@^1.5.3:
version "1.5.7"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.7.tgz#00780f60dbdae90181f51ed85fb24109422c932a"
integrity sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions __fixtures__/test-project/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@redwoodjs/api": "v0.45.0",
"@redwoodjs/graphql-server": "v0.45.0"
"@redwoodjs/api": "0.46.0",
"@redwoodjs/graphql-server": "0.46.0"
}
}
2 changes: 1 addition & 1 deletion __fixtures__/test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
]
},
"devDependencies": {
"@redwoodjs/core": "v0.45.0"
"@redwoodjs/core": "0.46.0"
},
"eslintConfig": {
"extends": "@redwoodjs/eslint-config",
Expand Down
6 changes: 3 additions & 3 deletions __fixtures__/test-project/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
]
},
"dependencies": {
"@redwoodjs/forms": "v0.45.0",
"@redwoodjs/router": "v0.45.0",
"@redwoodjs/web": "v0.45.0",
"@redwoodjs/forms": "0.46.0",
"@redwoodjs/router": "0.46.0",
"@redwoodjs/web": "0.46.0",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2"
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.45.0",
"version": "0.46.0",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"lerna": "4.0.0",
"lodash.template": "4.5.0",
"make-dir-cli": "3.0.0",
"msw": "0.36.8",
"msw": "0.38.1",
"ncp": "2.0.0",
"node-notifier": "10.0.1",
"nodemon": "2.0.15",
Expand All @@ -92,7 +92,7 @@
"terminal-link": "2.1.1",
"typescript": "4.5.5",
"typescript-transform-paths": "3.3.1",
"zx": "5.0.0"
"zx": "5.1.0"
},
"npmClient": "yarn",
"packageManager": "yarn@3.1.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/api-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@redwoodjs/api-server",
"version": "0.45.0",
"version": "0.46.0",
"description": "Redwood's HTTP server for Serverless Functions",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,7 +31,7 @@
"chalk": "4.1.2",
"chokidar": "3.5.3",
"fast-json-parse": "1.0.3",
"fastify": "3.27.1",
"fastify": "3.27.2",
"fastify-http-proxy": "6.2.2",
"fastify-raw-body": "3.2.0",
"fastify-static": "4.5.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@redwoodjs/api",
"version": "0.45.0",
"version": "0.46.0",
"repository": {
"type": "git",
"url": "https://github.com/redwoodjs/redwood.git",
Expand Down Expand Up @@ -37,7 +37,7 @@
"devDependencies": {
"@babel/cli": "7.16.7",
"@babel/core": "7.16.7",
"@redwoodjs/auth": "v0.45.0",
"@redwoodjs/auth": "0.46.0",
"@types/crypto-js": "4.1.1",
"@types/jsonwebtoken": "8.5.8",
"@types/md5": "2.3.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@redwoodjs/auth",
"version": "0.45.0",
"version": "0.46.0",
"repository": {
"type": "git",
"url": "https://github.com/redwoodjs/redwood.git",
Expand Down Expand Up @@ -29,10 +29,10 @@
"@clerk/clerk-js": "2.13.2",
"@clerk/clerk-sdk-node": "2.9.3",
"@clerk/types": "1.25.1",
"@supabase/supabase-js": "1.30.3",
"@supabase/supabase-js": "1.30.4",
"@types/netlify-identity-widget": "1.9.3",
"@types/react": "17.0.39",
"firebase": "9.6.6",
"firebase": "9.6.7",
"firebase-admin": "10.0.2",
"gotrue-js": "0.9.29",
"jest": "27.5.1",
Expand Down
8 changes: 6 additions & 2 deletions packages/auth/src/authClients/goTrue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ export const goTrue = (client: GoTrue): AuthClientGoTrue => {
signup: async ({ email, password, remember }) =>
client.signup(email, password, remember),
getToken: async () => {
const user = await client.currentUser()
return user?.jwt() || null
try {
const user = await client.currentUser()
return user?.jwt() || null
} catch {
return null
}
},
getUserMetadata: async () => client.currentUser(),
}
Expand Down
14 changes: 9 additions & 5 deletions packages/auth/src/authClients/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ export const netlify = (client: NetlifyIdentity): AuthClient => {
})
},
getToken: async () => {
// The client refresh function only actually refreshes token
// when it's been expired. Don't panic
await client.refresh()
const user = await client.currentUser()
return user?.token?.access_token || null
try {
// The client refresh function only actually refreshes token
// when it's been expired. Don't panic
await client.refresh()
const user = await client.currentUser()
return user?.token?.access_token || null
} catch {
return null
}
},
getUserMetadata: async () => {
return client.currentUser()
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@redwoodjs/cli",
"version": "0.45.0",
"version": "0.46.0",
"description": "The Redwood Command Line",
"repository": {
"type": "git",
Expand Down Expand Up @@ -29,11 +29,11 @@
},
"dependencies": {
"@prisma/sdk": "3.9.2",
"@redwoodjs/api-server": "v0.45.0",
"@redwoodjs/internal": "v0.45.0",
"@redwoodjs/prerender": "v0.45.0",
"@redwoodjs/structure": "v0.45.0",
"@redwoodjs/telemetry": "v0.45.0",
"@redwoodjs/api-server": "0.46.0",
"@redwoodjs/internal": "0.46.0",
"@redwoodjs/prerender": "0.46.0",
"@redwoodjs/structure": "0.46.0",
"@redwoodjs/telemetry": "0.46.0",
"boxen": "5.1.2",
"camelcase": "6.3.0",
"chalk": "4.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ export const hasRole = ({ roles }: { roles: AllowedRoles }): boolean => {
return false
}

// If your User model includes roles, uncomment the role checks on currentUser
if (roles) {
if (Array.isArray(roles)) {
// return context.currentUser.roles?.some((r) => roles.includes(r))
return context.currentUser.roles?.some((r) => roles.includes(r))
}

if (typeof roles === 'string') {
// return context.currentUser.roles?.includes(roles)
return context.currentUser.roles?.includes(roles)
}

// roles not found
Expand Down
86 changes: 68 additions & 18 deletions packages/cli/src/commands/storybook.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import path from 'path'

import execa from 'execa'
import terminalLink from 'terminal-link'

import { getPaths } from '@redwoodjs/internal'
import { errorTelemetry } from '@redwoodjs/telemetry'

import c from '../lib/colors'

export const command = 'storybook'
export const aliases = ['sb']
export const description =
'Launch Storybook: An isolated component development environment'
'Launch Storybook: a tool for building UI components and pages in isolation'

export const builder = (yargs) => {
yargs
Expand Down Expand Up @@ -48,10 +52,20 @@ export const builder = (yargs) => {
throw new Error('Can not provide both "--build" and "--smoke-test"')
}
if (argv.build && argv.open) {
throw new Error('Can not provide both "--build" or "--open"')
console.warn(
c.warning(
'Warning: --open option has no effect when running Storybook build'
)
)
}
return true
})
.epilogue(
`Also see the ${terminalLink(
'Redwood CLI Reference',
'https://redwoodjs.com/reference/command-line-interface#storybook'
)}`
)
}

export const handler = ({
Expand All @@ -77,21 +91,57 @@ export const handler = ({
require.resolve('@redwoodjs/testing/config/storybook/main.js')
)

execa(
`yarn ${build ? 'build' : 'start'}-storybook`,
[
`--config-dir "${storybookConfig}"`,
!build && `--port ${port}`,
!build && '--no-version-updates',
!managerCache && '--no-manager-cache',
build && `--output-dir "${buildDirectory}"`,
!open && !smokeTest && `--ci`,
smokeTest && `--ci --smoke-test`,
].filter(Boolean),
{
stdio: 'inherit',
shell: true,
cwd,
try {
if (build) {
execa(
`yarn build-storybook`,
[
`--config-dir "${storybookConfig}"`,
`--output-dir "${buildDirectory}"`,
!managerCache && `--no-manager-cache`,
].filter(Boolean),
{
stdio: 'inherit',
shell: true,
cwd,
}
)
} else if (smokeTest) {
execa(
`yarn start-storybook`,
[
`--config-dir "${storybookConfig}"`,
`--port ${port}`,
`--smoke-test`,
`--ci`,
`--no-version-updates`,
].filter(Boolean),
{
stdio: 'inherit',
shell: true,
cwd,
}
)
} else {
execa(
`yarn start-storybook`,
[
`--config-dir "${storybookConfig}"`,
`--port ${port}`,
!managerCache && `--no-manager-cache`,
`--no-version-updates`,
!open && `--no-open`,
].filter(Boolean),
{
stdio: 'inherit',
shell: true,
cwd,
}
)
}
)
} catch (e) {
console.log(c.error(e.message))
errorTelemetry(process.argv, e.message)
process.exit(1)
}
}
2 changes: 1 addition & 1 deletion packages/codemods/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@redwoodjs/codemods",
"version": "0.45.0",
"version": "0.46.0",
"description": "Codemods to ease upgrading a RedwoodJS Project",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ describe('Update Jest Config', () => {
})

it('Keeps custom jest config in api and web', async () => {
jest.setTimeout(25_000)

await matchFolderTransform(updateJestConfig, 'custom', {
removeWhitespace: true,
})
Expand Down
1 change: 1 addition & 0 deletions packages/core/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const getSharedPlugins = (isEnvProduction) => {
// The define plugin will replace these keys with their values during build
// time. Note that they're used in packages/web/src/config.ts, and made available in globalThis
new webpack.DefinePlugin({
['process.env.RWJS_SRC_ROOT']: JSON.stringify(redwoodPaths.base),
['process.env.RWJS_API_GRAPHQL_URL']: JSON.stringify(
redwoodConfig.web.apiGraphQLUrl ?? `${redwoodConfig.web.apiUrl}/graphql`
),
Expand Down

0 comments on commit 95a13e6

Please sign in to comment.