diff --git a/.eslintignore b/.eslintignore index 8e786af06..8085b7f92 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,5 +3,6 @@ **/node_modules/** !.eslintrc.cjs !.mocharc.js +packages/init/src/template/src/**/*.js packages/plugin-babel/test/cases/**/*main.js TODO.md \ No newline at end of file diff --git a/packages/init/src/index.js b/packages/init/src/index.js index 61e3164a9..9cdd3eea6 100755 --- a/packages/init/src/index.js +++ b/packages/init/src/index.js @@ -257,7 +257,7 @@ const run = async () => { } // map all the template files and copy them to the current working directory - console.log('Initialzing project with files...'); + console.log('Initializing project with files...'); await srcInit(); console.log('Creating manifest (package.json)...'); diff --git a/packages/init/src/template/src/components/logo/logo.js b/packages/init/src/template/src/components/logo/logo.js new file mode 100644 index 000000000..73424b2fc --- /dev/null +++ b/packages/init/src/template/src/components/logo/logo.js @@ -0,0 +1,114 @@ +const template = document.createElement('template'); + +template.innerHTML = ` + +`; + +class Logo extends HTMLElement { + connectedCallback() { + if (!this.shadowRoot) { + this.attachShadow({ mode: 'open' }); + this.shadowRoot.appendChild(template.content.cloneNode(true)); + } + } +} + +customElements.define('x-logo', Logo); \ No newline at end of file diff --git a/packages/init/src/template/src/favicon.ico b/packages/init/src/template/src/favicon.ico new file mode 100644 index 000000000..8e11c4784 Binary files /dev/null and b/packages/init/src/template/src/favicon.ico differ diff --git a/packages/init/src/template/src/pages/index.html b/packages/init/src/template/src/pages/index.html new file mode 100644 index 000000000..908ffcce6 --- /dev/null +++ b/packages/init/src/template/src/pages/index.html @@ -0,0 +1,107 @@ + + + + Greenwood + + + + + + + + + + + + + + +
+ +

Welcome to Greenwood!

+ + + +

Edit src/pages/index.html to start making changes

+ +
+
+

Getting Started

+

Follow our guide on learning Greenwood for the first time.

+
+ +
+

Docs

+

Learn about Greenwood's features and capabilities.

+
+ +
+

Guides

+

Walkthroughs on ways to build and deploy with Greenwood.

+
+ +
+

Community

+

Come join us on GitHub and Discord to get involved.

+
+
+ +
+ + \ No newline at end of file diff --git a/packages/init/src/template/src/pages/index.md b/packages/init/src/template/src/pages/index.md deleted file mode 100644 index 6b343b58c..000000000 --- a/packages/init/src/template/src/pages/index.md +++ /dev/null @@ -1 +0,0 @@ -## My Project \ No newline at end of file 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 ece4a86de..d83b9a6b4 100644 --- a/packages/init/test/cases/init.default/init.default.spec.js +++ b/packages/init/test/cases/init.default/init.default.spec.js @@ -35,6 +35,7 @@ describe('Scaffold Greenwood With Default Template: ', function() { before(async function() { await fs.promises.mkdir(outputPath); + runner.setup(outputPath); runner.runCommand(initPath); }); @@ -88,11 +89,27 @@ describe('Scaffold Greenwood With Default Template: ', function() { }); }); - 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'); + describe('home page contents', function() { + let pageContents; + + before(async function() { + pageContents = fs.readFileSync(path.join(outputPath, 'src/pages/index.html'), 'utf-8'); + }); + + it('should have the expected getting started prompt', function() { + expect(pageContents).to.contain('

Edit src/pages/index.html to start making changes

'); + }); + + it('should have the card headings for src/pages/index.html', function() { + expect(pageContents).to.contain('

Getting Started

'); + expect(pageContents).to.contain('

Docs

'); + expect(pageContents).to.contain('

Guides

'); + expect(pageContents).to.contain('

Community

'); + }); - expect(pageContents).to.equal('## My Project'); + it('should have a '); + expect(pageContents).to.contain(''); }); }); });