Skip to content

Commit

Permalink
Merge branch 'canary' into shu/x81n
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Sep 6, 2022
2 parents fbfaab2 + fa08a17 commit d2d5c77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/create-next-app/helpers/examples.ts
Expand Up @@ -5,7 +5,7 @@ import { Stream } from 'stream'
import { promisify } from 'util'
import { join } from 'path'
import { tmpdir } from 'os'
import { createWriteStream } from 'fs'
import { createWriteStream, promises as fs } from 'fs'

const pipeline = promisify(Stream.pipeline)

Expand Down Expand Up @@ -83,7 +83,7 @@ export function existsInRepo(nameOrUrl: string): Promise<boolean> {
}

async function downloadTar(url: string) {
const tempFile = join(tmpdir(), `next.js-cra-example.temp-${Date.now()}`)
const tempFile = join(tmpdir(), `next.js-cna-example.temp-${Date.now()}`)
await pipeline(got.stream(url), createWriteStream(tempFile))
return tempFile
}
Expand All @@ -105,6 +105,8 @@ export async function downloadAndExtractRepo(
`${name}-${branch.replace(/\//g, '-')}${filePath ? `/${filePath}` : ''}`
),
})

await fs.unlink(tempFile)
}

export async function downloadAndExtractExample(root: string, name: string) {
Expand All @@ -122,4 +124,6 @@ export async function downloadAndExtractExample(root: string, name: string) {
strip: 3,
filter: (p) => p.includes(`next.js-canary/examples/${name}`),
})

await fs.unlink(tempFile)
}
10 changes: 6 additions & 4 deletions packages/next/taskfile.js
Expand Up @@ -2084,12 +2084,12 @@ export default async function (task) {
await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts)
await task.watch('trace/**/*.+(js|ts|tsx)', 'trace', opts)
await task.watch(
'shared/lib/{amp,config,constants,dynamic,head}.+(js|ts|tsx)',
'shared/lib/{amp,config,constants,dynamic,head,runtime-config}.+(js|ts|tsx)',
'shared_re_exported',
opts
)
await task.watch(
'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)',
'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)',
'shared',
opts
)
Expand All @@ -2104,7 +2104,8 @@ export default async function (task) {
export async function shared(task, opts) {
await task
.source(
opts.src || 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)'
opts.src ||
'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)'
)
.swc('client', { dev: opts.dev })
.target('dist/shared')
Expand All @@ -2114,7 +2115,8 @@ export async function shared(task, opts) {
export async function shared_re_exported(task, opts) {
await task
.source(
opts.src || 'shared/**/{amp,config,constants,dynamic,head}.+(js|ts|tsx)'
opts.src ||
'shared/**/{amp,config,constants,dynamic,head,runtime-config}.+(js|ts|tsx)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/shared')
Expand Down

0 comments on commit d2d5c77

Please sign in to comment.