summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/astro/src/core/add/index.ts67
-rw-r--r--packages/integrations/cloudflare/package.json4
-rw-r--r--packages/integrations/deno/package.json4
-rw-r--r--packages/integrations/netlify/package.json4
-rw-r--r--packages/integrations/node/package.json4
-rw-r--r--packages/integrations/prefetch/package.json4
-rw-r--r--packages/integrations/vercel/package.json4
7 files changed, 60 insertions, 31 deletions
diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts
index dde670653..95892d80f 100644
--- a/packages/astro/src/core/add/index.ts
+++ b/packages/astro/src/core/add/index.ts
@@ -49,12 +49,12 @@ module.exports = {
}\n`;
const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record<string, string> = {
- 'netlify': '@astrojs/netlify/functions',
- 'vercel': '@astrojs/vercel/serverless',
- 'cloudflare': '@astrojs/cloudflare',
- 'node': '@astrojs/node',
- 'deno': '@astrojs/deno',
-}
+ netlify: '@astrojs/netlify/functions',
+ vercel: '@astrojs/vercel/serverless',
+ cloudflare: '@astrojs/cloudflare',
+ node: '@astrojs/node',
+ deno: '@astrojs/deno',
+};
export default async function add(names: string[], { cwd, flags, logging, telemetry }: AddOptions) {
if (flags.help || names.length === 0) {
@@ -142,7 +142,11 @@ export default async function add(names: string[], { cwd, flags, logging, teleme
info(
logging,
null,
- `\n ${magenta(`Check our deployment docs for ${bold(integration.packageName)} to update your "adapter" config.`)}`
+ `\n ${magenta(
+ `Check our deployment docs for ${bold(
+ integration.packageName
+ )} to update your "adapter" config.`
+ )}`
);
}
} else {
@@ -264,8 +268,10 @@ export default async function add(names: string[], { cwd, flags, logging, teleme
}
}
-function isAdapter(integration: IntegrationInfo): integration is IntegrationInfo & { type: 'adapter' } {
- return integration.type === 'adapter';
+function isAdapter(
+ integration: IntegrationInfo
+): integration is IntegrationInfo & { type: 'adapter' } {
+ return integration.type === 'adapter';
}
async function parseAstroConfig(configURL: URL): Promise<t.File> {
@@ -356,10 +362,7 @@ async function setAdapter(ast: t.File, adapter: IntegrationInfo, exportName: str
ensureImport(
ast,
- t.importDeclaration(
- [t.importDefaultSpecifier(adapterId)],
- t.stringLiteral(exportName)
- )
+ t.importDeclaration([t.importDefaultSpecifier(adapterId)], t.stringLiteral(exportName))
);
visit(ast, {
@@ -384,9 +387,7 @@ async function setAdapter(ast: t.File, adapter: IntegrationInfo, exportName: str
const adapterCall = t.callExpression(adapterId, []);
if (!adapterProp) {
- configObject.properties.push(
- t.objectProperty(t.identifier('adapter'), adapterCall)
- );
+ configObject.properties.push(t.objectProperty(t.identifier('adapter'), adapterCall));
return;
}
@@ -465,7 +466,11 @@ async function updateAstroConfig({
info(
logging,
null,
- magenta(` For complete deployment options, visit\n ${bold('https://docs.astro.build/en/guides/deploy/')}\n`)
+ magenta(
+ ` For complete deployment options, visit\n ${bold(
+ 'https://docs.astro.build/en/guides/deploy/'
+ )}\n`
+ )
);
}
@@ -570,9 +575,13 @@ async function tryToInstallIntegrations({
}
}
-async function fetchPackageJson(scope: string | undefined, name: string, tag: string): Promise<object | Error> {
+async function fetchPackageJson(
+ scope: string | undefined,
+ name: string,
+ tag: string
+): Promise<object | Error> {
const packageName = `${scope ? `@${scope}/` : ''}${name}`;
- const res = await fetch(`https://registry.npmjs.org/${packageName}/${tag}`)
+ const res = await fetch(`https://registry.npmjs.org/${packageName}/${tag}`);
if (res.status === 404) {
return new Error();
} else {
@@ -597,7 +606,9 @@ export async function validateIntegrations(integrations: string[]): Promise<Inte
if (!scope) {
const firstPartyPkgCheck = await fetchPackageJson('astrojs', name, tag);
if (firstPartyPkgCheck instanceof Error) {
- spinner.warn(yellow(`${bold(integration)} is not an official Astro package. Use at your own risk!`));
+ spinner.warn(
+ yellow(`${bold(integration)} is not an official Astro package. Use at your own risk!`)
+ );
const response = await prompts({
type: 'confirm',
name: 'askToContinue',
@@ -605,7 +616,11 @@ export async function validateIntegrations(integrations: string[]): Promise<Inte
initial: true,
});
if (!response.askToContinue) {
- throw new Error(`No problem! Find our official integrations at ${cyan('https://astro.build/integrations')}`);
+ throw new Error(
+ `No problem! Find our official integrations at ${cyan(
+ 'https://astro.build/integrations'
+ )}`
+ );
}
spinner.start('Resolving with third party packages...');
pkgType = 'third-party';
@@ -616,9 +631,7 @@ export async function validateIntegrations(integrations: string[]): Promise<Inte
if (pkgType === 'third-party') {
const thirdPartyPkgCheck = await fetchPackageJson(scope, name, tag);
if (thirdPartyPkgCheck instanceof Error) {
- throw new Error(
- `Unable to fetch ${bold(integration)}. Does the package exist?`,
- );
+ throw new Error(`Unable to fetch ${bold(integration)}. Does the package exist?`);
} else {
pkgJson = thirdPartyPkgCheck as any;
}
@@ -645,7 +658,11 @@ export async function validateIntegrations(integrations: string[]): Promise<Inte
integrationType = 'adapter';
} else {
throw new Error(
- `${bold(packageName)} doesn't appear to be an integration or an adapter. Find our official integrations at ${cyan('https://astro.build/integrations')}`
+ `${bold(
+ packageName
+ )} doesn't appear to be an integration or an adapter. Find our official integrations at ${cyan(
+ 'https://astro.build/integrations'
+ )}`
);
}
diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json
index cd4a637b7..425f5aa42 100644
--- a/packages/integrations/cloudflare/package.json
+++ b/packages/integrations/cloudflare/package.json
@@ -11,7 +11,9 @@
"url": "https://github.com/withastro/astro.git",
"directory": "packages/integrations/cloudflare"
},
- "keywords": ["astro-adapter"],
+ "keywords": [
+ "astro-adapter"
+ ],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {
diff --git a/packages/integrations/deno/package.json b/packages/integrations/deno/package.json
index 02ed83554..b7f5758b8 100644
--- a/packages/integrations/deno/package.json
+++ b/packages/integrations/deno/package.json
@@ -11,7 +11,9 @@
"url": "https://github.com/withastro/astro.git",
"directory": "packages/integrations/deno"
},
- "keywords": ["astro-adapter"],
+ "keywords": [
+ "astro-adapter"
+ ],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {
diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json
index 5eee7a595..8bdc42acb 100644
--- a/packages/integrations/netlify/package.json
+++ b/packages/integrations/netlify/package.json
@@ -11,7 +11,9 @@
"url": "https://github.com/withastro/astro.git",
"directory": "packages/integrations/netlify"
},
- "keywords": ["astro-adapter"],
+ "keywords": [
+ "astro-adapter"
+ ],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {
diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json
index de42e7d16..1c96ebafc 100644
--- a/packages/integrations/node/package.json
+++ b/packages/integrations/node/package.json
@@ -11,7 +11,9 @@
"url": "https://github.com/withastro/astro.git",
"directory": "packages/integrations/node"
},
- "keywords": ["astro-adapter"],
+ "keywords": [
+ "astro-adapter"
+ ],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {
diff --git a/packages/integrations/prefetch/package.json b/packages/integrations/prefetch/package.json
index 4ce1db137..7c6fa5257 100644
--- a/packages/integrations/prefetch/package.json
+++ b/packages/integrations/prefetch/package.json
@@ -11,7 +11,9 @@
"url": "https://github.com/withastro/astro.git",
"directory": "packages/astro-prefetch"
},
- "keywords": ["astro-integration"],
+ "keywords": [
+ "astro-integration"
+ ],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {
diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json
index 055f08b8d..5e59abf17 100644
--- a/packages/integrations/vercel/package.json
+++ b/packages/integrations/vercel/package.json
@@ -10,7 +10,9 @@
"url": "https://github.com/withastro/astro.git",
"directory": "packages/integrations/vercel"
},
- "keywords": ["astro-adapter"],
+ "keywords": [
+ "astro-adapter"
+ ],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {