Pageworks / papertrain

Papertrain: a Craft CMS 3 framework
http://download.papertrain.io
MIT License
5 stars 2 forks source link

Switch fs.promises.access for existsSync #201

Closed codewithkyle closed 4 years ago

codewithkyle commented 5 years ago

https://github.com/Pageworks/papertrain/blob/fdb2ff759b57e04233366a47c9826fdb6cf35251/build-tools/prep.config.js#L28

Using the access method is failing on production.

TypeError: Cannot read property 'access' of undefined

Switch to use existsSync

if (fs.existsSync('_compiled'))
{
    rimraf('_compiled', (error)=>{
        if (error)
        {
            reject(error);
        }

        resolve();
    });
}
else
{
    resolve();
}
codewithkyle commented 5 years ago

It's possible that the error had something to do with the fact that fs.promises was experimental in node v10.0.0 and it might work if we use node v12.10.0

codewithkyle commented 5 years ago

Use the code above as the working fix. During the next project launch we'll test using node v12.10.0 to see if fs.promises is working.

codewithkyle commented 5 years ago

Updating node to v12.10.0 didn't fix the issue, it appears that it's not failing because the fs.promises section of the API was experimental in v10. We should implement the solution provided in the OP.

codewithkyle commented 4 years ago

Released in Papertrain v0.3.1 (#211)