Skip to content

Commit

Permalink
feat(babel): installed the babel plugin for babel-dialect projects
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed Nov 24, 2021
1 parent 0d44de0 commit c3415e1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dialect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import any from '@travi/any';
import scaffoldDialect from './dialect';

suite('dialect', () => {
test('that babel details are handled', async () => {
const {devDependencies} = await scaffoldDialect({dialect: dialects.BABEL});

assert.deepEqual(devDependencies, ['@rollup/plugin-babel']);
});

test('that typescript details are handled', async () => {
const {devDependencies, vcsIgnore} = await scaffoldDialect({dialect: dialects.TYPESCRIPT});

Expand Down
2 changes: 2 additions & 0 deletions src/dialect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {dialects} from '@form8ion/javascript-core';

export default function ({dialect}) {
switch (dialect) {
case dialects.BABEL:
return {devDependencies: ['@rollup/plugin-babel']};
case dialects.TYPESCRIPT:
return {
devDependencies: ['@rollup/plugin-typescript'],
Expand Down
6 changes: 6 additions & 0 deletions test/integration/features/babel.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: Scaffold for a babel dialect project

Scenario: project dialect is TypeScript
Given the project dialect is "babel"
When the project is scaffolded
Then dependencies are installed for the "babel" dialect
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Then('dependencies are installed for the {string} dialect', async function (dial
if (dialects.TYPESCRIPT === dialect) {
assert.include(devDependencies, '@rollup/plugin-typescript');
}

if (dialects.BABEL === dialect) {
assert.include(devDependencies, '@rollup/plugin-babel');
}
});

0 comments on commit c3415e1

Please sign in to comment.