I'm working on the plugin at https://github.com/ccapndave/fuse-box-elm-plugin/blob/master/src/index.ts
Let's assume that the entry point to my application is app.ts.
fuse.bundle("app")
.watch()
.instructions("> js/app.ts")
.hmr();| type alias Tree4 level1Data level2Data level3Data leafData = | |
| { data : level1Data | |
| , children : Array | |
| { data : level2Data | |
| , children : Array | |
| { data : level3Data | |
| , children : Array | |
| { data : leafData | |
| } | |
| } |
| type state = {coins: Belt.Map.String.t(Coin.t)}; | |
| type action = | |
| | CoinsLoad | |
| | CoinsLoadSuccess(Belt.Map.String.t(Coin.t)) | |
| | CoinsLoadError(string); | |
| let decodeCoins = json => | |
| json | |
| |> Json.Decode.dict(Coin.Decode.coin) |
| import Page exposing (Page(..)) | |
| -- gives me "Module `Page` does not expose `Page` |
| module Child exposing (..) | |
| import Html exposing (..) | |
| import Html.Events exposing (..) | |
| -- Internal messages (which will usually be 90% of the messages) are dealt with like normal unlike the Translator pattern | |
| type Msg | |
| = A | |
| | B | |
| | Dispatch OutMsg |
| function copyMisc(): Task { | |
| return () => | |
| startIn(homeDir) | |
| .then(addFiles("assets/**")) | |
| .then(addFiles("vendor/**")) | |
| .then(addFiles("index.html")) | |
| .then(writeTo(destDir)) | |
| } | |
| function copyConfig(configFile: string): Task { |
| export function writeToV1(path: string): StateTransfomer { | |
| return async state => { | |
| // Copy all files, making sure that their paths exist | |
| await Promise.all( | |
| state.files.map(async file => { | |
| const fullPath = resolve(path, file.path); | |
| await fs.ensureDir(dirname(fullPath)); | |
| await fs.writeFile(fullPath, file.buffer); |
| //import { File, WorkFlowContext, Plugin } from "fuse-box"; | |
| import { File, WorkFlowContext, Plugin } from "../../fuse-box/.dev"; | |
| import { ChildProcess } from "child_process"; | |
| import { resolve, relative } from "path"; | |
| import { readFile } from "fs"; | |
| import { tmpName } from "tmp"; | |
| import * as spawn from "cross-spawn"; | |
| import { findAllDependencies } from "find-elm-dependencies" | |
| const tmp = () => |
| // 1. Very functional but hard to read | |
| const newState = stateTransformers.reduce((s, stateTransformer) => s.then(stateTransformer), Promise.resolve(state)); | |
| // 2. Easy to read, but has mutation | |
| let state = startingState; | |
| for (let stateTransfomer of stateTransformers) { | |
| state = await stateTransfomer(state); | |
| } | |
| // 3. ??? |
I'm working on the plugin at https://github.com/ccapndave/fuse-box-elm-plugin/blob/master/src/index.ts
Let's assume that the entry point to my application is app.ts.
fuse.bundle("app")
.watch()
.instructions("> js/app.ts")
.hmr();| dave@~/Projects/Couloir/ctp/title-sss$ ts-node fuse.ts | |
| Launch "default" | |
| Resolve "dev" | |
| Launch "dev" | |
| Resolve "copy" | |
| Launch "copy" |