christopherafbjur / sanity-plugin-icon-picker

MIT License
30 stars 25 forks source link

Sanity V3 Upgrade? #26

Closed dumle11 closed 1 year ago

dumle11 commented 1 year ago

Hello, are there any plans to upgrade this plugin to work with Sanity v3? Thanks!

kevinorin commented 1 year ago

Im also looking for a icon-picker update for version 3. There is a post in community Slack of someone who go it working but they didn't say how or share any code.

Screen Shot 2023-02-27 at 1 47 01 PM
christopherafbjur commented 1 year ago

Definitely, yes! Will try to create a fix for this asap @dumle11 @kevinorin

dumle11 commented 1 year ago

Awesome, thank you!

zacanger commented 1 year ago

@christopherafbjur Kevin has a tentative version on his fork, just testing it out and trying to resolve any outstanding bugs; if you're already working on an upgrade the diff there might be useful. One notable change is that setIfMissing seems to be private in v3, we weren't sure what to do about that.

kevinorin commented 1 year ago

Definitely, yes! Will try to create a fix for this asap @dumle11 @kevinorin

Thanks @zacanger , looking forward to v3 update...let me know if you need anything @christopherafbjur

christopherafbjur commented 1 year ago

Just finished the V3 version. Please check it out and let me know if you find any bugs

hanshenrik commented 1 year ago

Hi! I'm getting this error after upgrading to Sanity Studio v3 and installing yarn add sanity-plugin-icon-picker@2.1.0

▶ yarn dev
yarn run v1.22.19
$ sanity dev
✔ Checking configuration files...
Sanity Studio using vite@4.1.4 ready in 23916ms and running at http://localhost:3333/
✘ [ERROR] Could not resolve "part:@sanity/form-builder/patch-event"

    ../node_modules/sanity-plugin-icon-picker/dist/index.js:16:26:
      16 │ var _patchEvent = require("part:@sanity/form-builder/patch-event");
         ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/form-builder/patch-event" as external to exclude it from the
  bundle, which will remove this error. You can also surround this "require" call with a try/catch
  block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "part:@sanity/components/formfields/default"

    ../node_modules/sanity-plugin-icon-picker/dist/index.js:18:47:
      18 │ var _default2 = _interopRequireDefault(require("part:@sanity/components/formfields/default"));
         ╵                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/components/formfields/default" as external to exclude it from
  the bundle, which will remove this error. You can also surround this "require" call with a
  try/catch block to handle this failure at run-time instead of bundle-time.

12:10:13 PM [vite] error while updating dependencies:
Error: Build failed with 2 errors:
../node_modules/sanity-plugin-icon-picker/dist/index.js:16:26: ERROR: Could not resolve "part:@sanity/form-builder/patch-event"
../node_modules/sanity-plugin-icon-picker/dist/index.js:18:47: ERROR: Could not resolve "part:@sanity/components/formfields/default"
    at failureErrorWithLog (/Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:1604:15)
    at /Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:1056:28
    at runOnEndCallbacks (/Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:1476:61)
    at buildResponseToResult (/Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:1054:7)
    at /Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:1166:14
    at responseCallbacks.<computed> (/Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:701:9)
    at handleIncomingPacket (/Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:756:9)
    at Socket.readFromStdout (/Users/hanshenrik/kode/folq/public-pages/node_modules/esbuild/lib/main.js:677:7)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)

I'm guessing the imports in this plugins needs to change from part: to something else, as mentioned in this section?

EDIT: Oh, stupid me, there's a new version available of this plugin, v3.0.2. This version works! However, the install example in the Sanity plugin documentation should be updated ✌️

christopherafbjur commented 1 year ago

@hanshenrik Glad it worked out for you! To me the install example in the plugin documentation looks complete, can you please elaborate? Thanks in advance!

hanshenrik commented 1 year ago

Ah, sorry again 🤦 My quick glance at the install instructions, since I use yarn in the project in question, made me think v2.1.0 was the correct version. Didn't see the V2 INSTALL COMMAND (DEPRECATED) title. Sort of weird that Sanity uses yarn as example for the deprecated install instructions and npm for the current ones 🤷

So, everything is ok, sorry for the trouble!

Screenshot 2023-03-10 at 15 02 49