kalastatic
Advanced tools
Comparing version 6.0.0-alpha1 to 6.0.0-alpha2
@@ -5,3 +5,3 @@ { | ||
"repository": "https://github.com/kalamuna/kalastatic.git", | ||
"version": "6.0.0-alpha1", | ||
"version": "6.0.0-alpha2", | ||
"type": "module", | ||
@@ -15,5 +15,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"drupal-twig-extensions": "^1.0.0-beta.4", | ||
"meow": "^12.0.1", | ||
"sass": "^1.58.3", | ||
"drupal-twig-extensions": "^1.0.0-beta.5", | ||
"meow": "^12.1.1", | ||
"sass": "^1.69.5", | ||
"twig": "^1.16.0" | ||
@@ -20,0 +20,0 @@ }, |
// This script would exist within the node module and doesn't need to be invoked during a real project | ||
import { | ||
promises as fs | ||
promises as fs, | ||
} from 'fs'; | ||
import { extname, basename, dirname } from 'path'; | ||
import Twig from "twig"; | ||
@@ -157,6 +158,8 @@ | ||
export const createDestinationDir = (destination) => { | ||
// Ensure the destination directory is created. | ||
const pathPieces = destination.split("/"); | ||
pathPieces.pop(); | ||
fs.mkdir(pathPieces.join("/"), { recursive: true }); | ||
let directory = dirname(destination) | ||
if (directory) { | ||
return fs.mkdir(directory, { | ||
recursive: true | ||
}); | ||
} | ||
} | ||
@@ -200,3 +203,2 @@ | ||
// Executes the other functions of Kstat | ||
@@ -260,3 +262,13 @@ export const kstat = async (config) => { | ||
const compiledHtml = await compileTwig(source, page, renderData, config).catch(err => console.log(err.message)); | ||
writeHtml(`${destination}/${page.replace(`${source}/`, "").replace(".twig", "")}`, compiledHtml); | ||
// Find the correct output filename. | ||
let destinationFilename = page | ||
.replace(`${source}/`, '') | ||
.replace('.twig', ''); | ||
if (extname(destinationFilename) == '.html' && basename(destinationFilename, '.html') != 'index') { | ||
destinationFilename = destinationFilename.replace(basename(destinationFilename), basename(destinationFilename, '.html') + '/index.html'); | ||
} | ||
// Write the file. | ||
writeHtml(`${destination}/${destinationFilename}`, compiledHtml); | ||
} | ||
@@ -263,0 +275,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12460
268
0
Updatedmeow@^12.1.1
Updatedsass@^1.69.5