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 clean method to return Promise always #3501

Merged
merged 2 commits into from Mar 6, 2019

Conversation

@Rokt33r
Copy link
Contributor

Rokt33r commented Feb 25, 2019

~/Code/react-bootstrap/tools/build.js:79
  .then(() =>
   ^

TypeError: clean(...).then is not a function
    at Object.<anonymous> (~/react-bootstrap/tools/build.js:79:4)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

At 79 lines in build.js, it using .then method. But the current clean method returns false | Promise. So, if there is no lib directory, it throws the above error because clean() will returns false rather than Promise<false>.

clean()
  .then(() =>
    ...
  )
@@ -15,7 +15,7 @@ const libRoot = path.join(__dirname, '../lib');
const distRoot = path.join(libRoot, 'dist');
const esRoot = path.join(libRoot, 'es');

const clean = () => fse.existsSync(libRoot) && fse.remove(libRoot);
const clean = async () => fse.existsSync(libRoot) && fse.remove(libRoot);

This comment has been minimized.

Copy link
@taion

taion Feb 25, 2019

Member

seems sort of weird... can we just use removeSync here and remove the .then below?

This comment has been minimized.

Copy link
@Rokt33r

Rokt33r Feb 26, 2019

Author Contributor

It's also possible. 👍

This comment has been minimized.

Copy link
@Rokt33r

Rokt33r Feb 26, 2019

Author Contributor

Let me know if you want. Then I'll fix it.

This comment has been minimized.

Copy link
@taion

taion Feb 26, 2019

Member

let's just do removeSync here and remove the .then below

@taion
taion approved these changes Feb 27, 2019
@taion taion requested a review from jquense Mar 6, 2019
@jquense
jquense approved these changes Mar 6, 2019
@taion taion merged commit 6f03223 into react-bootstrap:master Mar 6, 2019
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
@Rokt33r Rokt33r deleted the Rokt33r:fix/build-script branch Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.