Merge branch 'dev' into localization

This commit is contained in:
Elio Struyf
2023-11-09 14:16:14 -08:00
4 changed files with 32 additions and 3 deletions
+1
View File
@@ -25,6 +25,7 @@
- [#694](https://github.com/estruyf/vscode-front-matter/issues/694): Start terminal session from the folder where the `frontmatter.json` file is located
- [#696](https://github.com/estruyf/vscode-front-matter/issues/696): Close the local server terminal on restart
- [#699](https://github.com/estruyf/vscode-front-matter/issues/699): Changing border theme variable for the dashboard header
- [#703](https://github.com/estruyf/vscode-front-matter/issues/703): Fix retrieval of Astro Collections for `pnpm` projects
## [9.3.1] - 2023-10-27
+7 -1
View File
@@ -860,7 +860,13 @@ export class ContentType {
!!contentType.clearEmpty
);
data = ArticleHelper.updateDates(Object.assign({}, data));
const article: ParsedFrontMatter = {
content: '',
data: Object.assign({}, data),
path: newFilePath
};
data = ArticleHelper.updateDates(article);
if (contentType.name !== DEFAULT_CONTENT_TYPE_NAME) {
data['type'] = contentType.name;
+23 -1
View File
@@ -9,6 +9,7 @@ import { SETTING_TAXONOMY_CONTENT_TYPES, SsgScripts } from '../../constants';
import { SettingsListener } from './SettingsListener';
import { Terminal } from '../../services';
import { existsAsync, readFileAsync } from '../../utils';
import { join } from 'path';
export class SsgListener extends BaseListener {
/**
@@ -133,7 +134,28 @@ export class SsgListener extends BaseListener {
const tempLocation = Uri.joinPath(wsFolder, '/.frontmatter/temp');
const tempScriptPath = Uri.joinPath(tempLocation, SsgScripts.astroContentCollectionScript);
await workspace.fs.createDirectory(tempLocation);
workspace.fs.copy(scriptPath, tempScriptPath, { overwrite: true });
// Check if the workspace uses pnpm
if (await existsAsync(Uri.joinPath(wsFolder, 'node_modules/.pnpm').fsPath)) {
const vitePackageFiles = await workspace.findFiles(
`**/node_modules/.pnpm/vite@*/node_modules/vite/package.json`
);
if (vitePackageFiles.length > 0) {
const vitePackageFile = vitePackageFiles[0];
const vitePackage = JSON.parse(await readFileAsync(vitePackageFile.fsPath, 'utf8')) as {
main: string;
};
const viteFolder = vitePackageFile.fsPath.replace('/package.json', '');
const vitePath = join(viteFolder, vitePackage.main).replace(wsFolder.fsPath, '../..');
// Update the vite reference, as it is not a direct dependency of the project
let scriptContents = await readFileAsync(scriptPath.fsPath, 'utf8');
scriptContents = scriptContents.replace(`"vite"`, `"${vitePath}"`);
await workspace.fs.writeFile(tempScriptPath, Buffer.from(scriptContents, 'utf8'));
}
} else {
workspace.fs.copy(scriptPath, tempScriptPath, { overwrite: true });
}
const fullScript = `node "${tempScriptPath.fsPath}" "${contentConfigFile.fsPath}"`;
+1 -1
View File
@@ -1,7 +1,7 @@
import { writeFileSync } from "fs";
import { join } from "path";
import { createServer } from "vite";
import zod from "zod";
import zod from "astro/zod";
const {
ZodDefault,