Skip to content

Commit 7877a06

Browse files
Fix up pnpm dev (#7424)
* feat: use persistent per turbo recs * feat: preserve types yay * fix: *actually* solve problem * fix: type failures from content types template * fix: bad JS doc comments * fix: bad src/content/template path * chore: changeset --------- Co-authored-by: Nate Moore <[email protected]>
1 parent 3fd10f4 commit 7877a06

File tree

10 files changed

+20
-13
lines changed

10 files changed

+20
-13
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Update internal types for more stable builds for Astro maintainers.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build": "turbo run build --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
1212
"build:ci": "turbo run build:ci --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
1313
"build:examples": "turbo run build --filter=\"@example/*\"",
14-
"dev": "turbo run dev --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
14+
"dev": "turbo run dev --concurrency=40 --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
1515
"format": "pnpm run format:code",
1616
"format:ci": "pnpm run format:imports && pnpm run format:code",
1717
"format:code": "prettier -w . --cache --plugin-search-dir=.",
File renamed without changes.
File renamed without changes.

packages/astro/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@
9191
"client.d.ts",
9292
"client-base.d.ts",
9393
"client-image.d.ts",
94+
"content-types.template.d.ts",
95+
"content-module.template.mjs",
9496
"import-meta.d.ts",
9597
"astro-jsx.d.ts",
9698
"types.d.ts",
9799
"README.md",
98-
"vendor",
99-
"src/content/template"
100+
"vendor"
100101
],
101102
"scripts": {
102103
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",

packages/astro/src/content/utils.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { createImage } from './runtime-assets.js';
2424
/**
2525
* Amap from a collection + slug to the local file path.
2626
* This is used internally to resolve entry imports when using `getEntry()`.
27-
* @see `src/content/virtual-mod.mjs`
27+
* @see `content-module.template.mjs`
2828
*/
2929
export type ContentLookupMap = {
3030
[collectionName: string]: { type: 'content' | 'data'; entries: { [lookupId: string]: string } };
@@ -432,7 +432,6 @@ export type ContentPaths = {
432432
cacheDir: URL;
433433
typesTemplate: URL;
434434
virtualModTemplate: URL;
435-
virtualAssetsModTemplate: URL;
436435
config: {
437436
exists: boolean;
438437
url: URL;
@@ -444,14 +443,13 @@ export function getContentPaths(
444443
fs: typeof fsMod = fsMod
445444
): ContentPaths {
446445
const configStats = search(fs, srcDir);
447-
const templateDir = new URL('../../src/content/template/', import.meta.url);
446+
const pkgBase = new URL('../../', import.meta.url);
448447
return {
449448
cacheDir: new URL('.astro/', root),
450449
contentDir: new URL('./content/', srcDir),
451450
assetsDir: new URL('./assets/', srcDir),
452-
typesTemplate: new URL('types.d.ts', templateDir),
453-
virtualModTemplate: new URL('virtual-mod.mjs', templateDir),
454-
virtualAssetsModTemplate: new URL('virtual-mod-assets.mjs', templateDir),
451+
typesTemplate: new URL('content-types.template.d.ts', pkgBase),
452+
virtualModTemplate: new URL('content-module.template.mjs', pkgBase),
455453
config: configStats,
456454
};
457455
}

packages/astro/src/content/vite-plugin-content-virtual-mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function astroContentVirtualModPlugin({
9494
/**
9595
* Generate a map from a collection + slug to the local file path.
9696
* This is used internally to resolve entry imports when using `getEntry()`.
97-
* @see `src/content/virtual-mod.mjs`
97+
* @see `content-module.template.mjs`
9898
*/
9999
export async function getStringifiedLookupMap({
100100
contentPaths,

packages/astro/test/units/content-collections/frontmatter.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { createFs, triggerFSEvent } from '../test-utils.js';
1010
const root = new URL('../../fixtures/alias/', import.meta.url);
1111

1212
function getTypesDts() {
13-
const typesdtsURL = new URL('../../../src/content/template/types.d.ts', import.meta.url);
13+
const typesdtsURL = new URL('../../../content-types.template.d.ts', import.meta.url);
1414
const relpath = slash(path.relative(fileURLToPath(root), fileURLToPath(typesdtsURL)));
1515
return {
1616
[relpath]: nodeFS.readFileSync(typesdtsURL, 'utf-8'),

scripts/cmd/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,7 @@ export default async function build(...args) {
133133
}
134134

135135
async function clean(outdir) {
136-
return deleteAsync([`${outdir}/**`, `!${outdir}/**/*.d.ts`]);
136+
await deleteAsync([`${outdir}/**`, `!${outdir}/**/*.d.ts`], {
137+
onlyFiles: true,
138+
});
137139
}

turbo.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"outputMode": "new-only"
3333
},
3434
"dev": {
35-
"cache": false
35+
"cache": false,
36+
"persistent": true
3637
},
3738
"test": {
3839
"env": ["RUNNER_OS", "NODE_VERSION"],

0 commit comments

Comments
 (0)