diff --git a/src/icons.js b/src/icons.js index d97ac84..773c391 100644 --- a/src/icons.js +++ b/src/icons.js @@ -17,6 +17,7 @@ export function findIcon(query) { /** @type {Record} */ const overrides = { + collection_pages: 'web_asset', pages: 'wysiwyg', posts: 'event_available', post: 'event_available', diff --git a/src/ssgs/jekyll.js b/src/ssgs/jekyll.js index db1aeb8..e8d61c0 100644 --- a/src/ssgs/jekyll.js +++ b/src/ssgs/jekyll.js @@ -124,6 +124,7 @@ export default class Jekyll extends Ssg { ignoredFolders() { return super.ignoredFolders().concat([ '_site/', // build output + 'assets/', // popular assets plugin folder '.jekyll-cache/', // cache '.jekyll-metadata/', // cache ]); @@ -240,7 +241,7 @@ export default class Jekyll extends Ssg { const path = stripTopPath(fullPath, options?.source); const isDefaultCollection = - path === '' || + path === sortedPaths[0] || // root folder, or a subfolder if no content files in root path === '_data' || path.startsWith('_data/') || path === '_posts' || diff --git a/src/ssgs/ssg.js b/src/ssgs/ssg.js index d5d654a..089d6a6 100644 --- a/src/ssgs/ssg.js +++ b/src/ssgs/ssg.js @@ -172,8 +172,12 @@ export default class Ssg { 'tsconfig.json', 'jsconfig.json', '.prettierrc.json', + 'docker-compose.yml', + 'docker-compose.nginx.yml', 'package-lock.json', 'package.json', + 'netlify.toml', + 'vercel.json', 'manifest.json', '.gitignore', 'README', @@ -218,9 +222,13 @@ export default class Ssg { */ isIgnoredPath(filePath) { return ( + filePath.includes('.config.') || + filePath.includes('/.') || + filePath.startsWith('.') || this.ignoredFolders().some( (folder) => filePath.startsWith(folder) || filePath.includes(`/${folder}`), - ) || this.ignoredFiles().some((file) => filePath === file || filePath.endsWith(`/${file}`)) + ) || + this.ignoredFiles().some((file) => filePath === file || filePath.endsWith(`/${file}`)) ); } @@ -266,6 +274,10 @@ export default class Ssg { * @returns {import('../types').FileType} */ getFileType(filePath) { + if (this.isConfigPath(filePath)) { + return 'config'; + } + if (this.isIgnoredPath(filePath)) { return 'ignored'; } @@ -274,10 +286,6 @@ export default class Ssg { return 'partial'; } - if (this.isConfigPath(filePath)) { - return 'config'; - } - if (this.isContentPath(filePath)) { return 'content'; } diff --git a/toolproof_tests/jekyll/base.toolproof.yml b/toolproof_tests/jekyll/base.toolproof.yml index fab38ed..ee6744d 100644 --- a/toolproof_tests/jekyll/base.toolproof.yml +++ b/toolproof_tests/jekyll/base.toolproof.yml @@ -7,6 +7,10 @@ steps: collections: - staff - data + - step: I have a "src/.somethingconfig.yml" file with the content {yaml} + yaml: '' + - step: I have a "src/another/folder/something.config.yml" file with the content {yaml} + yaml: '' - step: I have a "src/collections/_posts/1999-12-31-partying.md" file with the content {md} md: |- --- diff --git a/toolproof_tests/jekyll/page-in-subfolder.toolproof.yml b/toolproof_tests/jekyll/page-in-subfolder.toolproof.yml new file mode 100644 index 0000000..a8dba5a --- /dev/null +++ b/toolproof_tests/jekyll/page-in-subfolder.toolproof.yml @@ -0,0 +1,47 @@ +name: Jekyll with one page in a subfolder of root + +steps: + - step: I have a "src/_config.yml" file with the content {yaml} + yaml: '' + - step: I have a "src/webpages/index.html" file with the content {html} + html: |- + --- + permalink: / + --- + + + + Home + + +

Home

+

Hello.

+ + + - ref: ./../core/run_gadget.toolproof.yml + - snapshot: stdout + snapshot_content: |- + ╎{ + ╎ "ssg": "jekyll", + ╎ "config": { + ╎ "collections_config": { + ╎ "webpages": { + ╎ "path": "webpages", + ╎ "name": "Webpages", + ╎ "icon": "pages", + ╎ "output": false + ╎ } + ╎ }, + ╎ "timezone": "Pacific/Auckland", + ╎ "markdown": { + ╎ "engine": "kramdown", + ╎ "options": { + ╎ "heading_ids": false, + ╎ "gfm": false, + ╎ "breaks": false, + ╎ "typographer": false, + ╎ "treat_indentation_as_code": true + ╎ } + ╎ } + ╎ } + ╎}