ci-fix-3
This commit is contained in:
parent
cf37edaeca
commit
5e2cec5b5d
|
@ -41,7 +41,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Test production build
|
- name: Run templates build
|
||||||
run: npm run templates
|
run: npm run templates
|
||||||
|
|
||||||
- name: "authorizer_email_confirmation template"
|
- name: "authorizer_email_confirmation template"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"hygen": "HYGEN_TMPLS=gen hygen",
|
"hygen": "HYGEN_TMPLS=gen hygen",
|
||||||
"postinstall": "npm run codegen",
|
"postinstall": "npm run codegen",
|
||||||
"check:code": "npx @biomejs/biome check src --log-kind=compact --verbose",
|
"check:code": "npx @biomejs/biome check src --log-kind=compact --verbose",
|
||||||
|
"check:types": "tsc --noEmit",
|
||||||
"check:code:fix": "npx @biomejs/biome check src --log-kind=compact --verbose --apply-unsafe",
|
"check:code:fix": "npx @biomejs/biome check src --log-kind=compact --verbose --apply-unsafe",
|
||||||
"lint": "npm run lint:code && stylelint **/*.{scss,css}",
|
"lint": "npm run lint:code && stylelint **/*.{scss,css}",
|
||||||
"lint:code": "npx @biomejs/biome lint src --log-kind=compact --verbose",
|
"lint:code": "npx @biomejs/biome lint src --log-kind=compact --verbose",
|
||||||
|
|
|
@ -1,22 +1,36 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const currentDir = process.cwd();
|
||||||
|
const templatePath = path.join(currentDir, 'templates', 'main.html');
|
||||||
|
const outputDir = path.join(currentDir, 'templates', 'dist');
|
||||||
|
const componentsDir = path.join(currentDir, 'templates', 'entries');
|
||||||
|
|
||||||
const components = ['email_confirmation', 'first_publication', 'new_comment', 'password_reset'];
|
const components = ['email_confirmation', 'first_publication', 'new_comment', 'password_reset'];
|
||||||
const template = fs.readFileSync("templates/main.html", "utf-8");
|
|
||||||
const outputDir = 'templates/dist';
|
try {
|
||||||
|
// Read the template file
|
||||||
|
const template = fs.readFileSync(templatePath, 'utf-8');
|
||||||
|
|
||||||
// Generate HTML files for each template
|
// Generate HTML files for each template
|
||||||
components.forEach(component => {
|
components.forEach(component => {
|
||||||
const filePath = path.join(outputDir, `authorizer_${component}.html`);
|
const filePath = path.join(outputDir, `authorizer_${component}.html`);
|
||||||
|
const componentFilePath = path.join(componentsDir, `${component}.html`);
|
||||||
|
|
||||||
|
try {
|
||||||
// Read the component file
|
// Read the component file
|
||||||
const componentContent = fs.readFileSync(`templates/entries/${component}.html`, 'utf-8');
|
const componentContent = fs.readFileSync(componentFilePath, 'utf-8');
|
||||||
|
|
||||||
// Replace placeholder with compiled component code
|
// Replace placeholder with compiled component code
|
||||||
const htmlContent = template.replace('<tbody id="#app"></tbody>', componentContent);
|
const htmlContent = template.replace('<tbody id="#app"></tbody>', componentContent);
|
||||||
|
|
||||||
|
|
||||||
// Write formatted HTML file to disk
|
// Write formatted HTML file to disk
|
||||||
fs.writeFileSync(filePath, htmlContent);
|
fs.writeFileSync(filePath, htmlContent);
|
||||||
console.log(`${filePath} was generated successfully`);
|
console.log(`${filePath} was generated successfully`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error reading component file ${componentFilePath}:`, error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error reading template file ${templatePath}:`, error);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user