I’m working on a small CLI to generate the base of my projects and generalize everything.
Now i wanted to copy my workflows from x to y directory but these are in a dot (.) leading directory.
fs.readdir / fs.readdirSync don’t support dot leading directories, so i tried using child_process to fetch the output myself but in TS the directories are excluded but in windows command prompt with the same command it isn’t?
// Determine the command based on the platform
const isWindows = process.platform === 'win32';
const command = isWindows
? `dir "${rootDirectory}" /b`
: `find "${rootDirectory}" -type f`;
console.log(execSync(command).toString("utf8"))
TS Output:
.babelrc.ejs
.releaserc.ejs
package.json.ejs
public
README.md.ejs
src
tsconfig.json.ejs
webpack.config.js.ejs
Powershell out:
dir THE_DIRECTORY /b
.babelrc.ejs
.github
.releaserc.ejs
package.json.ejs
public
README.md.ejs
src
tsconfig.json.ejs
webpack.config.js.ejs