Skip to content

Commit

Permalink
Bump next from 12.0.7 to 12.1.0 (keystonejs#7289)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Mar 7, 2022
1 parent e98ef48 commit dfb4aea
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 1,051 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-cherries-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': patch
---

Fixed using `require.resolve` to get the paths to views not woking with newer versions of Next.
2 changes: 1 addition & 1 deletion design-system/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@types/tinycolor2": "^1.4.3",
"next": "^12.0.7",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"tinycolor2": "^1.4.2"
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"date-fns": "^2.26.0",
"facepaint": "^1.2.1",
"lodash.debounce": "^4.0.8",
"next": "^12.0.7",
"next": "^12.1.0",
"next-compose-plugins": "^2.2.1",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@keystone-6/auth": "^1.0.0",
"@keystone-6/core": "^1.0.0",
"next": "^12.0.7",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/ecommerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@keystone-6/core": "^1.0.0",
"@types/nodemailer": "^6.4.4",
"dotenv": "^11.0.0",
"next": "^12.0.7",
"next": "^12.1.0",
"nodemailer": "^6.7.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/embedded-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@keystone-6/core": "^1.0.0",
"dotenv": "^11.0.0",
"next": "^12.0.7",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/roles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@keystone-6/auth": "^1.0.0",
"@keystone-6/core": "^1.0.0",
"next": "^12.0.7",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-admin-ui-logo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@keystone-6/core": "^1.0.0",
"@keystone-ui/core": "^4.0.0",
"next": "^12.0.7",
"next": "^12.1.0",
"react": "^17.0.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/document-field/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@keystone-6/document-renderer": "^1.0.0",
"@keystone-6/fields-document": "^1.0.0",
"@preconstruct/next": "^3.0.1",
"next": "^12.0.7",
"next": "^12.1.0",
"react": "^17.0.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"memoize-one": "^6.0.0",
"meow": "^9.0.0",
"micro": "^9.3.4",
"next": "^12.0.7",
"next": "^12.1.0",
"node-fetch": "^2.6.7",
"normalize-path": "^3.0.0",
"object-hash": "^3.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/admin-ui/templates/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export const appTemplate = (
// because it does it _sometimes_, we have to remove it so that during live reloading
// we're not constantly doing builds because the query param is there and then it's not and then it is and so on
views = views.replace(/\?[A-Za-z0-9]+$/, '');
// webpack/next adds (api)/ to the return of require.resolve
views = views.replace(/^\(api\)\//, '');
// during a live reload, we'll have paths from a webpack compilation which will make the paths
// that __dirname/__filename/require.resolve return relative to the webpack's "context" option
// which for Next, it's set to the directory of the Next project which is projectAdminPath here.
Expand Down
29 changes: 16 additions & 13 deletions packages/core/src/scripts/tests/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ async function getGeneratedMigration(
// so that the timestamps in the logs are all 0ms
Date.now = () => 0;

function cleanOutputForApplyingMigration(output: string, generatedMigrationName: string) {
// sometimes "✅ The migration has been applied" is printed in a different order which messes up the snapshots
// so we just assert the text exists somewhere and remove it from what we snapshot
expect(output).toContain('✅ The migration has been applied\n');
return output
.replace(new RegExp(generatedMigrationName, 'g'), 'migration_name')
.replace('✅ The migration has been applied\n', '');
}

async function setupInitialProjectWithoutMigrations() {
const tmp = await testdir({
...symlinkKeystoneDeps,
Expand Down Expand Up @@ -271,8 +280,7 @@ CREATE TABLE "Todo" (
);
`);

expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toEqual(`✨ Starting Keystone
expect(cleanOutputForApplyingMigration(recording(), migrationName)).toEqual(`✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
Expand All @@ -283,7 +291,6 @@ Prompt: Name of migration init
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready`);
Expand Down Expand Up @@ -350,8 +357,7 @@ describe('useMigrations: true', () => {
"
`);

expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toMatchInlineSnapshot(`
expect(cleanOutputForApplyingMigration(recording(), migrationName)).toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
Expand All @@ -362,7 +368,6 @@ describe('useMigrations: true', () => {
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
Expand Down Expand Up @@ -426,8 +431,7 @@ describe('useMigrations: true', () => {
"
`);

expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toMatchInlineSnapshot(`
expect(cleanOutputForApplyingMigration(recording(), migrationName)).toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
Expand All @@ -442,7 +446,6 @@ describe('useMigrations: true', () => {
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
Expand Down Expand Up @@ -488,9 +491,10 @@ describe('useMigrations: true', () => {
`);

expect(
recording()
.replace(new RegExp(migrationName, 'g'), 'migration_name')
.replace(oldMigrationName, 'old_migration_name')
cleanOutputForApplyingMigration(recording(), migrationName).replace(
oldMigrationName,
'old_migration_name'
)
).toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
Expand All @@ -517,7 +521,6 @@ describe('useMigrations: true', () => {
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
Expand Down
3 changes: 3 additions & 0 deletions tests/admin-ui-tests/live-reloading.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ test('api routes written with getAdditionalFiles containing [...rest] work', asy

test('changing the label of a field updates in the Admin UI', async () => {
await replaceSchema('second');
// Next shows a "we need to do a full reload" message
// this is expected because of how _app is written so we need to do the reload
page.click('button:has-text("Reload")');

const element = await page.waitForSelector(
'label:has-text("Very Important Text") >> .. >> input'
Expand Down
Loading

0 comments on commit dfb4aea

Please sign in to comment.