[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing directory entry #572

Open
fnando opened this issue Feb 7, 2022 · 2 comments
Open

Missing directory entry #572

fnando opened this issue Feb 7, 2022 · 2 comments

Comments

@fnando
Copy link
fnando commented Feb 7, 2022

Hi there!

I'm trying to create a zip file and I'm noticing one inconsistency when generating the same zip using the CLI (zip command) versus archiver.

This is file file structure:

$ tree build
build
└── com.fnando.sd-hello.sdPlugin
    ├── css
    │     ├── custom.css
    │     └── sdpi.css
    ├── images
    │     ├── actions
    │     │     ├── Hello
    │     │     │     ├── Key.png
    │     │     │     └── Key@2x.png
    │     │     ├── Hello.png
    │     │     └── Hello@2x.png
    │     ├── category.png
    │     ├── category@2x.png
    │     ├── plugin.png
    │     └── plugin@2x.png
    ├── manifest.json
    ├── plugin.html
    ├── plugin.js
    ├── propertyInspector.html
    ├── propertyInspector.js
    └── propertyInspectors

6 directories, 15 files

From the CLI, I'm running the following commands:

$ pwd
~/Projects/personal/sd-sample/com.fnando.sd-hello.streamDeckPlugin

$ zip ~/Downloads/com.fnando.sd-hello.streamDeckPlugin -r com.fnando.sd-hello.sdPlugin

$ unzip -l ~/Downloads/com.fnando.sd-hello.streamDeckPlugin
Archive:  /Users/fnando/Downloads/com.fnando.sd-hello.streamDeckPlugin
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/css/
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/css/custom.css
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/actions/
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/actions/Hello/
        0  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/propertyInspectors/
       33  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/plugin.html
      205  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/propertyInspector.html
      599  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/category.png
      755  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/manifest.json
     1112  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/actions/Hello.png
     1210  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/plugin.png
     1368  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/category@2x.png
     1813  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/actions/Hello/Key.png
     2465  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/plugin@2x.png
     3077  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/actions/Hello@2x.png
     4337  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/images/actions/Hello/Key@2x.png
    20431  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/plugin.js
    20781  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/propertyInspector.js
    44476  02-06-2022 20:36   com.fnando.sd-hello.sdPlugin/css/sdpi.css
---------                     -------
   102662                     21 files

The above output is the expected structure; notice the first entry, a com.fnando.sd-hello.sdPlugin/ directory.

Now, using the code below, I'm able to generate a very similar zip file, except that it doesn't contain this same directory listed.

function archive(pluginId: string, distDir: string) {
  const outputPath = path.join(process.cwd(), `${pluginId}.streamDeckPlugin`);
  const output = fs.createWriteStream(outputPath);

  fs.rmSync(outputPath, { force: true });

  const archive = archiver("zip", { zlib: { level: 9 } });

  archive.on("error", (err) => {
    throw err;
  });

  archive.pipe(output);
  archive.directory(distDir, path.basename(distDir));
  archive.finalize();
}

If I list the zip files, this is the output:

$ unzip -l com.fnando.sd-hello.streamDeckPlugin
Archive:  com.fnando.sd-hello.streamDeckPlugin
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/css/
        0  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/css/custom.css
        0  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/
        0  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/actions/
        0  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/actions/Hello/
        0  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/propertyInspectors/
       33  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/plugin.html
      205  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/propertyInspector.html
      599  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/category.png
      755  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/manifest.json
     1112  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/actions/Hello.png
     1210  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/plugin.png
     1368  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/category@2x.png
     1813  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/actions/Hello/Key.png
     2465  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/plugin@2x.png
     3077  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/actions/Hello@2x.png
     4337  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/images/actions/Hello/Key@2x.png
    20431  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/plugin.js
    20781  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/propertyInspector.js
    44476  02-07-2022 04:43   com.fnando.sd-hello.sdPlugin/css/sdpi.css
---------                     -------
   102662                     20 files

Notice that the first zip lists 21 entries, whereas the one generated by archiver returns only 20 entries. Unfortunately, this inconsistency is preventing this file from being installed with Elgato's Stream Deck app (I assume they're checking for that one specific entry to validate whether the extension is valid or not).

The expectation is that both files would list the exact same 21 entries. Maybe I'm missing an option or something, so let me know if you want me to try anything.

fnando added a commit to fnando/streamdeck that referenced this issue Feb 13, 2022
archiver has a bug[1] that prevents plugins from being installed.

[1]: archiverjs/node-archiver#572
@cklxiaocui
Copy link

thanks, I meet the same issue

@blueBlue0102
Copy link
blueBlue0102 commented Nov 14, 2023

#52 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants