lion/packages-node/babel-plugin-extend-docs/test-node/helpers.js

146 lines
3.1 KiB
JavaScript

// eslint-disable-next-line import/no-unresolved
const babel = require('@babel/core');
const babelPluginExtendDocs = require('../src/babelPluginExtendDocs.js');
function executeBabel(input, options) {
const result = babel.transform(input, {
plugins: [[babelPluginExtendDocs, options]],
});
return result.code;
}
const baseConfig = {
changes: [
{
description: 'LionInput',
variable: {
from: 'LionInput',
to: 'WolfInput',
paths: [
{
from: './index.js',
to: './index.js',
},
{
from: './src/LionInput.js',
to: './index.js',
},
{
from: '@lion/input',
to: './index.js',
},
],
},
tag: {
from: 'lion-input',
to: 'wolf-input',
paths: [
{
from: './lion-input.js',
to: './__element-definitions/wolf-input.js',
},
{
from: '@lion/input/define',
to: './__element-definitions/wolf-input.js',
},
],
},
},
{
description: 'LionButton',
variable: {
from: 'LionButton',
to: 'WolfButton',
paths: [
{
from: './index.js',
to: './index.js',
},
{
from: './src/LionButton.js',
to: './index.js',
},
{
from: '@lion/button',
to: './index.js',
},
],
},
tag: {
from: 'lion-button',
to: 'wolf-button',
paths: [
{
from: './lion-button.js',
to: './__element-definitions/wolf-button.js',
},
{
from: '@lion/button/define',
to: './__element-definitions/wolf-button.js',
},
],
},
},
{
description: 'LionCheckbox',
variable: {
from: 'LionCheckbox',
to: 'WolfCheckbox',
paths: [
{
from: './index.js',
to: './index.js',
},
{
from: './src/LionCheckbox.js',
to: './index.js',
},
{
from: '@lion/checkbox-group',
to: './index.js',
},
],
},
tag: {
from: 'lion-checkbox',
to: 'wolf-checkbox',
paths: [
{
from: './lion-checkbox.js',
to: './__element-definitions/wolf-checkbox.js',
},
{
from: '@lion/checkbox-group/lion-checkbox.js',
to: './__element-definitions/wolf-checkbox.js',
},
],
},
},
{
description: 'localize',
variable: {
from: 'localize',
to: 'localize',
paths: [
{
from: './index.js',
to: './localize.js',
},
{
from: './src/localize.js',
to: './localize.js',
},
{
from: '@lion/localize',
to: './localize.js',
},
],
},
},
],
};
module.exports = {
executeBabel,
baseConfig,
};