SvelteKit adapter that automatically detects deployment environment and installs appropriate platform-specific adapter
Overall
score
96%
Build a Node.js CLI tool that scaffolds SvelteKit projects configured for multiple deployment environments. The tool should support both development and production configurations, leveraging automatic platform detection for deployments.
Your tool should initialize a SvelteKit project structure with configuration files ready for multiple deployment scenarios.
The tool accepts the following command-line arguments:
--name <project-name>: Name of the project (required)--adapter <type>: Adapter type - either auto for automatic detection or static for static site generation (default: auto)The tool must create:
svelte.config.js file configured with the appropriate adapterpackage.json file with necessary dependencies.env.example file documenting supported deployment platforms (Vercel, Netlify, Cloudflare Pages)--adapter auto is specified (or by default), configure the project to use automatic platform detection--adapter static is specified, configure the project for static site generationRunning the tool with --name my-app creates a directory structure with svelte.config.js configured for automatic adapter detection @test
Running the tool with --name my-app --adapter static creates a configuration using the static adapter @test
The generated package.json includes the correct adapter package as a dependency based on the selected type @test
@generates
/**
* Parses command line arguments
*
* @param {string[]} args - Command line arguments
* @returns {object} Parsed options with name and adapter properties
*/
function parseArgs(args) {
// Implementation here
}
/**
* Generates svelte.config.js content for the specified adapter type
*
* @param {string} adapterType - Type of adapter ('auto' or 'static')
* @returns {string} The svelte.config.js file content
*/
function generateSvelteConfig(adapterType) {
// Implementation here
}
/**
* Generates package.json content with correct adapter dependency
*
* @param {string} projectName - Name of the project
* @param {string} adapterType - Type of adapter ('auto' or 'static')
* @returns {string} The package.json file content
*/
function generatePackageJson(projectName, adapterType) {
// Implementation here
}
/**
* Creates the project directory structure and files
*
* @param {string} projectName - Name of the project
* @param {string} adapterType - Type of adapter ('auto' or 'static')
* @returns {Promise<void>}
*/
async function scaffoldProject(projectName, adapterType) {
// Implementation here
}
module.exports = {
parseArgs,
generateSvelteConfig,
generatePackageJson,
scaffoldProject
};Provides automatic adapter detection and installation functionality for SvelteKit projects. The scaffolded projects will use this adapter by default.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-sveltejs--adapter-autodocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10