Node_modules folder does not go up to svn

Asked

Viewed 124 times

1

I have this (original) dependency file numeral which is in the folder node_modules -> numeral ->locales -> pt-br

// numeral.js locale configuration
// locale : portuguese brazil (pt-br)
// author : Ramiro Varandas Jr : https://github.com/ramirovjr

(function (global, factory) {
    if (typeof define === 'function' && define.amd) {
        define(['../numeral'], factory);
    } else if (typeof module === 'object' && module.exports) {
        factory(require('../numeral'));
    } else {
        factory(global.numeral);
    }
}(this, function (numeral) {
    numeral.register('locale', 'pt-br', {
        delimiters: {
            thousands: '.',
            decimal: ','
        },
        abbreviations: {
            thousand:"mil",
            million:"milhões",
            billion:"b",
            trillion:"t"
        },
        ordinal: function (number) {
            return 'º';
        },
        currency: {
            symbol: 'R$'
        }
    });
}));

but I need to change it to

abbreviations: {
            thousand: 'mil',
            million: 'mi',
            billion: 'bi',
            trillion: 'tri'
        },

So far so good, but when I climb it to the svn as it does not rise the folder node_modules it does not move my change up, and there in Jenkis when the scripts to run the npm install project are executed.. build.. etc... and send to the server it lowers the original dependency and my numbers in the system are not formatted.

Attempts: I tried uploading the folder node_modules (I could not, maybe it is a solution but I could not so if someone can show me), I tried to access abbreviations and change it in a ts that always runs (but I did not even know how to access it).

I have a solution, that would put the folder numeral outside the node_modules, but I do not want this because if I need to change another...and...another turns a snowball.

So here’s the question: How to solve this problem of mine that by altering a dependency that is in node_modules she will not be "saved" because node_modules does not go up to the repository?

  • I think your problem is not svn, but npm that insists on overwriting your modified file with one that it downloads from the internet.

  • actually,when it arrives in Jenkins o npm ta typing, because if I open the repository in svn the folder node_modules is not even there, that is, it is not going up... I searched in several places if there is something disabling it because it is too big but I did not find :/

  • Like I said, I can get her into my project, but if this happens in other dependencies, she’ll turn into a snowball. The best way would be to get access to abbreviations on some ts that always runs on my project, but I have no idea what it’s going to be like. If anyone knew, I’d be happy to

1 answer

1


It is not advised to edit something within node_modules.

In the documentation of [http://numeraljs.com/] has the "#Locales" solution you need.

The stretch below I removed from there. I hope it helps.

// load a locale
numeral.register('locale', 'fr', {
    delimiters: {
        thousands: ' ',
        decimal: ','
    },
    abbreviations: {
        thousand: 'k',
        million: 'm',
        billion: 'b',
        trillion: 't'
    },
    ordinal : function (number) {
        return number === 1 ? 'er' : 'ème';
    },
    currency: {
        symbol: '€'
    }
});

// switch between locales
numeral.locale('fr');

As I am not Fluent in Every locale on the Planet, Please Feel free to create locale files of your Own by submitting a pull request. Don’t Forget to create Both the locale file (example: locales/fr.js) and the locale test (example: tests/locales/fr.js). Thanks for helping out.

  • it does not accept this creation, because it does not consist of a new location but a format to suit my project

  • From what I noticed you can create a "BR-custom" Location that suits you and uses it as you need.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.