diff --git a/greenwood.config.js b/greenwood.config.js index 13c295c5a..8a3f421a7 100644 --- a/greenwood.config.js +++ b/greenwood.config.js @@ -7,25 +7,11 @@ import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss'; import rollupPluginAnalyzer from 'rollup-plugin-analyzer'; import { fileURLToPath, URL } from 'url'; -const META_DESCRIPTION = 'Your workbench for the web. Focused on supporting modern web standards and development to help you create your next project.'; -const FAVICON_HREF = '/favicon.ico'; - export default { workspace: fileURLToPath(new URL('./www', import.meta.url)), optimization: 'inline', staticRouter: true, - title: 'Greenwood', - meta: [ - { name: 'description', content: META_DESCRIPTION }, - { name: 'twitter:site', content: '@PrjEvergreen' }, - { property: 'og:title', content: 'Greenwood' }, - { property: 'og:type', content: 'website' }, - { property: 'og:url', content: 'https://www.greenwoodjs.io' }, - { property: 'og:image', content: 'https://www.greenwoodjs.io/assets/greenwood-logo-300w.png' }, - { property: 'og:description', content: META_DESCRIPTION }, - { rel: 'shortcut icon', href: FAVICON_HREF }, - { rel: 'icon', href: FAVICON_HREF } - ], + interpolateFrontmatter: true, plugins: [ ...greenwoodPluginGraphQL(), ...greenwoodPluginPolyfills(), diff --git a/packages/cli/src/lifecycles/config.js b/packages/cli/src/lifecycles/config.js index 36b357b7e..ddf8c7d62 100644 --- a/packages/cli/src/lifecycles/config.js +++ b/packages/cli/src/lifecycles/config.js @@ -42,8 +42,6 @@ const defaultConfig = { port: 8080, optimization: optimizations[0], interpolateFrontmatter: false, - title: 'My App', - meta: [], plugins: greenwoodPlugins, markdown: { plugins: [], settings: {} }, prerender: true, @@ -60,7 +58,7 @@ const readAndMergeConfig = async() => { if (fs.existsSync(path.join(process.cwd(), 'greenwood.config.js'))) { const userCfgFile = (await import(pathToFileURL(path.join(process.cwd(), 'greenwood.config.js')))).default; - const { workspace, devServer, title, markdown, meta, optimization, plugins, port, prerender, staticRouter, pagesDirectory, templatesDirectory, interpolateFrontmatter } = userCfgFile; + const { workspace, devServer, markdown, optimization, plugins, port, prerender, staticRouter, pagesDirectory, templatesDirectory, interpolateFrontmatter } = userCfgFile; // workspace validation if (workspace) { @@ -87,17 +85,6 @@ const readAndMergeConfig = async() => { } } - if (title) { - if (typeof title !== 'string') { - reject('Error: greenwood.config.js title must be a string'); - } - customConfig.title = title; - } - - if (meta && meta.length > 0) { - customConfig.meta = meta; - } - if (typeof optimization === 'string' && optimizations.indexOf(optimization.toLowerCase()) >= 0) { customConfig.optimization = optimization; } else if (optimization) { @@ -219,7 +206,7 @@ const readAndMergeConfig = async() => { } } } else { - // SPA should not prerender by default + // SPA should _not_ prerender unless if user has specified prerender should be true if (fs.existsSync(path.join(customConfig.workspace, 'index.html'))) { customConfig.prerender = false; } diff --git a/packages/cli/src/lifecycles/graph.js b/packages/cli/src/lifecycles/graph.js index de46062e7..0594b637e 100644 --- a/packages/cli/src/lifecycles/graph.js +++ b/packages/cli/src/lifecycles/graph.js @@ -39,7 +39,7 @@ const generateGraph = async (compilation) => { .replace(extension, '') .replace(/\\/g, '/'); let template = 'page'; - let title = ''; + let title = null; let imports = []; let label = ''; let id; @@ -51,7 +51,7 @@ const generateGraph = async (compilation) => { const { attributes } = fm(fileContents); template = attributes.template || 'page'; - title = attributes.title || compilation.config.title || ''; + title = attributes.title || title; id = attributes.label || filename.split(path.sep)[filename.split(path.sep).length - 1].replace(extension, ''); imports = attributes.imports || []; label = id.split('-') @@ -133,7 +133,6 @@ const generateGraph = async (compilation) => { .replace(extension, '') .replace(/\\/g, '/') .concat('/'); - title = `${compilation.config.title} - ${label}`; let ssrFrontmatter; filePath = route; @@ -243,7 +242,6 @@ const generateGraph = async (compilation) => { filename: '404.html', route: '/404/', path: '404.html', - title: 'Not Found', id: '404', label: 'Not Found' } diff --git a/packages/cli/src/plugins/resource/plugin-standard-html.js b/packages/cli/src/plugins/resource/plugin-standard-html.js index 7a6eef433..8c3830294 100644 --- a/packages/cli/src/plugins/resource/plugin-standard-html.js +++ b/packages/cli/src/plugins/resource/plugin-standard-html.js @@ -58,7 +58,7 @@ const getPageTemplate = (fullPath, templatesDir, template, contextPlugins = [], return contents; }; -const getAppTemplate = (contents, templatesDir, customImports = [], contextPlugins, enableHud) => { +const getAppTemplate = (contents, templatesDir, customImports = [], contextPlugins, enableHud, frontmatterTitle) => { const userAppTemplatePath = `${templatesDir}app.html`; const customAppTemplates = getCustomPageTemplates(contextPlugins, 'app'); @@ -98,6 +98,7 @@ const getAppTemplate = (contents, templatesDir, customImports = [], contextPlugi appTemplateContents = appTemplateContents.replace(/<\/page-outlet>/, ''); } else { + const appTitle = appRoot ? appRoot.querySelector('head title') : null; const body = root.querySelector('body') ? root.querySelector('body').innerHTML : ''; const headScripts = root.querySelectorAll('head script'); const headLinks = root.querySelectorAll('head link'); @@ -105,11 +106,27 @@ const getAppTemplate = (contents, templatesDir, customImports = [], contextPlugi const headStyles = root.querySelectorAll('head style'); const headTitle = root.querySelector('head title'); const appTemplateHeadContents = appRoot.querySelector('head').innerHTML; - + const hasInterpolatedFrontmatter = headTitle && headTitle.rawText.indexOf('${globalThis.page.title}') >= 0 + || appTitle && appTitle.rawText.indexOf('${globalThis.page.title}') >= 0; + const title = hasInterpolatedFrontmatter // favor frontmatter interpolation first + ? headTitle && headTitle.rawText + ? headTitle.rawText + : appTitle.rawText + : frontmatterTitle // otherwise, work in order of specificity from page -> page template -> app template + ? frontmatterTitle + : headTitle && headTitle.rawText + ? headTitle.rawText + : appTitle && appTitle.rawText + ? appTitle.rawText + : 'My App'; appTemplateContents = appTemplateContents.replace(/<\/page-outlet>/, body); - if (headTitle) { - appTemplateContents = appTemplateContents.replace(/(.*)<\/title>/, `<title>${headTitle.rawText}`); + if (title) { + if (!appTitle) { + appTemplateContents = appTemplateContents.replace('', '\n '); + } + + appTemplateContents = appTemplateContents.replace(/(.*)<\/title>/, `<title>${title}`); } // merge diff --git a/packages/cli/test/cases/build.config.title/greenwood.config.js b/packages/cli/test/cases/build.config.title/greenwood.config.js deleted file mode 100644 index 019f06f64..000000000 --- a/packages/cli/test/cases/build.config.title/greenwood.config.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - title: 'My Custom Greenwood App' -}; \ No newline at end of file diff --git a/packages/cli/test/cases/build.default.markdown/build.default.markdown.spec.js b/packages/cli/test/cases/build.default.markdown/build.default.markdown.spec.js index f6d8c6c27..8f224b75b 100644 --- a/packages/cli/test/cases/build.default.markdown/build.default.markdown.spec.js +++ b/packages/cli/test/cases/build.default.markdown/build.default.markdown.spec.js @@ -9,9 +9,7 @@ * greenwood build * * User Config - * { - * title: 'a title to test correct title merging' - * } + * None * * User Workspace * Greenwood default @@ -53,13 +51,6 @@ describe('Build Greenwood With: ', function() { before(async function() { dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'index.html')); }); - - it('should have custom tag in the <head>', function() { - const title = dom.window.document.querySelectorAll('head > title'); - - expect(title.length).to.be.equal(1); - expect(title[0].textContent).to.be.equal('this is the title from the config - this is a custom markdown title'); - }); it('should correctly rendering an <h3> tag', function() { const heading = dom.window.document.querySelectorAll('body h3'); diff --git a/packages/cli/test/cases/build.default.markdown/greenwood.config.js b/packages/cli/test/cases/build.default.markdown/greenwood.config.js deleted file mode 100644 index 2641c593f..000000000 --- a/packages/cli/test/cases/build.default.markdown/greenwood.config.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - title: 'this is the title from the config' -}; \ No newline at end of file diff --git a/packages/cli/test/cases/build.config.meta/build.config.meta.spec.js b/packages/cli/test/cases/build.default.meta/build.default.meta.spec.js similarity index 58% rename from packages/cli/test/cases/build.config.meta/build.config.meta.spec.js rename to packages/cli/test/cases/build.default.meta/build.default.meta.spec.js index f23c56a27..a161549de 100644 --- a/packages/cli/test/cases/build.config.meta/build.config.meta.spec.js +++ b/packages/cli/test/cases/build.default.meta/build.default.meta.spec.js @@ -1,24 +1,15 @@ /* * Use Case - * Run Greenwood with meta in Greenwood config and a default workspace with a nested route. + * Run Greenwood and tests for correct `<meta>` tag merging for pages and templates. * * User Result - * Should generate a bare bones Greenwood build with one nested About page w/ custom meta data. + * Should generate a bare bones Greenwood build with one nested About page with expected meta values. * * User Command * greenwood build * * User Config - * { - * title: 'My Custom Greenwood App', - * meta: [ - * { property: 'og:site', content: 'The Greenhouse I/O' }, - * { property: 'og:url', content: 'https://www.thegreenhouse.io' }, - * { name: 'twitter:site', content: '@thegreenhouseio' } - * { rel: 'shortcut icon', href: '/assets/images/favicon.ico' } - * { rel: 'icon', href: '/assets/images/favicon.ico' } - * ] - * } + * None * * User Workspace * Greenwood default w/ nested page @@ -28,9 +19,11 @@ * index.md * hello.md * index.md + * template/ + * app.html + * page.html */ import fs from 'fs'; -import greenwoodConfig from './greenwood.config.js'; import { JSDOM } from 'jsdom'; import path from 'path'; import chai from 'chai'; @@ -42,8 +35,7 @@ import { fileURLToPath, URL } from 'url'; const expect = chai.expect; describe('Build Greenwood With: ', function() { - const LABEL = 'Custom Meta Configuration and Nested Workspace'; - const meta = greenwoodConfig.meta; + const LABEL = 'Custom Meta Tags and Nested Workspace'; const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js'); const outputPath = fileURLToPath(new URL('.', import.meta.url)); let runner; @@ -56,14 +48,6 @@ describe('Build Greenwood With: ', function() { }); describe(LABEL, function() { - const metaFilter = (metaKey) => { - return meta.filter((item) => { - if (item.property === metaKey || item.name === metaKey || item.rel === metaKey) { - return item; - } - })[0]; - }; - before(async function() { await runner.setup(outputPath, getSetupFiles(outputPath)); await runner.runCommand(cliPath, 'build'); @@ -81,7 +65,7 @@ describe('Build Greenwood With: ', function() { it('should have a <title> tag in the <head>', function() { const title = dom.window.document.querySelector('head title').textContent; - expect(title).to.be.equal(greenwoodConfig.title); + expect(title).to.be.equal('My Custom Greenwood App'); }); it('should have the expected heading text within the index page in the public directory', function() { @@ -99,24 +83,21 @@ describe('Build Greenwood With: ', function() { }); it('should have a <meta> tag with custom og:site content in the <head>', function() { - const ogSiteMeta = metaFilter('og:site'); - const metaElement = dom.window.document.querySelector(`head meta[property="${ogSiteMeta.property}`); + const metaElement = dom.window.document.querySelector('head meta[property="og:site"'); - expect(metaElement.getAttribute('content')).to.be.equal(ogSiteMeta.content); + expect(metaElement.getAttribute('content')).to.be.equal('The Greenhouse I/O'); }); it('should have a <meta> tag with custom og:url content in the <head>', function() { - const ogUrlMeta = metaFilter('og:url'); - const metaElement = dom.window.document.querySelector(`head meta[property="${ogUrlMeta.property}"]`); + const metaElement = dom.window.document.querySelector('head meta[property="og:url"]'); - expect(metaElement.getAttribute('content')).to.be.equal(ogUrlMeta.content); + expect(metaElement.getAttribute('content')).to.be.equal('https://www.thegreenhouse.io'); }); it('should have a <meta> tag with custom twitter:site content in the <head>', function() { - const twitterSiteMeta = metaFilter('twitter:site'); - const metaElement = dom.window.document.querySelector(`head meta[name="${twitterSiteMeta.name}"]`); + const metaElement = dom.window.document.querySelector('head meta[property="twitter:site"]'); - expect(metaElement.getAttribute('content')).to.be.equal(twitterSiteMeta.content); + expect(metaElement.getAttribute('content')).to.be.equal('@thegreenhouseio'); }); }); @@ -132,24 +113,21 @@ describe('Build Greenwood With: ', function() { }); it('should have a <meta> tag with custom og:site content in the <head>', function() { - const ogSiteMeta = metaFilter('og:site'); - const metaElement = dom.window.document.querySelector(`head meta[property="${ogSiteMeta.property}`); + const metaElement = dom.window.document.querySelector('head meta[property="og:site"'); - expect(metaElement.getAttribute('content')).to.be.equal(ogSiteMeta.content); + expect(metaElement.getAttribute('content')).to.be.equal('The Greenhouse I/O'); }); - it('should have custom config <meta> tag with og:url property in the <head>', function() { - const ogUrlMeta = metaFilter('og:url'); - const metaElement = dom.window.document.querySelector(`head meta[property="${ogUrlMeta.property}"]`); + it('should have a <meta> tag with custom og:url content in the <head>', function() { + const metaElement = dom.window.document.querySelector('head meta[property="og:url"]'); - expect(metaElement.getAttribute('content')).to.be.equal(`${ogUrlMeta.content}/about/`); + expect(metaElement.getAttribute('content')).to.be.equal('https://www.thegreenhouse.io'); }); - it('should have our custom config <meta> tag with twitter:site name in the <head>', function() { - const twitterSiteMeta = metaFilter('twitter:site'); - const metaElement = dom.window.document.querySelector(`head meta[name="${twitterSiteMeta.name}"]`); + it('should have a <meta> tag with custom twitter:site content in the <head>', function() { + const metaElement = dom.window.document.querySelector('head meta[property="twitter:site"]'); - expect(metaElement.getAttribute('content')).to.be.equal(twitterSiteMeta.content); + expect(metaElement.getAttribute('content')).to.be.equal('@thegreenhouseio'); }); }); @@ -160,18 +138,16 @@ describe('Build Greenwood With: ', function() { dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, './index.html')); }); - it('should have our custom config <link> tag with shortcut icon in the <head>', function() { - const shortcutIconLink = metaFilter('shortcut icon'); - const linkElement = dom.window.document.querySelector(`head link[rel="${shortcutIconLink.rel}"]`); + it('should have our custom config <link> tag with shortcut icon in the <head> for the index page', function() { + const linkElement = dom.window.document.querySelector('head link[rel="shortcut icon"]'); - expect(linkElement.getAttribute('href')).to.be.equal(shortcutIconLink.href); + expect(linkElement.getAttribute('href')).to.be.equal('/assets/images/favicon.ico'); }); - it('should have our custom config <link> tag with icon in the <head>', function() { - const iconLink = metaFilter('icon'); - const linkElement = dom.window.document.querySelector(`head link[rel="${iconLink.rel}"]`); + it('should have our custom config <link> tag with icon in the <head> for the index page', function() { + const linkElement = dom.window.document.querySelector('head link[rel="icon"]'); - expect(linkElement.getAttribute('href')).to.be.equal(iconLink.href); + expect(linkElement.getAttribute('href')).to.be.equal('/assets/images/favicon.ico'); }); }); }); diff --git a/packages/cli/test/cases/build.config.meta/src/pages/about/index.md b/packages/cli/test/cases/build.default.meta/src/pages/about/index.md similarity index 100% rename from packages/cli/test/cases/build.config.meta/src/pages/about/index.md rename to packages/cli/test/cases/build.default.meta/src/pages/about/index.md diff --git a/packages/cli/test/cases/build.config.meta/src/pages/hello.md b/packages/cli/test/cases/build.default.meta/src/pages/hello.md similarity index 100% rename from packages/cli/test/cases/build.config.meta/src/pages/hello.md rename to packages/cli/test/cases/build.default.meta/src/pages/hello.md diff --git a/packages/cli/test/cases/build.config.meta/src/pages/index.md b/packages/cli/test/cases/build.default.meta/src/pages/index.md similarity index 100% rename from packages/cli/test/cases/build.config.meta/src/pages/index.md rename to packages/cli/test/cases/build.default.meta/src/pages/index.md diff --git a/packages/cli/test/cases/build.default.meta/src/templates/page.html b/packages/cli/test/cases/build.default.meta/src/templates/page.html new file mode 100644 index 000000000..7e18be785 --- /dev/null +++ b/packages/cli/test/cases/build.default.meta/src/templates/page.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> + <head> + <title>My Custom Greenwood App + + + + + + + + + + \ No newline at end of file diff --git a/packages/cli/test/cases/build.default.spa/build.default.spa.spec.js b/packages/cli/test/cases/build.default.spa/build.default.spa.spec.js index 6f941a02f..f99381ca8 100644 --- a/packages/cli/test/cases/build.default.spa/build.default.spa.spec.js +++ b/packages/cli/test/cases/build.default.spa/build.default.spa.spec.js @@ -9,13 +9,16 @@ * greenwood build * * User Config - * {} + * None * * User Workspace * Greenwood default w/ single index.html file * src/ * components/ * footer.js + * routes/ + * about.js + * home.js * index.js * index.html */ diff --git a/packages/cli/test/cases/build.default.spa/src/index.html b/packages/cli/test/cases/build.default.spa/src/index.html index ff39b20ac..876ebe7d2 100644 --- a/packages/cli/test/cases/build.default.spa/src/index.html +++ b/packages/cli/test/cases/build.default.spa/src/index.html @@ -3,7 +3,6 @@ My Super SPA - diff --git a/packages/cli/test/cases/build.default.ssr/build.default.ssr.spec.js b/packages/cli/test/cases/build.default.ssr/build.default.ssr.spec.js index 14891e712..b733325c3 100644 --- a/packages/cli/test/cases/build.default.ssr/build.default.ssr.spec.js +++ b/packages/cli/test/cases/build.default.ssr/build.default.ssr.spec.js @@ -221,7 +221,7 @@ describe('Build Greenwood With: ', function() { const title = dom.window.document.querySelectorAll('head > title'); expect(title.length).to.equal(1); - expect(title[0].textContent).to.equal('My App - /artists/'); + expect(title[0].textContent).to.equal('/artists/'); }); it('should have custom metadata in the ', function() { @@ -229,7 +229,7 @@ describe('Build Greenwood With: ', function() { .filter((tag) => tag.getAttribute('name') === 'description'); expect(metaDescription.length).to.equal(1); - expect(metaDescription[0].getAttribute('content')).to.equal('My App - /artists/ (this was generated server side!!!)'); + expect(metaDescription[0].getAttribute('content')).to.equal('/artists/ (this was generated server side!!!)'); }); it('should be a part of graph.json', function() { diff --git a/packages/cli/test/cases/build.default.ssr/src/pages/artists.js b/packages/cli/test/cases/build.default.ssr/src/pages/artists.js index 75d9970e7..6e43ccfa1 100644 --- a/packages/cli/test/cases/build.default.ssr/src/pages/artists.js +++ b/packages/cli/test/cases/build.default.ssr/src/pages/artists.js @@ -4,7 +4,8 @@ async function getTemplate(compilation, route) { return ` - + ${route} + - diff --git a/packages/cli/test/cases/build.config.title/build.config.title.spec.js b/packages/cli/test/cases/build.default.title/build.default.title.spec.js similarity index 80% rename from packages/cli/test/cases/build.config.title/build.config.title.spec.js rename to packages/cli/test/cases/build.default.title/build.default.title.spec.js index 29ea07540..4e131ea9c 100644 --- a/packages/cli/test/cases/build.config.title/build.config.title.spec.js +++ b/packages/cli/test/cases/build.default.title/build.default.title.spec.js @@ -1,17 +1,15 @@ /* * Use Case - * Run Greenwood with string title in config and default workspace. + * Run Greenwood and tests for correct `` tag merging for pages and templates. * * User Result - * Should generate a bare bones Greenwood build. (same as build.default.spec.js) with custom title in header + * Should generate a bare bones Greenwood build with expected <title> values. * * User Command * greenwood build * * User Config - * { - * title: 'My Custom Greenwood App' - * } + * None * * User Workspace * Greenwood default @@ -19,9 +17,10 @@ * pages/ * index.md * hello.md + * templates/ + * page.html */ import fs from 'fs'; -import greenwoodConfig from './greenwood.config.js'; import { JSDOM } from 'jsdom'; import path from 'path'; import chai from 'chai'; @@ -30,11 +29,10 @@ import { getSetupFiles, getOutputTeardownFiles } from '../../../../../test/utils import { Runner } from 'gallinago'; import { fileURLToPath, URL } from 'url'; -const configTitle = greenwoodConfig.title; const expect = chai.expect; describe('Build Greenwood With: ', function() { - const LABEL = 'Custom Title Configuration and Default Workspace'; + const LABEL = 'Custom Title Tag and Default Workspace'; const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js'); const outputPath = fileURLToPath(new URL('.', import.meta.url)); let runner; @@ -65,12 +63,11 @@ describe('Build Greenwood With: ', function() { it('should have our custom config <title> tag in the <head>', function() { const title = dom.window.document.querySelector('head title').textContent; - expect(title).to.be.equal(configTitle); + expect(title).to.be.equal('My Custom Greenwood App'); }); }); describe('Custom Front-Matter Title', function() { - const pageTitle = 'About Page'; let dom; before(async function() { @@ -84,7 +81,7 @@ describe('Build Greenwood With: ', function() { it('should have a overridden meta <title> tag in the <head> using markdown front-matter', function() { const title = dom.window.document.querySelector('head title').textContent; - expect(title).to.be.equal(`${configTitle} - ${pageTitle}`); + expect(title).to.be.equal('About Page'); }); }); }); diff --git a/packages/cli/test/cases/build.config.title/src/pages/about.md b/packages/cli/test/cases/build.default.title/src/pages/about.md similarity index 100% rename from packages/cli/test/cases/build.config.title/src/pages/about.md rename to packages/cli/test/cases/build.default.title/src/pages/about.md diff --git a/packages/cli/test/cases/build.config.title/src/pages/index.md b/packages/cli/test/cases/build.default.title/src/pages/index.md similarity index 100% rename from packages/cli/test/cases/build.config.title/src/pages/index.md rename to packages/cli/test/cases/build.default.title/src/pages/index.md diff --git a/packages/cli/test/cases/build.default.title/src/templates/page.html b/packages/cli/test/cases/build.default.title/src/templates/page.html new file mode 100644 index 000000000..2d4118882 --- /dev/null +++ b/packages/cli/test/cases/build.default.title/src/templates/page.html @@ -0,0 +1,5 @@ +<html> + <head> + <title>My Custom Greenwood App + + \ No newline at end of file diff --git a/packages/cli/test/cases/build.default.workspace-nested/src/pages/index.html b/packages/cli/test/cases/build.default.workspace-nested/src/pages/index.html index 90598b163..6c2ea7b46 100644 --- a/packages/cli/test/cases/build.default.workspace-nested/src/pages/index.html +++ b/packages/cli/test/cases/build.default.workspace-nested/src/pages/index.html @@ -1,7 +1,4 @@ - - -

This is the home page built by Greenwood. Make your own pages in src/pages/index.js!

diff --git a/packages/cli/test/cases/build.default.workspace-template-app/src/templates/app.html b/packages/cli/test/cases/build.default.workspace-template-app/src/templates/app.html index 6d3315077..f4ae70595 100644 --- a/packages/cli/test/cases/build.default.workspace-template-app/src/templates/app.html +++ b/packages/cli/test/cases/build.default.workspace-template-app/src/templates/app.html @@ -2,6 +2,7 @@ + My App diff --git a/packages/cli/test/cases/build.default.workspace-templates-relative-paths/src/templates/app.html b/packages/cli/test/cases/build.default.workspace-templates-relative-paths/src/templates/app.html index be96376bb..d9408518a 100644 --- a/packages/cli/test/cases/build.default.workspace-templates-relative-paths/src/templates/app.html +++ b/packages/cli/test/cases/build.default.workspace-templates-relative-paths/src/templates/app.html @@ -1,7 +1,7 @@ - + My App diff --git a/packages/cli/test/cases/build.plugins.context/fixtures/layouts/app.html b/packages/cli/test/cases/build.plugins.context/fixtures/layouts/app.html index 77e6480e8..69828b3cb 100644 --- a/packages/cli/test/cases/build.plugins.context/fixtures/layouts/app.html +++ b/packages/cli/test/cases/build.plugins.context/fixtures/layouts/app.html @@ -2,6 +2,7 @@ + My Theme Pack diff --git a/packages/cli/test/cases/develop.plugins.context/fixtures/layouts/app.html b/packages/cli/test/cases/develop.plugins.context/fixtures/layouts/app.html index 77e6480e8..e1170c3c9 100644 --- a/packages/cli/test/cases/develop.plugins.context/fixtures/layouts/app.html +++ b/packages/cli/test/cases/develop.plugins.context/fixtures/layouts/app.html @@ -2,6 +2,7 @@ + My App diff --git a/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js b/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js index 538a063ac..4dbfddc19 100644 --- a/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js +++ b/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js @@ -202,7 +202,7 @@ describe('Develop Greenwood With: ', function() { const title = dom.window.document.querySelectorAll('head > title'); expect(title.length).to.equal(1); - expect(title[0].textContent).to.equal('My App - /artists/'); + expect(title[0].textContent).to.equal('/artists/'); }); it('should have custom metadata in the ', function() { @@ -210,7 +210,7 @@ describe('Develop Greenwood With: ', function() { .filter((tag) => tag.getAttribute('name') === 'description'); expect(metaDescription.length).to.equal(1); - expect(metaDescription[0].getAttribute('content')).to.equal('My App - /artists/ (this was generated server side!!!)'); + expect(metaDescription[0].getAttribute('content')).to.equal('/artists/ (this was generated server side!!!)'); }); it('should be a part of graph.json', function() { diff --git a/packages/cli/test/cases/develop.ssr/src/pages/artists.js b/packages/cli/test/cases/develop.ssr/src/pages/artists.js index cb31b181d..cd1884f91 100644 --- a/packages/cli/test/cases/develop.ssr/src/pages/artists.js +++ b/packages/cli/test/cases/develop.ssr/src/pages/artists.js @@ -4,7 +4,7 @@ async function getTemplate(compilation, route) { return ` - + diff --git a/packages/init/src/template/greenwood.config.js b/packages/init/src/template/greenwood.config.js deleted file mode 100644 index 6152def9a..000000000 --- a/packages/init/src/template/greenwood.config.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - title: 'My Project' -}; \ No newline at end of file diff --git a/packages/init/test/cases/develop.default/develop.default.spec.js b/packages/init/test/cases/develop.default/develop.default.spec.js index c6fc045aa..2ccd1dda2 100644 --- a/packages/init/test/cases/develop.default/develop.default.spec.js +++ b/packages/init/test/cases/develop.default/develop.default.spec.js @@ -133,7 +133,7 @@ xdescribe('Scaffold Greenwood and Run Develop command: ', function() { it('should display My Project title', function(done) { const title = dom.window.document.querySelector('head > title'); - expect(title.textContent).to.equal('My Project'); + expect(title.textContent).to.equal('My App'); done(); }); diff --git a/packages/init/test/cases/init.default/init.default.spec.js b/packages/init/test/cases/init.default/init.default.spec.js index fd69e4b91..20f86857f 100644 --- a/packages/init/test/cases/init.default/init.default.spec.js +++ b/packages/init/test/cases/init.default/init.default.spec.js @@ -15,7 +15,7 @@ import chai from 'chai'; import fs from 'fs'; import path from 'path'; import { Runner } from 'gallinago'; -import { fileURLToPath, pathToFileURL, URL } from 'url'; +import { fileURLToPath, URL } from 'url'; const expect = chai.expect; @@ -45,10 +45,6 @@ describe('Scaffold Greenwood With Default Template: ', function() { expect(fs.existsSync(path.join(outputPath, 'src', 'pages'))).to.be.true; }); - it('should generate a greenwood.config.js file', function() { - expect(fs.existsSync(path.join(outputPath, 'greenwood.config.js'))).to.be.true; - }); - it('should generate a .gitignore file', function() { expect(fs.existsSync(path.join(outputPath, '.gitignore'))).to.be.true; }); @@ -92,18 +88,6 @@ describe('Scaffold Greenwood With Default Template: ', function() { }); }); - describe('initial greenwood.config.js contents', function() { - let greenwoodConfig; - - before(async function() { - greenwoodConfig = (await import(pathToFileURL(path.join(outputPath, './greenwood.config.js')))).default; - }); - - it('should have the correct title configuration', function() { - expect(greenwoodConfig.title).to.equal('My Project'); - }); - }); - describe('initial page contents', function() { it('should have the correct contents for src/pages.index.md', function() { const pageContents = fs.readFileSync(path.join(outputPath, 'src/pages/index.md'), 'utf-8'); diff --git a/packages/plugin-graphql/src/queries/config.gql b/packages/plugin-graphql/src/queries/config.gql index 7d2580bc6..797d13ac4 100644 --- a/packages/plugin-graphql/src/queries/config.gql +++ b/packages/plugin-graphql/src/queries/config.gql @@ -3,18 +3,9 @@ query { devServer { port }, - meta { - name, - rel, - content, - property, - value, - href - }, staticRouter, optimization, prerender, - title, workspace } } \ No newline at end of file diff --git a/packages/plugin-graphql/src/schema/config.js b/packages/plugin-graphql/src/schema/config.js index 5f28f7a67..d7400fdc1 100644 --- a/packages/plugin-graphql/src/schema/config.js +++ b/packages/plugin-graphql/src/schema/config.js @@ -10,22 +10,11 @@ const configTypeDefs = gql` port: Int } - type Meta { - name: String, - value: String, - content: String, - rel: String, - property: String, - href: String - } - type Config { devServer: DevServer, - meta: [Meta], staticRouter: Boolean, optimization: String, prerender: Boolean, - title: String, workspace: String } diff --git a/packages/plugin-graphql/test/cases/query-config/greenwood.config.js b/packages/plugin-graphql/test/cases/query-config/greenwood.config.js index 165689cf4..d74f1de5e 100644 --- a/packages/plugin-graphql/test/cases/query-config/greenwood.config.js +++ b/packages/plugin-graphql/test/cases/query-config/greenwood.config.js @@ -1,7 +1,6 @@ import { greenwoodPluginGraphQL } from '../../../src/index.js'; export default { - title: 'GraphQL ConfigQuery Spec', plugins: [ ...greenwoodPluginGraphQL() diff --git a/packages/plugin-graphql/test/cases/query-config/query-config.spec.js b/packages/plugin-graphql/test/cases/query-config/query-config.spec.js index ce3e4979c..d4d5e8917 100644 --- a/packages/plugin-graphql/test/cases/query-config/query-config.spec.js +++ b/packages/plugin-graphql/test/cases/query-config/query-config.spec.js @@ -20,7 +20,6 @@ */ import chai from 'chai'; import fs from 'fs'; -import greenwoodConfig from './greenwood.config.js'; import glob from 'glob-promise'; import { JSDOM } from 'jsdom'; import path from 'path'; @@ -67,7 +66,7 @@ describe('Build Greenwood With: ', function() { runSmokeTest(['public', 'index'], LABEL); - describe('displaying config title in the footer using ConfigQuery', function() { + describe('displaying config optimization in the footer using ConfigQuery', function() { let dom; before(async function() { @@ -77,7 +76,7 @@ describe('Build Greenwood With: ', function() { it('should have a