summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-06-20 14:06:36 -0400
committerGravatar GitHub <noreply@github.com> 2023-06-20 14:06:36 -0400
commit7877a06d829305eed356fbb8bfd1ef578cd5466e (patch)
tree00b822289ff84cb241842cb9506233181ea8ad1e
parent3fd10f4597712080a12dcd98e74d39c2e78d032a (diff)
downloadastro-7877a06d829305eed356fbb8bfd1ef578cd5466e.tar.gz
astro-7877a06d829305eed356fbb8bfd1ef578cd5466e.tar.zst
astro-7877a06d829305eed356fbb8bfd1ef578cd5466e.zip
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 <natemoo-re@users.noreply.github.com>
-rw-r--r--.changeset/fluffy-pandas-breathe.md5
-rw-r--r--package.json2
-rw-r--r--packages/astro/content-module.template.mjs (renamed from packages/astro/src/content/template/virtual-mod.mjs)0
-rw-r--r--packages/astro/content-types.template.d.ts (renamed from packages/astro/src/content/template/types.d.ts)0
-rw-r--r--packages/astro/package.json5
-rw-r--r--packages/astro/src/content/utils.ts10
-rw-r--r--packages/astro/src/content/vite-plugin-content-virtual-mod.ts2
-rw-r--r--packages/astro/test/units/content-collections/frontmatter.test.js2
-rw-r--r--scripts/cmd/build.js4
-rw-r--r--turbo.json3
10 files changed, 20 insertions, 13 deletions
diff --git a/.changeset/fluffy-pandas-breathe.md b/.changeset/fluffy-pandas-breathe.md
new file mode 100644
index 000000000..f3d1fdffb
--- /dev/null
+++ b/.changeset/fluffy-pandas-breathe.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Update internal types for more stable builds for Astro maintainers.
diff --git a/package.json b/package.json
index 4ce4c3e5e..e41f11a5c 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"build": "turbo run build --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
"build:ci": "turbo run build:ci --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
"build:examples": "turbo run build --filter=\"@example/*\"",
- "dev": "turbo run dev --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
+ "dev": "turbo run dev --concurrency=40 --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
"format": "pnpm run format:code",
"format:ci": "pnpm run format:imports && pnpm run format:code",
"format:code": "prettier -w . --cache --plugin-search-dir=.",
diff --git a/packages/astro/src/content/template/virtual-mod.mjs b/packages/astro/content-module.template.mjs
index e0ac7a564..e0ac7a564 100644
--- a/packages/astro/src/content/template/virtual-mod.mjs
+++ b/packages/astro/content-module.template.mjs
diff --git a/packages/astro/src/content/template/types.d.ts b/packages/astro/content-types.template.d.ts
index 277d00acf..277d00acf 100644
--- a/packages/astro/src/content/template/types.d.ts
+++ b/packages/astro/content-types.template.d.ts
diff --git a/packages/astro/package.json b/packages/astro/package.json
index 8e513b9b2..a9b4854a7 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -91,12 +91,13 @@
"client.d.ts",
"client-base.d.ts",
"client-image.d.ts",
+ "content-types.template.d.ts",
+ "content-module.template.mjs",
"import-meta.d.ts",
"astro-jsx.d.ts",
"types.d.ts",
"README.md",
- "vendor",
- "src/content/template"
+ "vendor"
],
"scripts": {
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts
index 3cee0765c..631f30e1f 100644
--- a/packages/astro/src/content/utils.ts
+++ b/packages/astro/src/content/utils.ts
@@ -24,7 +24,7 @@ import { createImage } from './runtime-assets.js';
/**
* Amap from a collection + slug to the local file path.
* This is used internally to resolve entry imports when using `getEntry()`.
- * @see `src/content/virtual-mod.mjs`
+ * @see `content-module.template.mjs`
*/
export type ContentLookupMap = {
[collectionName: string]: { type: 'content' | 'data'; entries: { [lookupId: string]: string } };
@@ -432,7 +432,6 @@ export type ContentPaths = {
cacheDir: URL;
typesTemplate: URL;
virtualModTemplate: URL;
- virtualAssetsModTemplate: URL;
config: {
exists: boolean;
url: URL;
@@ -444,14 +443,13 @@ export function getContentPaths(
fs: typeof fsMod = fsMod
): ContentPaths {
const configStats = search(fs, srcDir);
- const templateDir = new URL('../../src/content/template/', import.meta.url);
+ const pkgBase = new URL('../../', import.meta.url);
return {
cacheDir: new URL('.astro/', root),
contentDir: new URL('./content/', srcDir),
assetsDir: new URL('./assets/', srcDir),
- typesTemplate: new URL('types.d.ts', templateDir),
- virtualModTemplate: new URL('virtual-mod.mjs', templateDir),
- virtualAssetsModTemplate: new URL('virtual-mod-assets.mjs', templateDir),
+ typesTemplate: new URL('content-types.template.d.ts', pkgBase),
+ virtualModTemplate: new URL('content-module.template.mjs', pkgBase),
config: configStats,
};
}
diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
index 33aae964d..ecda537e2 100644
--- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
+++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
@@ -94,7 +94,7 @@ export function astroContentVirtualModPlugin({
/**
* Generate a map from a collection + slug to the local file path.
* This is used internally to resolve entry imports when using `getEntry()`.
- * @see `src/content/virtual-mod.mjs`
+ * @see `content-module.template.mjs`
*/
export async function getStringifiedLookupMap({
contentPaths,
diff --git a/packages/astro/test/units/content-collections/frontmatter.test.js b/packages/astro/test/units/content-collections/frontmatter.test.js
index c4c9826fd..f264f994a 100644
--- a/packages/astro/test/units/content-collections/frontmatter.test.js
+++ b/packages/astro/test/units/content-collections/frontmatter.test.js
@@ -10,7 +10,7 @@ import { createFs, triggerFSEvent } from '../test-utils.js';
const root = new URL('../../fixtures/alias/', import.meta.url);
function getTypesDts() {
- const typesdtsURL = new URL('../../../src/content/template/types.d.ts', import.meta.url);
+ const typesdtsURL = new URL('../../../content-types.template.d.ts', import.meta.url);
const relpath = slash(path.relative(fileURLToPath(root), fileURLToPath(typesdtsURL)));
return {
[relpath]: nodeFS.readFileSync(typesdtsURL, 'utf-8'),
diff --git a/scripts/cmd/build.js b/scripts/cmd/build.js
index 8a38eacf3..54afa7af7 100644
--- a/scripts/cmd/build.js
+++ b/scripts/cmd/build.js
@@ -133,5 +133,7 @@ export default async function build(...args) {
}
async function clean(outdir) {
- return deleteAsync([`${outdir}/**`, `!${outdir}/**/*.d.ts`]);
+ await deleteAsync([`${outdir}/**`, `!${outdir}/**/*.d.ts`], {
+ onlyFiles: true,
+ });
}
diff --git a/turbo.json b/turbo.json
index 43f9c00e7..158618ffe 100644
--- a/turbo.json
+++ b/turbo.json
@@ -32,7 +32,8 @@
"outputMode": "new-only"
},
"dev": {
- "cache": false
+ "cache": false,
+ "persistent": true
},
"test": {
"env": ["RUNNER_OS", "NODE_VERSION"],