If you run this command in a Linux terminal:
mkdir -p ./dist/{articles,scripts,stylesheets}
It'll create the following folder tree (in the current directory):
dist
|- articles
|- scripts
|- stylesheets
The problem occurs when I try to do the same using the shelljs npm package.
For example, calling the following function:
shell.mkdir("-p", "./dist/{articles,scripts,stylesheets}");
Results in the following file tree being created:
dist
|- {articles,scripts,stylesheets}
In other words, it's a folder called dist
that contains a subfolder called {articles,scripts,stylesheets}
.
I've tried escaping the curly braces, like this:
shell.mkdir("-p", "./dist/\{articles,scripts,stylesheets\}");
It didn't work, so I doubled down and escaped the backslash:
shell.mkdir("-p", "./dist/\\{articles,scripts,stylesheets\\}");
That didn't work either, so I doubled down again and added an escaped backslash before the escaped backslash:
shell.mkdir("-p", "./dist/\\\\{articles,scripts,stylesheets\\\\}");
Which didn't work, but it did create a folder with a different name:
\\{articles,scripts,stylesheets\\}
How can I fix this problem?