doki-theme / doki-theme-template

Template Repository for creating new themes for different platforms
MIT License
2 stars 1 forks source link

Create src directory before writing the file #3

Closed nopeless closed 1 year ago

nopeless commented 1 year ago
// Ensure directories exist
{
  const e = (...p: string[]) => {
    if (!fs.existsSync(path.resolve(repoDirectory, ...p))) {
      fs.mkdirSync(path.resolve(repoDirectory, ...p));
    }
  };

  e("src");
  e("src", themesDirectory);
}

Something like this would be more appropriate actually

Unthrottled commented 1 year ago

Just as a fyi you could

fs.mkdirSync(path.resolve(repoDirectory, ...directories), {recursive: true})

Which will recursively create the parents if needed.

Unthrottled commented 1 year ago

Thanks!

nopeless commented 1 year ago

Just as a fyi you could

fs.mkdirSync(path.resolve(repoDirectory, ...directories), {recursive: true})

Which will recursively create the parents if needed.

Didn't know that, thanks