mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-08 18:03:17 +02:00
#522 - Add Astro support
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
### 🎨 Enhancements
|
||||
|
||||
- [#522](https://github.com/estruyf/vscode-front-matter/issues/522): Configuration support added for [Astro](https://astro.build)
|
||||
|
||||
### ⚡️ Optimizations
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
export const FrameworkDetectors = [
|
||||
{
|
||||
framework: {
|
||||
name: 'astro',
|
||||
dist: 'dist',
|
||||
static: 'public',
|
||||
build: 'npm run build',
|
||||
server: 'http://127.0.0.1:3000'
|
||||
},
|
||||
requiredFiles: ['astro.config.mjs'],
|
||||
requiredDependencies: ['astro'],
|
||||
commands: {
|
||||
start: 'npm run dev'
|
||||
}
|
||||
},
|
||||
{
|
||||
framework: {
|
||||
name: 'gatsby',
|
||||
@@ -17,7 +31,8 @@ export const FrameworkDetectors = [
|
||||
name: 'hugo',
|
||||
dist: 'public',
|
||||
static: 'static',
|
||||
build: 'hugo'
|
||||
build: 'hugo',
|
||||
server: 'http://127.0.0.1:1313'
|
||||
},
|
||||
requiredFiles: ['config.toml', 'config.yaml', 'config.yml'],
|
||||
commands: {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { join } from 'path';
|
||||
import { commands, Uri } from 'vscode';
|
||||
import { Folders } from '../../commands/Folders';
|
||||
import { COMMAND_NAME, SETTING_CONTENT_STATIC_FOLDER, SETTING_FRAMEWORK_ID } from '../../constants';
|
||||
import {
|
||||
COMMAND_NAME,
|
||||
SETTING_CONTENT_STATIC_FOLDER,
|
||||
SETTING_FRAMEWORK_ID,
|
||||
SETTING_PREVIEW_HOST
|
||||
} from '../../constants';
|
||||
import { DashboardCommand } from '../../dashboardWebView/DashboardCommand';
|
||||
import { DashboardMessage } from '../../dashboardWebView/DashboardMessage';
|
||||
import { DashboardSettings, Settings } from '../../helpers';
|
||||
@@ -62,12 +67,18 @@ export class SettingsListener extends BaseListener {
|
||||
|
||||
if (frameworkId) {
|
||||
const allFrameworks = FrameworkDetector.getAll();
|
||||
const framework = allFrameworks.find((f: Framework) => f.name === frameworkId);
|
||||
const framework: Framework | undefined = allFrameworks.find(
|
||||
(f: Framework) => f.name === frameworkId
|
||||
);
|
||||
if (framework) {
|
||||
if (framework.static) {
|
||||
await Settings.update(SETTING_CONTENT_STATIC_FOLDER, framework.static, true);
|
||||
}
|
||||
|
||||
if (framework.server) {
|
||||
await Settings.update(SETTING_PREVIEW_HOST, framework.server, true);
|
||||
}
|
||||
|
||||
await FrameworkDetector.checkDefaultSettings(framework);
|
||||
} else {
|
||||
await Settings.update(SETTING_CONTENT_STATIC_FOLDER, '', true);
|
||||
|
||||
@@ -3,4 +3,5 @@ export interface Framework {
|
||||
dist: string;
|
||||
static: string;
|
||||
build: string;
|
||||
server?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user