diff --git a/package-lock.json b/package-lock.json index 053c568..cebce07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "plugin-devkit", - "version": "1.0.3", + "version": "1.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "plugin-devkit", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "dependencies": { "@oclif/core": "^4", diff --git a/test/commands/theme/component/dev.test.ts b/test/commands/theme/component/dev.test.ts index da6fa5b..82cf391 100644 --- a/test/commands/theme/component/dev.test.ts +++ b/test/commands/theme/component/dev.test.ts @@ -37,6 +37,8 @@ describe('theme component dev', () => { await runCommand(['theme', 'component', 'dev', '-t', testThemePath]) expect(fs.existsSync(path.join(testCollectionPath, '.dev', 'sections', 'with-setup.liquid'))).to.be.true expect(fs.existsSync(path.join(testCollectionPath, '.dev', 'templates', 'index.with-setup.liquid'))).to.be.true + expect(fs.existsSync(path.join(testCollectionPath, '.dev', 'blocks', 'with-setup.liquid'))).to.be.true + expect(fs.existsSync(path.join(testCollectionPath, '.dev', 'blocks', '_with-setup.liquid'))).to.be.true }) it('merges the settings_schema.json setup files', async () => { diff --git a/test/commands/theme/component/map.test.ts b/test/commands/theme/component/map.test.ts index 7b3c040..6d34946 100644 --- a/test/commands/theme/component/map.test.ts +++ b/test/commands/theme/component/map.test.ts @@ -96,6 +96,18 @@ describe('theme component map', () => { expect(data.files.snippets['child.liquid']).to.equal('@archetype-themes/test-collection') }) + it('adds entries for blocks', async () => { + const beforeData = JSON.parse(fs.readFileSync(path.join(testThemePath, 'component.manifest.json'), 'utf8')) + expect(beforeData.files.snippets['section-with-block-snippet.liquid']).to.be.undefined + expect(beforeData.files.snippets['section-with-block-snippet.block.liquid']).to.be.undefined + + await runCommand(['theme', 'component', 'map', testThemePath]) + + const data = JSON.parse(fs.readFileSync(path.join(testThemePath, 'component.manifest.json'), 'utf8')) + expect(data.files.snippets['section-with-block-snippet.liquid']).to.equal('@archetype-themes/test-collection') + expect(data.files.snippets['section-with-block-snippet.block.liquid']).to.equal('@archetype-themes/test-collection') + }) + it('throws a warning if there is a potential conflict with an entry in the current collection', async () => { const {stdout} = await runCommand(['theme', 'component', 'map', testThemePath]) const data = JSON.parse(fs.readFileSync(path.join(testThemePath, 'component.manifest.json'), 'utf8')) diff --git a/test/fixtures/collection/components/section-with-block-snippet/section-with-block-snippet.liquid b/test/fixtures/collection/components/section-with-block-snippet/section-with-block-snippet.liquid new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/collection/components/section-with-block-snippet/snippets/section-with-block-snippet.block.liquid b/test/fixtures/collection/components/section-with-block-snippet/snippets/section-with-block-snippet.block.liquid new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/collection/components/with-setup/setup/blocks/_with-setup.liquid b/test/fixtures/collection/components/with-setup/setup/blocks/_with-setup.liquid new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/collection/components/with-setup/setup/blocks/with-setup.liquid b/test/fixtures/collection/components/with-setup/setup/blocks/with-setup.liquid new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/theme/blocks/section-with-block-snippet.block.liquid b/test/fixtures/theme/blocks/section-with-block-snippet.block.liquid new file mode 100644 index 0000000..cb55000 --- /dev/null +++ b/test/fixtures/theme/blocks/section-with-block-snippet.block.liquid @@ -0,0 +1 @@ +{% render 'section-with-block-snippet.block' %} \ No newline at end of file diff --git a/test/fixtures/theme/sections/section-with-block-snippet.liquid b/test/fixtures/theme/sections/section-with-block-snippet.liquid new file mode 100644 index 0000000..49a4a77 --- /dev/null +++ b/test/fixtures/theme/sections/section-with-block-snippet.liquid @@ -0,0 +1 @@ +{% render 'section-with-block-snippet' %} \ No newline at end of file