# all files / api/transformers/ component-transformer.js

100% Statements 19/19
100% Branches 4/4
100% Functions 7/7
100% Lines 3/3
1 branch Ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17

    1

    6

     'use strict';

    // Dependencies:
    import { camel, pascal } from 'change-case';
    import transforms from './transforms';

    export default function componentTransformer (file, options) {
        let { oldName, newName, oldPath, newPath } = options;

        return transforms.transformIdentifiers(file, pascal(oldName), pascal(newName))
        .then(() => transforms.transformIdentifiers(file, camel(oldName), camel(newName)))
        .then(() => transforms.transformMetadata(file, null, oldName, newName))
        .then(() => transforms.transformReferences('components', oldPath, newPath, oldName, newName))
        .then(() => transforms.transformReferenceIdentifiers(oldPath, pascal(oldName), pascal(newName)))
        .then(() => transforms.transformReferenceIdentifiers(oldPath, camel(oldName), camel(newName)));
    }