|
35 | 35 | (make-directory* deps)
|
36 | 36 |
|
37 | 37 | (define (entry->package entry)
|
38 |
| - (if (string? entry) |
39 |
| - entry |
40 |
| - (format "~a@~a" (dict-ref entry 'name) (dict-ref entry 'version)))) |
| 38 | + (cond [(string? entry) entry] |
| 39 | + [(= (dict-ref entry 'type) "git") (dict-ref entry 'name)] |
| 40 | + [else (format "~a@~a" (dict-ref entry 'name) (dict-ref entry 'version))])) |
41 | 41 |
|
42 | 42 | (define (entry->path entry)
|
43 | 43 | (if (string? entry) entry (dict-ref entry 'name)))
|
|
51 | 51 | (parameterize ([current-directory (make-temporary-file "tmp~a" 'directory)])
|
52 | 52 | (printf "Building: ~a~n" out)
|
53 | 53 | (when verbose
|
54 |
| - (printf "Build Directory Location: ~a~n" (current-directory))) |
55 |
| - (when verbose |
| 54 | + (printf "Build Directory Location: ~a~n" (current-directory)) |
56 | 55 | (printf "Setting up environment...~n"))
|
57 | 56 | (copy-file webpack-config "webpack.config.js")
|
58 | 57 | (copy-file dynamic-loader "dynamic-loader.js")
|
|
70 | 69 | "@babel/preset-env" "@babel/preset-react")
|
71 | 70 | (when verbose
|
72 | 71 | (printf "Downloading deps...~n"))
|
73 |
| - (cond |
74 |
| - [(generic-set? (dict-ref d 'package false)) |
75 |
| - (for ([p (dict-ref d 'package)]) |
76 |
| - (system* npm "install" (entry->package p)))] |
77 |
| - [else (system* npm "install" (entry->package (dict-ref d 'package)))]) |
| 72 | + (let loop ([d (dict-ref d 'package false)]) |
| 73 | + (cond |
| 74 | + [(generic-set? d) |
| 75 | + (for ([p d]) |
| 76 | + (loop p))] |
| 77 | + [(dict? d) |
| 78 | + (case (dict-ref d 'type) |
| 79 | + [("git") (system* git "clone" (dict-ref d 'url))] |
| 80 | + [else (system* npm "install" (entry->package d))])] |
| 81 | + [else (system* npm "install" (entry->package d))])) |
78 | 82 | (system* npx "webpack" path (format "--output-filename=~a.js" out))
|
79 | 83 | (for ([f (in-glob "dist/*")])
|
80 | 84 | (copy-file f (build-path deps (file-name-from-path f)) #t)))))
|
|
0 commit comments