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

Fix a bug with buildStaticStandalone resolving too early #4649

Merged

Conversation

transitive-bullshit
Copy link
Member

Issue: buildStaticStandalone returns a Promise for its build completing, but that Promise doesn't take into account the actual compiler work, meaning that dependents that want to create static builds have no way of reliably knowing when the build completes.

What I did

I made a fairly simple change to build-static.js that only resolves the buildStaticStandalone async result once the build completes or errors.

How to test

Is this testable with Jest or Chromatic screenshots? No
Does this need a new example in the kitchen sink apps? No
Does this need an update to the documentation? No

You can reproduce this via a standalone static build like this one:

const build = require('@storybook/react/standalone')
const packageJson = require('./package.json')

const configDir = './.storybook'
const outputDir = './storybook-static'

build({
  mode: 'static',
  packageJson,
  configDir,
  outputDir,
  port: 60001,
  host: 'localhost'
}).then(() => {
  console.log('storybook build should be finished', outputDir)
}).catch((err) => {
  console.error('storybook build error', err)
})

Note that this is a bugfix for hydrateio/docz-plugin-storybook#4

cc @mergebandit

@igor-dv
Copy link
Member

igor-dv commented Oct 30, 2018

CI is oddly red, can you please merge from master?

@transitive-bullshit
Copy link
Member Author

@igor-dv thanks for the quick response; from what I can tell, my branch is sync'ed with latest master. I just pulled latest and merged again to be sure. The latest commit from master before this PR is d33ac612f9e32dce715ab3c1a1d5ef452ed4488e which matches the latest commit from master on this upstream repo.

I've never seen this type of error before but CI seems to think that the yarn.lock file is dirty.

Not sure how to proceed from here but happy to make any changes you guys would like to see.

@mergebandit
Copy link

mergebandit commented Oct 31, 2018

FYI - it looks like this is failing due to the use of Yarn 1.9 (see issue 6440) - the integrity entries are being removed from each of the entries in the yarn.lock file. Example:

image

CI currently is using Yarn v1.9.4

@igor-dv
Copy link
Member

igor-dv commented Oct 31, 2018

Probably CircleCI issue. TeamCity is passing. I will rerun CircleCI.

@mergebandit
Copy link

FYI - the scripts/repo-dirty-check.js is what is failing, suggesting that you should run yarn bootstrap --reset --core. Running this on a clean checkout of this branch does not resolve this issue.

@igor-dv
Copy link
Member

igor-dv commented Nov 1, 2018

This test is checking that yarn.lock is updated after some packages were added/changed. But since there were not any pkgs changes here, IMO it should not fail...

@transitive-bullshit
Copy link
Member Author

I'm guessing something changed on circleci's end with respect to the version of Yarn it is running. @igor-dv is a fresh circleci build passing on master if run today?

@codecov
Copy link

codecov bot commented Nov 4, 2018

Codecov Report

Merging #4649 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4649      +/-   ##
==========================================
- Coverage   35.59%   35.57%   -0.02%     
==========================================
  Files         557      557              
  Lines        6732     6735       +3     
  Branches      884      884              
==========================================
  Hits         2396     2396              
- Misses       3876     3879       +3     
  Partials      460      460
Impacted Files Coverage Δ
lib/core/src/server/build-static.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 729bc9c...8258183. Read the comment docs.

@igor-dv
Copy link
Member

igor-dv commented Nov 5, 2018

It was a node issue (@Hypnosphi solved it in CI).

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

Successfully merging this pull request may close these issues.

None yet

4 participants