New reason-scripts release


#1

New version should be compatible with bs-platform@3 and reason-react@0.4! Also some small updates to the bs-loader and read-bsconfig packages.

reason-scripts@0.9.0

  • Replaced ReasonReact.stringToElement with ReasonReact.string
  • Updated bs-json to @glennsl/bs-json
  • Capitalized component file names
  • Turned on .bs.js suffix and in-source
  • Output ES modules instead of CJS

bs-loader@2.0.3

  • Better automatic detection of in-source builds

read-bsconfig@1.0.5

  • package-specs can now be either BsPackageSpec or BsPackageSpec[]

#2

Thx for the great work !!!
I get a problem with npm test do you have a hint for me ?

ENOENT: no such file or directory, open '/folder/to/my/project/lib/js/src/App_test.js'

Shouldn’t

Turned on .bs.js suffix and in-source

fix that issue ?
Do i have to provide some flags to use that suffix ?

Thx in advance


#3

That might be a bug on our side :confused: I’ll look at it to tonight, and let you know here :grin:


#4

It looks a bit for me that I still have the old version but I checked and I installed 0.9.0 :thinking:
I will also try it again and let you know thx a lot for your help and sorry for the hustle.


#5

Looked into this a bit, might be a problem with bs-loader’s Jest integration + in-source builds :confused: I don’t know how much time I have to fix it, but it should be soon :slight_smile:

The false provided as an argument here should be whether the build is in-source or not: https://github.com/reasonml-community/bs-loader/blob/master/packages/bs-loader/index.js#L104-L118


#6

Had also a quick look and the latest version of createJestConfig.js would fix the problem.

There we have

testMatch: [ '<rootDir>/src/**/*test.{bs.js,js}' ]

I guess there is no reason to test both .re and ,bs.js files, but could you briefly explain why you prefer there to test the transpiled .bs.js files instead of the original .re file ?

Since we test the transpiled files i have to first call a bsb -make-world in order to have the testable files.
Also i cannot transpile to es6 and i have to use commonjs for package-specs.module otherwise i get another problem.

  â—Ź Test suite failed to run

    /home/of/my/dummyApp/node_modules/bs-jest/src/jest.js:3
    import * as List from "bs-platform/lib/es6/list.js";
    ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-cli/node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
      at Object.<anonymous> (src/app_test.bs.js:3:13)

#7

That testMatch was definitely wrong, it shouldn’t be running the tests on .bs.js, it should be running them on the .re files and using bs-loader’s Jest integration.

I fixed bs-loader’s Jest integration last night in this commit but it still has problems with dependencies in node_modules being compiled as ES modules. I need to find a way to force Jest to compile things in node_modules with Babel to make the sources CommonJS compatible.