Frage

I am attempting to optimise a project using r.js, with source code held in subversion. I'm getting the following error:

> node r.js -o generic-profile.js
> Error: Error: EPERM, operation not permitted 'C:\xxx\GUI\generic\.svn\entries'
                at Object.fs.unlinkSync (fs.js:760:18)

I believe the problem is that r.js is attempting to copy the .svn directories from the source folders to the build folders.

Is there a way to exclude .svn directories when running r.js? Can I add something to my build profile, for example?

Here is what my build profile currently look like:

({
    "appDir": "../src/generic/",
    "baseUrl": ".",
    "dir": "../generic/",
    "include": ["../vendor/require",
                "../vendor/text",
                "../vendor/i18n"],
    "optimize": "uglify2",
    "modules": [
        {
            name: "app"
        }
    ],
    "mainConfigFile": "generic-config.js"
})

Update

Since reading Louis's excellent answer, it's clear that this is not an issue with subversion, but a poorly-configured build profile. I've done some further reading on how to set up a build profile, and this example helped immensely.

If you're having a similar problem, this may help.

War es hilfreich?

Lösung

By default r.js already excludes from processing directories that begin with a period. The setting is fileExclusionRegExp and the default value is /^\./ so .svn will be skipped. (Looking at the code of r.js I see that fileExclusionRegExp matches against the basename of each file.)

The error you are seeing is consistent with your input directory coinciding with your output. You do not set keepBuildDir to true, so your output directory is being removed. Change your dir to build somewhere else.

Or you keep your output under version control. Setting keepBuildDir to true would take care of the immediate problem but could create more problems down the road if you perform transformations on the output of r.js.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top