Skip to content

Commit

Permalink
Normalize globby paths (#1865)
Browse files Browse the repository at this point in the history
* Normalize globby paths

* Create young-socks-learn.md
  • Loading branch information
cristiano-belloni authored Jun 22, 2022
1 parent f8ef4e7 commit ad9a85c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-socks-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"modular-scripts": patch
---

Fix files not added when using a template with `modular add` on Windows
10 changes: 5 additions & 5 deletions packages/modular-scripts/src/addPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ async function addPackage({
const packageFilePaths = getAllFiles(packagePath);

// If we get our package locally we need to whitelist files like yarn publish does
const packageWhitelist = globby.sync(
modularTemplatePackageJson.files || ['*'],
{
const packageWhitelist = globby
.sync(modularTemplatePackageJson.files || ['*'], {
cwd: packagePath,
absolute: true,
},
);
})
.map((filePath) => path.normalize(filePath));

for (const packageFilePath of packageFilePaths) {
if (!packageWhitelist.includes(packageFilePath)) {
fs.removeSync(packageFilePath);
Expand Down

0 comments on commit ad9a85c

Please sign in to comment.