packages feed

duplo 1.6.4 → 1.6.5

raw patch · 3 files changed

+24/−14 lines, 3 files

Files

README.md view
@@ -17,7 +17,7 @@  If "cabal" sounds more familiar: -1. `cabal install alex`. This must run globally.+1. `cabal install alex`. This must be run globally. 2. `cabal install duplo`. This can be run in a sandbox.  @@ -27,7 +27,7 @@ - `duplo info` displays the version for this duplo installation. - `duplo init <user> <repo>` scaffolds a new duplo repo in the current   directory.-- `duplo build` builds the project. `DUPLO_ENV` defaults to `dev`.+- `duplo build` builds the project. `DUPLO_ENV` defaults to `developoment`. - `duplo dev`: starts a webserver, watches for file changes, and builds in   development environment. - `duplo test` builds test cases and run it in a browser.@@ -196,11 +196,13 @@  Note that duplo only inspects the *top-level* `define()`. If you use `require()`, your program may not execute as duplo is not aware of anything-other `define()` declarations. The proper way to declare an entry point in+other than `define()` declarations. The proper way to declare an entry point in `app/index.js` is:  ```js-define('main', [/* ... dependencies ... */], function (/* ... dependencies ... */) {+define('anyNameHere',+[/* ... dependencies ... */],+function (/* ... dependencies ... */) {   // Code here ... }); ```
duplo.cabal view
@@ -1,5 +1,5 @@ name:                  duplo-version:               1.6.4+version:               1.6.5 synopsis:              Frontend development build tool description:           Intuitive, simple building blocks for building composable, completely self-managed web applications license:               MIT
src/Duplo.hs view
@@ -17,7 +17,7 @@ import Development.Shake.FilePath ((</>)) import GHC.Conc (forkIO) import System.Console.GetOpt (getOpt, OptDescr(..), ArgDescr(..), ArgOrder(..))-import System.Directory (getCurrentDirectory, createDirectoryIfMissing)+import System.Directory (getCurrentDirectory, createDirectoryIfMissing, doesFileExist) import System.Environment (lookupEnv, getArgs, getExecutablePath) import System.FilePath.Posix (takeDirectory) import System.Process (proc, createProcess, waitForProcess)@@ -83,7 +83,7 @@                     -- default.                     "build" -> maybe "production" id duploEnvMB                     -- By default, `dev` is the default.-                    _       -> maybe "dev" id duploEnvMB+                    _       -> maybe "development" id duploEnvMB    -- Internal command translation   let (cmdNameTranslated, bumpLevel, duploEnv, toWatch) =@@ -96,7 +96,7 @@           "patch"      -> ("bump", "patch", duploEnv', False)           "minor"      -> ("bump", "minor", duploEnv', False)           "major"      -> ("bump", "major", duploEnv', False)-          "dev"        -> ("build", "", "dev", True)+          "dev"        -> ("build", "", "development", True)           "live"       -> ("build", "", "production", True)           "production" -> ("build", "", "production", True)           "build"      -> ("build", "", duploEnv', False)@@ -192,26 +192,34 @@                                    , TC._dependencies = depIds                                    } -  -- Construct the Shake command+  -- If there is a Makefile, run that as well, with the environment as the+  -- target (e.g. `duplo dev` would run `make development` and `duplo build` would+  -- run `make production`).+  makefileExists <- doesFileExist $ cwd </> "Makefile"+  if   makefileExists+  then (createProcess $ proc "make" [duploEnv]) >> return ()+  else return ()++  -- Construct the Shake command.   let shake' = shakeMain cmdNameWithFlags cmdArgs buildConfig options   let shake  = shake' `catch` handleExc -  -- Watch or just build+  -- Watch or just build.   unless toWatch $ shake   when toWatch $ do-    -- Start a local server+    -- Start a local server.     _ <- forkIO $ serve port      -- Only watch the dev and the app directories. We're not watching the     -- dependency directory because it triggers a race condition with     -- componentjs.     let targetDirs = [devPath, appPath]-    -- Make sure we have these directories to watch+    -- Make sure we have these directories to watch.     mapM_ (createDirectoryIfMissing True) targetDirs-    -- Watch for file changes+    -- Watch for file changes.     watch shake targetDirs --- | Handle all errors+-- | Handle all errors. handleExc (e :: ShakeException) = do     putStr $ show e     logStatus errorPrintSetter "Build failed"