joshuamiller / react-native-template-cljs-krell-storybook

A React Native Template for installing a working ClojureScript, Krell, and Storybook environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

post-install script runs and fails every time `yarn add` is run

loganrios opened this issue · comments

It's ultimately a non-issue, since yarn add still does its job, but now the operation throws an error code due to post_install.cljs failing.

From a fresh project:

$ npx react-native init myproj --template react-native-template-cljs-krell-storybook
$ cd myproj
$ yarn add react-native-vector-icons # or any other package
<various yarn warnings, as usual>
$ nbb post_install.cljs
----- Error --------------------------------------
Message:  ENOENT: no such file or directory, open 'src/project_name/core.cljs'
Location: /Users/logan/src/test/myproj/post_install.cljs:9:8

----- Context ------------------------------------
5:             [clojure.string :as str]))
6: 
7: (defn file->str
8:   [filename]
9:   (str (readFileSync filename)))
           ^--- ENOENT: no such file or directory, open 'src/project_name/core.cljs'
10: 
11: (def project-name
12:   (->> (file->str "app.json")
13:        (.parse js/JSON)
14:        (.-name)

----- Stack trace --------------------------------
post-install           - /Users/logan/src/test/myproj/post_install.cljs:9:8 
clojure.core/str       - <built-in> 
post-install/file->str - /Users/logan/src/test/myproj/post_install.cljs:9:3 
post-install/file->str - /Users/logan/src/test/myproj/post_install.cljs:7:1 
post-install           - /Users/logan/src/test/myproj/post_install.cljs:27:7 
clojure.string/replace - <built-in> 
post-install           - /Users/logan/src/test/myproj/post_install.cljs:28:7 

error Command failed with exit code 1.

I assume that the post_install.cljs script is meant to be run only after the initial template is set up, but for some reason is running after every yarn add, which subsequently throws an error because post_install.cljs is trying to do folder renaming that has already been performed.

Let me know if you need any more information!

Ah, good catch. Looks like we just need to double-check whether we're in a new project or not and exit if so.