Skip to content

Commit

Permalink
chore(vs): Cleanup public folder & it's corresponding copying code
Browse files Browse the repository at this point in the history
  • Loading branch information
boazpoolman committed Jun 17, 2023
1 parent a48223b commit 9135a16
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 46 deletions.
3 changes: 0 additions & 3 deletions public/.gitignore.example

This file was deleted.

13 changes: 0 additions & 13 deletions server/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

const fs = require('fs');
const { logMessage } = require('./utils');
const copyPublicFolder = require('./utils/copyPublicFolder');

module.exports = async () => {
const sitemap = strapi.plugin('sitemap');
Expand All @@ -11,17 +9,6 @@ module.exports = async () => {
// Load lifecycle methods for auto generation of sitemap.
await sitemap.service('lifecycle').loadAllLifecycleMethods();

// Copy the plugins /public folder to the /public/sitemap/ folder in the root of your project.
if (!fs.existsSync('public/sitemap/xsl/')) {
if (fs.existsSync('./src/extensions/sitemap/public/')) {
await copyPublicFolder('./src/extensions/sitemap/public/', 'public/sitemap/');
} else if (fs.existsSync('./src/plugins/sitemap/public/')) {
await copyPublicFolder('./src/plugins/sitemap/public/', 'public/sitemap/');
} else if (fs.existsSync('./node_modules/strapi-plugin-sitemap/public/')) {
await copyPublicFolder('./node_modules/strapi-plugin-sitemap/public/', 'public/sitemap/');
}
}

// Register permission actions.
const actions = [
{
Expand Down
8 changes: 4 additions & 4 deletions server/controllers/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ module.exports = {
},

getSitemapXsl: async (ctx) => {
const xsl = fs.readFileSync(path.resolve(__dirname, "../../public/xsl/sitemap.xsl"), "utf8");
const xsl = fs.readFileSync(path.resolve(__dirname, "../../xsl/sitemap.xsl"), "utf8");
ctx.response.set("content-type", 'application/xml');
ctx.body = xsl;
},

getSitemapXslJs: async (ctx) => {
const xsl = fs.readFileSync(path.resolve(__dirname, "../../public/xsl/sitemap.xsl.js"), "utf8");
const xsl = fs.readFileSync(path.resolve(__dirname, "../../xsl/sitemap.xsl.js"), "utf8");
ctx.response.set("content-type", 'text/javascript');
ctx.body = xsl;
},

getSitemapXslSortable: async (ctx) => {
const xsl = fs.readFileSync(path.resolve(__dirname, "../../public/xsl/sortable.min.js"), "utf8");
const xsl = fs.readFileSync(path.resolve(__dirname, "../../xsl/sortable.min.js"), "utf8");
ctx.response.set("content-type", 'text/javascript');
ctx.body = xsl;
},

getSitemapXslCss: async (ctx) => {
const xsl = fs.readFileSync(path.resolve(__dirname, "../../public/xsl/sitemap.xsl.css"), "utf8");
const xsl = fs.readFileSync(path.resolve(__dirname, "../../xsl/sitemap.xsl.css"), "utf8");
ctx.response.set("content-type", 'text/css');
ctx.body = xsl;
},
Expand Down
26 changes: 0 additions & 26 deletions server/utils/copyPublicFolder.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9135a16

Please sign in to comment.