From 2135db8cfc02e12082dec082fe19e311b40fee08 Mon Sep 17 00:00:00 2001 From: Ryan Haskell-Glatz Date: Sat, 16 Jan 2021 13:39:53 -0600 Subject: [PATCH] prepare for beta publish --- .gitignore | 3 +-- src/cli/.npmignore | 14 ++++++-------- src/cli/package.json | 3 ++- src/cli/src/cli/build.ts | 5 +---- src/cli/src/cli/init.ts | 5 +++-- src/cli/src/config.ts | 1 - src/cli/src/defaults/Pages/Home_.elm | 26 -------------------------- src/cli/src/new/_gitignore | 5 +++++ src/cli/src/new/src/Pages/Home_.elm | 11 +++++++++++ 9 files changed, 29 insertions(+), 44 deletions(-) delete mode 100644 src/cli/src/defaults/Pages/Home_.elm create mode 100644 src/cli/src/new/_gitignore create mode 100644 src/cli/src/new/src/Pages/Home_.elm diff --git a/.gitignore b/.gitignore index 4857910..a6dadfa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ elm-stuff node_modules dist -Generated -elm-spa-*.tgz + # Local Netlify folder .netlify \ No newline at end of file diff --git a/src/cli/.npmignore b/src/cli/.npmignore index cb8883a..24a3eb0 100644 --- a/src/cli/.npmignore +++ b/src/cli/.npmignore @@ -1,10 +1,8 @@ elm-stuff -/src +/node_modules /tests -/elm.json -/examples -!.gitignore -.github -.netlify -*.tgz -/dist/elm.js \ No newline at end of file +/jest.config.js +/tsconfig.json +/src/** +!/src/new/** +!/src/defaults/** \ No newline at end of file diff --git a/src/cli/package.json b/src/cli/package.json index e56a81b..d6578e1 100644 --- a/src/cli/package.json +++ b/src/cli/package.json @@ -9,7 +9,8 @@ "build": "tsc", "build:watch": "tsc --watch", "test": "jest", - "test:watch": "jest --watchAll" + "test:watch": "jest --watchAll", + "publish:test": "npm run build && npm pack --dry-run" }, "repository": { "type": "git", diff --git a/src/cli/src/cli/build.ts b/src/cli/src/cli/build.ts index 587d21c..1d723c7 100644 --- a/src/cli/src/cli/build.ts +++ b/src/cli/src/cli/build.ts @@ -129,7 +129,7 @@ const compileMainElm = (env : Environment) => async () => { await File.mkdir(config.folders.dist) } - return Process.run(`${config.binaries.elm} make ${input} --output=${output} --report=json ${flags}`) + return Process.run(`${config.binaries.elm} make ${input} --output=${output} --report=json ${flags}`) .catch(colorElmError) } @@ -186,9 +186,6 @@ const compileMainElm = (env : Environment) => async () => { const minify = () => Process.run(`${config.binaries.terser} ${output} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | ${config.binaries.terser} --mangle --output=${output}`) - const gzip = () => - Process.run(`gzip --keep --force ${output}`) - return (env === 'development') ? elmMake() .then(_ => success()).catch(error => error) diff --git a/src/cli/src/cli/init.ts b/src/cli/src/cli/init.ts index 1c87132..7aebfb7 100644 --- a/src/cli/src/cli/init.ts +++ b/src/cli/src/cli/init.ts @@ -7,8 +7,9 @@ import { bold, reset } from "../terminal" // Scaffold a new elm-spa project export default { run: () => { - File.copy(config.folders.init, process.cwd()) - fs.mkdirSync(path.join(process.cwd(), 'src')) + const dest = process.cwd() + File.copy(config.folders.init, dest) + try { fs.renameSync(path.join(dest, '_gitignore'), path.join(dest, '.gitignore')) } catch (_) {} return ` ${bold}New project created in:${reset}\n ${process.cwd()}` } } \ No newline at end of file diff --git a/src/cli/src/config.ts b/src/cli/src/config.ts index 3cc3527..9e4d000 100644 --- a/src/cli/src/config.ts +++ b/src/cli/src/config.ts @@ -33,7 +33,6 @@ const config = { defaults: [ [ 'Main.elm' ], [ 'Shared.elm' ], - [ `Pages`, `${reserved.homepage}.elm` ], [ `Pages`, `${reserved.notFound}.elm` ], [ 'Page.elm' ], [ 'Request.elm' ], diff --git a/src/cli/src/defaults/Pages/Home_.elm b/src/cli/src/defaults/Pages/Home_.elm deleted file mode 100644 index 5ddde71..0000000 --- a/src/cli/src/defaults/Pages/Home_.elm +++ /dev/null @@ -1,26 +0,0 @@ -module Pages.Home_ exposing (page) - -import Html exposing (..) -import Html.Attributes exposing (attribute, href, style) -import View exposing (View) - - -page : View Never -page = - { title = "Homepage" - , body = - [ div - [ style "font-family" "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif" - , style "color" "#333" - , style "padding" "4rem" - ] - [ h1 [] [ text "🎉 Hooray– it's working!" ] - , p [] - [ strong [] [ text "Nice work! " ] - , text "Learn more at " - , a [ href "https://elm-spa.dev/guide", attribute "target" "_blank" ] - [ text "elm-spa.dev" ] - ] - ] - ] - } diff --git a/src/cli/src/new/_gitignore b/src/cli/src/new/_gitignore new file mode 100644 index 0000000..ce6402f --- /dev/null +++ b/src/cli/src/new/_gitignore @@ -0,0 +1,5 @@ +.DS_Store +.elm-spa +elm-stuff +node_modules +dist \ No newline at end of file diff --git a/src/cli/src/new/src/Pages/Home_.elm b/src/cli/src/new/src/Pages/Home_.elm new file mode 100644 index 0000000..34a3b15 --- /dev/null +++ b/src/cli/src/new/src/Pages/Home_.elm @@ -0,0 +1,11 @@ +module Pages.Home_ exposing (page) + +import Html +import View exposing (View) + + +page : View Never +page = + { title = "Homepage" + , body = [ Html.text "Hello, world!" ] + }