extension-js / extension.js

๐Ÿงฉ Plug-and-play, zero-config, cross-browser extension development tool.
https://extension.js.org
MIT License
3.64k stars 91 forks source link

Delete `_locales/.DS_Store` #181

Open wottpal opened 6 days ago

wottpal commented 6 days ago

Hey there, first thanks for building this great tool! It has really working super flawlessly for me (and I'm using v2 alphas for a while).

There is one annoying thing though, that comes up quite often as macOS likes creating these stupid .DS_Store over and over again which causes some issues:

I think it would be a great addition, to delete this file (recursively) during development & build.

cezaraugusto commented 4 days ago

hi @wottpal thanks for the kind words! I'm glad you use and like Extension.js

.DS.Store files are in the .gitignore file so it should be skipped by default. How can I reproduce the issues you're facing in both dev/build steps?

wottpal commented 3 days ago

I've attached a simple reproduction flow. As macOS likes creating .DS_Store files quite regularly when browsing through Finder, it's safe to assume there will be a _locales/.DS_Store at some point (regardless of whether it's gitignored).

~/Developer/playground ยป bunx extension@latest create dsstore-reproduction                              zoma@dennis-mbp-2
๐Ÿฃ - Starting a new browser extension named dsstore-reproduction...
๐Ÿค - Ensuring dsstore-reproduction folder exists...
๐Ÿคž - Checking if destination path is writeable...
๐Ÿ”Ž - Scanning for potential conflicting files...
๐Ÿงฐ - Installing dsstore-reproduction...
๐Ÿ“ - Writing package.json metadata...
๐Ÿ›   - Installing dependencies... (takes a moment)
๐Ÿ“„ - Writing README.md metadata...
๐Ÿ“œ - Writing manifest.json metadata...
๐ŸŒฒ - Initializing git repository for dsstore-reproduction...
๐Ÿ™ˆ - Writing .gitignore lines...
๐Ÿงฉ - Success! Extension dsstore-reproduction created.

Now cd dsstore-reproduction and npm run dev to open a new browser instance
with your extension installed, loaded, and enabled for development.

You are ready. Time to hack on your extension!
--------------------------------------------------------------------------------------------------------------------------
~/Developer/playground ยป cd dsstore-reproduction                                                        zoma@dennis-mbp-2
--------------------------------------------------------------------------------------------------------------------------
~/Developer/playground/dsstore-reproduction (main*) ยป mkdir _locales                                    zoma@dennis-mbp-2
--------------------------------------------------------------------------------------------------------------------------
~/Developer/playground/dsstore-reproduction (main*) ยป touch _locales/.DS_Store                          zoma@dennis-mbp-2
--------------------------------------------------------------------------------------------------------------------------
~/Developer/playground/dsstore-reproduction (main*) ยป bun run dev                                       zoma@dennis-mbp-2
$ extension dev
node:fs:1507
  const result = binding.readdir(
                         ^

Error: ENOTDIR: not a directory, scandir '/Users/zoma/Developer/playground/dsstore-reproduction/_locales/.DS_Store'
    at Object.readdirSync (node:fs:1507:26)
    at Li (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/extension-develop/dist/module.js:110:23193)
    at de (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/extension-develop/dist/module.js:110:24541)
    at ds.apply (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/extension-develop/dist/module.js:110:61768)
    at createCompiler (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/webpack/lib/webpack.js:81:12)
    at create (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/webpack/lib/webpack.js:154:16)
    at webpack (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/webpack/lib/webpack.js:182:32)
    at f (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/webpack/lib/index.js:75:16)
    at gp (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/extension-develop/dist/module.js:161:4600)
    at Timeout._onTimeout (/Users/zoma/Developer/playground/dsstore-reproduction/node_modules/extension-develop/dist/module.js:170:1475) {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: '/Users/zoma/Developer/playground/dsstore-reproduction/_locales/.DS_Store'
}

Node.js v20.17.0
error: script "dev" exited with code 1

My recommondation would be skipping .DS_Store files in general, also when (recursively) copying stuff over to /dist during dev & build.

cezaraugusto commented 2 days ago

hey @wottpal can't repro unfortunately. I see you are using bun, does it happen with npm/pnpm as well?

wottpal commented 2 days ago

Hmm, I can reproduce the exact same error with npm (and npx respectively) with the commands above.