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

Plugin built time (skpm-build --watch --run) is too slow after changes in files. #266

Open
luckyfoxdesign opened this issue Jan 3, 2020 · 11 comments

Comments

@luckyfoxdesign
Copy link

Current results:

image

The steps that led to these results

  1. I wrote a plugin
  2. Published it
  3. Installed https://github.com/skpm/sketch-module-web-view with a save flag

On the first evening after installing everthing was ok, but the next day, when I was running a command: npm run start , the time between saving the event in a file and running the plugin in sketch was too long, about a minute or longer.

  • When I start a new project locally – everthing is fine and everthing works without troubles.
  • When I clone the project from github – it has the same problem with the built time.

A link to the plugin repo: Helpify plugin

What am I doing wrong? Or what has happened and how to fix it?

@varun531
Copy link

varun531 commented Jan 13, 2020

I'm having this issue as well. I'm on Sketch 61.2

@varun531
Copy link

varun531 commented Jan 14, 2020

Another update:

When I switch to using an older version of skpm/builder (npm install @skpm/builder@0.6.0), and I have a trivial program in my my-command.js:

import sketch from 'sketch'

export default function() {
  sketch.UI.message("Testing")
}

I CAN actually get fast building and running going. However, it breaks when I paste in the sample code from airbnb's react-sketchapp project.

@lucastobrazil
Copy link

I am getting a super slow build from the get-go just doing skpm create my-plugin and then npm run start - takes 61241ms

@lucastobrazil
Copy link

Looking deeper, i acan see the the culprit is the --run command:

"scripts": {
    "build": "skpm-build", // works fine
    "watch": "skpm-build --watch",  // works fine
    "start": "skpm-build --watch --run",  // very slow
    "postinstall": "npm run build && skpm-link"
  },

And looks like this commit relates:
6675ee3

@macintoshhelper
Copy link
Contributor

I've run into this issue too, takes over a minute for anything to build with --run (react-sketchapp npm run render). For now, I've installed version @skpm/builder@0.4.3, and am holding off on upgrading Sketch (am on version 57.1), incase that breaks compatibility with the older @skpm/builder version.

@mathieudutour

@90dy
Copy link

90dy commented Jun 30, 2021

Same result with 0.7.0.
Downgrade to ~0.6 seems to work fine.

@ytpm
Copy link

ytpm commented Sep 13, 2021

Same result with 0.7.0.
Downgrade to ~0.6 seems to work fine.

How do I downgrade to 0.6?

@90dy
Copy link

90dy commented Nov 2, 2021

Same result with 0.7.0.
Downgrade to ~0.6 seems to work fine.

How do I downgrade to 0.6?

npm install --save @skpm/builder@~0.6

@sjerratsch
Copy link

For some reason the following line seems not to evaluate to true:

...(sketchVersion && semver.satisfies(sketchVersion, '>= 56.0.0')

So therefore the flag --without-waiting-for-plugin isn't set when executing the command via the shell.
If you put an || true right here, it works like a charm (built in 1000ms):

Got a working react-sketchapp typescript setup using the latest Sketch 81.1 this way.

@mathieudutour
Copy link
Member

Oh interesting. Would you be able to investigate why it's not evaluating to true? Maybe the semver dependency was updated and the behaviour changed

@sjerratsch
Copy link

Right now it's not a priority for me so I have to postpone any further investigation at this point, I'm just happy it works for my PoC. When I start using this more frequently I might come back to it.

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

8 participants