resources with prefix

This commit is contained in:
Roman Volosovskyi 2019-05-31 18:33:15 +03:00
parent 86c0bfdb73
commit c2e09bcb25
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 13 additions and 9 deletions

View File

@ -109,14 +109,18 @@
(defn get-modules
[resource-dirs js-modules]
(->> (for [dir resource-dirs]
(->> (file-seq (io/file dir))
(filter #(and (not (re-find #"DS_Store" (str %)))
(.isFile %)))
(map (fn [file] (when-let [unix-path (->> file .toPath .iterator iterator-seq (str/join "/"))]
(-> (str "./" unix-path)
(str/replace "\\" "/")
(str/replace "@2x" "")
(str/replace "@3x" "")))))))
(let [{:keys [path prefix]} (if (map? dir)
dir
{:path dir
:prefix "./"})]
(->> (file-seq (io/file path))
(filter #(and (not (re-find #"DS_Store" (str %)))
(.isFile %)))
(map (fn [file] (when-let [unix-path (->> file .toPath .iterator iterator-seq (str/join "/"))]
(-> (str prefix unix-path)
(str/replace "\\" "/")
(str/replace "@2x" "")
(str/replace "@3x" ""))))))))
flatten
(concat js-modules ["react" "react-native" "create-react-class"])
distinct))

View File

@ -36,7 +36,7 @@
(s/def :config/name (and not-empty-string? #(re-matches #"^[A-Z][A-Za-z0-9]+$" %)))
(s/def :config/js-modules (s/coll-of not-empty-string?))
(s/def :config/desktop-modules (s/coll-of not-empty-string?))
(s/def :config/resource-dirs (s/coll-of not-empty-string?))
(s/def :config/resource-dirs (s/coll-of (s/or not-empty-string? map?)))
(s/def :config/figwheel-bridge not-empty-string?)
(s/def :config/figwheel-options map?)
(s/def :config/builds (s/coll-of map?))