Commit Graph

684 Commits

Author SHA1 Message Date
Dillon Kearns
713ff07634 Write generated files to a temporary folder and serve them in dev server. 2021-04-13 15:33:31 -07:00
Dillon Kearns
2a5ef63ae2 Generate manifest.json as a plain-old file generator. 2021-04-13 13:46:48 -07:00
Dillon Kearns
4744844dd1 Wire in manifest generator as just another file generator, but specified in the generated code. 2021-04-13 13:28:58 -07:00
Dillon Kearns
64e1baf0b2 Use replaceAll in generator command. 2021-04-13 13:11:34 -07:00
Dillon Kearns
2b63ac8459 Update generator. 2021-04-13 13:05:18 -07:00
Dillon Kearns
e8f0ffe7b6 Add watchers when file reads and globs are encountered in the renderer. 2021-04-12 21:44:57 -07:00
Dillon Kearns
fcada0839e Watch elm source dirs and rewatch on elm.json change. For now, don't watch content/ folder, in preparation for watching on-demand based on globs and file reads from data sources. 2021-04-12 21:26:14 -07:00
Dillon Kearns
89cfd0904c Add debug output. 2021-04-12 20:30:20 -07:00
Dillon Kearns
a403f90049 Run cli in debug mode. 2021-04-12 20:29:59 -07:00
Dillon Kearns
ce039cf207 Generate separate Route module. 2021-04-12 17:34:23 -07:00
Dillon Kearns
06a9883c15 Remove references to Shared.PageView. 2021-04-12 16:54:08 -07:00
Dillon Kearns
0434c7ebec Use map function from Document. 2021-04-12 16:50:23 -07:00
Dillon Kearns
3dee1adf04 Generate RouteParams in generator. 2021-04-12 16:45:25 -07:00
Dillon Kearns
02b97e7b16 Clean up dev server logging output. 2021-04-12 15:32:42 -07:00
Dillon Kearns
450c53536a Clear cache entry for file in dev server on file change. 2021-04-12 15:16:30 -07:00
Dillon Kearns
57935a19dd Handle multiple EventStream connections, and socket close event. 2021-04-12 13:53:13 -07:00
Dillon Kearns
0a33c6e572 Add some type annotations. 2021-04-11 21:06:31 -07:00
Dillon Kearns
a2df8d665d Add return to prevent incorrect runningElmMake state. 2021-04-11 20:07:19 -07:00
Dillon Kearns
cfee49f0dd Remove unused import. 2021-04-11 20:06:58 -07:00
Dillon Kearns
71d4366fbe Set elm make running to true on dev server start. 2021-04-11 16:17:04 -07:00
Dillon Kearns
7a019036ec Use module.hot.apply API to update content json when the new app is ready to receive ports. 2021-04-11 15:35:02 -07:00
Dillon Kearns
52fd8cc1b7 Use non-blocking IO in Elm ports for renderer. 2021-04-11 14:38:14 -07:00
Dillon Kearns
75fec75d61 Performance tuning for compiling elm client. And make sure to set elmMakeRunning to false after initial compilation. 2021-04-11 14:37:39 -07:00
Dillon Kearns
c154c2bb65 Only rerun codegen when Template module files are added or removed, since that's all the information they depend on. And don't rerun multiple elm make tasks while one is in progress to debounce. 2021-04-11 12:28:55 -07:00
Dillon Kearns
00f551e4d7 Print out time to run elm make. 2021-04-10 19:52:43 -07:00
Dillon Kearns
4b23287b4d Update codegen globals. 2021-04-10 16:47:48 -07:00
Dillon Kearns
edbadddf7f Remove obsolete images folder in favor of just static folder. 2021-04-10 14:06:48 -07:00
Dillon Kearns
cf1d03a2bb Remove more instances of pathkey. 2021-04-10 13:51:39 -07:00
Dillon Kearns
03e81639f6 Remove remaining references to NoMetadata. 2021-04-10 13:34:04 -07:00
Dillon Kearns
81c523bad6 Remove more references to NoMetadata. 2021-04-10 13:26:19 -07:00
Dillon Kearns
e06cdda113 Remove unused code. 2021-04-10 13:14:13 -07:00
Dillon Kearns
16d838a6a7 Remove dependency on Pages module in connector module. 2021-04-10 13:12:04 -07:00
Dillon Kearns
776bc3317d Remove Pages.pages, Pages.images, etc. 2021-04-10 13:05:23 -07:00
Dillon Kearns
da14d2e88f Goodbye PathKey! 👋 2021-04-10 13:00:26 -07:00
Dillon Kearns
31a5f2d8f6 Remove more references to Pages module. 2021-04-10 12:37:06 -07:00
Dillon Kearns
2722df72f7 Add starting design for separate routes module. 2021-04-10 10:47:25 -07:00
Dillon Kearns
8c4990551c Remove more pathkey stuff. 2021-04-10 10:35:37 -07:00
Dillon Kearns
12b36d964f No more PathKey for PagePath! 2021-04-10 10:33:26 -07:00
Dillon Kearns
6812367ab2 Use hardcoded () for pathkey. 2021-04-10 10:09:32 -07:00
Dillon Kearns
379817e51e Remove copy commands for beta-index.js and beta-style.css since they're now just assets. 2021-04-10 10:09:12 -07:00
Dillon Kearns
a0622db69d Move hmr loading indicator code into hmr.js and out of Elm code. 2021-04-09 16:36:18 -07:00
Dillon Kearns
ebb78e541a Retain staticHttp cache in dev server. 2021-04-09 13:22:12 -07:00
Dillon Kearns
b23c774b68 Print out timing of render function in logs. 2021-04-09 12:20:28 -07:00
Dillon Kearns
dc5178e861 Remove unused code. 2021-04-09 12:01:28 -07:00
Dillon Kearns
a6514b844f Serve assets with npm package that does streaming and mime type handling. Serve up some files from the file system for simlicity. 2021-04-09 12:00:24 -07:00
Dillon Kearns
bd1170083f Display request timing in dev server logs, and prevent some errors being logged by avoiding trying to read files for navigation requests. 2021-04-09 10:56:13 -07:00
Dillon Kearns
d9391cee53 Only apply HMR updates when content.json is free of errors. 2021-04-08 18:42:05 -07:00
Dillon Kearns
16689b7e85 Bust require cache when reloading Elm renderer function, re-run codegen step before running CLI Elm compilation, and await pending CLI compilation before responding to content.json requests. 2021-04-08 16:01:39 -07:00
Dillon Kearns
29c61434f2 Wire in elm-pages data source errors to error overlay. 2021-04-08 06:38:29 -07:00
Dillon Kearns
5d8680bc4f Remove commented code. 2021-04-07 17:38:07 -07:00
Dillon Kearns
3e2b699c1f Send elm compiler errors as JSON. 2021-04-07 17:37:49 -07:00
Dillon Kearns
451534addf Performance: tell client to hot reload elm before compiling, wait to give requested elm.js after compilation is done. 2021-04-07 13:38:59 -07:00
Dillon Kearns
c12d562834 No more express! 🎉 2021-04-07 13:15:33 -07:00
Dillon Kearns
0a0ea64a1f Compile Elm in dev server. 2021-04-07 12:17:09 -07:00
Dillon Kearns
4e87def89e Remove log and set explicit content-type. 2021-04-07 08:35:51 -07:00
Dillon Kearns
978305765e Hot reloads for content.json. 2021-04-07 08:22:46 -07:00
Dillon Kearns
80a2ea26b6 Wire in initial HMR for elm.js code. 2021-04-06 18:26:24 -07:00
Dillon Kearns
37d19c84d8 Stop converting compiled Elm to ESM. 2021-04-06 13:09:00 -07:00
Dillon Kearns
a30cb4c20c Update generator. 2021-04-06 12:25:50 -07:00
Dillon Kearns
06301c7712 Add starting point for dev server. 2021-04-06 08:21:22 -07:00
Dillon Kearns
5f27593904 Add readfile and glob handlers in render function. 2021-04-06 06:13:33 -07:00
Dillon Kearns
f33eb9b094 Set process.exitCode instead of doing unsafe process.exit operation. 2021-04-06 06:12:20 -07:00
Dillon Kearns
745d714a44 Add render function to StaticResponses module. 2021-04-05 20:58:28 -07:00
Dillon Kearns
89650a4eb1 Merge branch 'serverless' into static-files
# Conflicts:
#	examples/docs/package-lock.json
#	examples/docs/src/Template/BlogIndex.elm
#	examples/docs/src/Template/Page.elm
#	generator/src/cli.js
#	netlify.toml
#	package-lock.json
#	package.json
#	src/Pages/Internal/Platform/Cli.elm
#	tests/BetaStaticHttpRequestsTests.elm
#	tests/StaticHttpRequestsTests.elm
2021-04-05 19:49:08 -07:00
Dillon Kearns
6482a46a08 Handle Index.elm path. 2021-04-05 16:58:13 -07:00
Dillon Kearns
5e8a07aad6 Remove hardcoding. 2021-04-05 16:50:22 -07:00
Dillon Kearns
cbc232b8ce Remove unused body field. 2021-04-05 16:31:59 -07:00
Dillon Kearns
e8f9b2cfa5 Remove unused. 2021-04-05 16:23:20 -07:00
Dillon Kearns
6a1bac4ec7 Remove unused code. 2021-04-05 16:11:12 -07:00
Dillon Kearns
ca9765b62a Remove more webpack-related files. 2021-04-05 15:09:34 -07:00
Dillon Kearns
a6730d9535 Remove some debugging settings. 2021-04-05 14:48:22 -07:00
Dillon Kearns
c9c63b8a3b Remove webpack dependencies! 🎉 2021-04-05 14:44:43 -07:00
Dillon Kearns
c581591114 Remove webpack-related files. 2021-04-05 14:29:27 -07:00
Dillon Kearns
6bc4c8aab0 Remove unused code. 2021-04-05 14:25:37 -07:00
Dillon Kearns
9f6d953f1c Remove some webpack-related files. 2021-04-05 14:12:05 -07:00
Dillon Kearns
c6e1245c99 Delete unused module. 2021-04-05 14:03:08 -07:00
Dillon Kearns
5d496c3834 Run entrypoint directly with generated code instead of wiring it in with a Main.elm. 2021-04-05 13:59:21 -07:00
Dillon Kearns
565c62bccb Wire in RouteParams to static payload. 2021-04-05 07:48:26 -07:00
Dillon Kearns
5532a7c29c Generalize generated routes with route params. 2021-04-05 07:20:12 -07:00
Dillon Kearns
1f7bb61452 Remove some hardcoding in the generated code. 2021-04-05 06:35:51 -07:00
Dillon Kearns
c77f9caceb Handle nested routes in generator script. 2021-04-05 06:35:23 -07:00
Dillon Kearns
a74254773f Wire in route to staticData. 2021-04-04 20:47:25 -07:00
Dillon Kearns
02c9c16cf3 Remove log statement. 2021-04-04 19:29:29 -07:00
Dillon Kearns
90d39610d3 Handle a nested Page Template route with some hardcoding. 2021-04-04 18:23:48 -07:00
Dillon Kearns
0952b45592 Update scaffolding function. 2021-04-03 21:20:50 -07:00
Dillon Kearns
6ef3000011 Handle initial StaticHttp requests to get routes. 2021-04-03 13:08:02 -07:00
Dillon Kearns
66d407b5c8 Add hardcoded fetch for static routes. 2021-04-03 09:53:42 -07:00
Dillon Kearns
a149c02df3 Remove unused Content data. 2021-04-02 20:28:31 -07:00
Dillon Kearns
3372c04e0d Remove TemplateType. 2021-04-02 15:29:59 -07:00
Dillon Kearns
1bc22f10b3 Remove RenderedBody references. 2021-04-02 15:21:17 -07:00
Dillon Kearns
2d3cf86a0c Remove Documents module. 2021-04-02 15:07:14 -07:00
Dillon Kearns
c13fa23e12 Wire in urlToRoute. 2021-04-02 13:36:11 -07:00
Dillon Kearns
b244a70e44 Wire through route type. 2021-04-01 21:23:55 -07:00
Dillon Kearns
dd81c22ec4 Add starting point for generated url parser, remove unused argument. 2021-04-01 14:10:01 -07:00
Dillon Kearns
abcae65b36 Remove all references to Metadata. 2021-04-01 12:56:33 -07:00
Dillon Kearns
1e5d6b8a0e Add file path and glob handlers. 2021-03-31 19:55:28 -07:00
Dillon Kearns
ec2247cdad Include content.json in pre-rendered HTML instead of having a fetch hint for content.json. 2021-03-29 09:15:54 -07:00
Dillon Kearns
11835f155f Handle incoming content.json requests in render serverless function. 2021-03-29 08:59:53 -07:00
Dillon Kearns
0c564bc5fe Clean up serverless render adapter code and return HTML error code. 2021-03-28 19:30:55 -07:00
Dillon Kearns
650a3e9cee Don't load content.json if it's there in the rendered page. 2021-03-25 10:21:01 -07:00
Dillon Kearns
ec7ba930b9 Run renderer for the specific page being requested only, not all pages. 2021-03-25 08:04:59 -07:00
Dillon Kearns
ee58c3f20c Prettier formatting. 2021-03-25 08:00:36 -07:00
Dillon Kearns
6c2c749ac5 Remove unused code. 2021-03-23 22:36:15 -07:00
Dillon Kearns
d63ce72018 Use __dirname to resolve path. 2021-03-23 22:28:00 -07:00
Dillon Kearns
cf78609367 Copy elm-pages CLI compiled Elm code to functions folder for renderer. 2021-03-23 22:19:58 -07:00
Dillon Kearns
05e220b51d Update directory context in renderer function. 2021-03-23 21:03:10 -07:00
Dillon Kearns
418c7396cd Remove unused renderer code. 2021-03-23 20:46:28 -07:00
Dillon Kearns
71b32795e5 Add initial hardcoded serverless render prototype. 2021-03-23 19:34:12 -07:00
Dillon Kearns
2b14d6e7af Update template modules template. 2021-03-01 10:16:46 -08:00
Dillon Kearns
5d44cadbff Include shared model in local state template modules. 2021-02-27 08:35:06 -08:00
Y0hy0h
afe554e1be Remove unused shellCommand() and its imports 2021-02-16 12:15:36 +01:00
Y0hy0h
0e7f65e9a6 Use cross-spawn instead of child_process 2021-02-16 12:14:41 +01:00
Dillon Kearns
4a93623b7a Add conditionals in preparation for beta build CLI flag for beta (currently hardcoded to false). 2021-02-06 08:36:45 -08:00
Dillon Kearns
d702764be2 Run terser inline instead of through npx in elm-pages-beta build command. 2021-01-09 10:55:11 -08:00
Dillon Kearns
cc4a07605d Generate template modules file. 2020-10-30 10:32:52 -07:00
Dillon Kearns
ec88c4fa78 Use template modules file plus pages.elm file for fingerprint. 2020-10-30 10:30:24 -07:00
Dillon Kearns
1a183799a4 Only copy Template.elm module once. 2020-10-30 10:27:33 -07:00
Dillon Kearns
168c3a9384 Back to webpack dev server with no template modules codegen. 2020-10-30 10:11:34 -07:00
Dillon Kearns
5938b5d7d9 Fix dev server infinite re-building, and fix the double compilation for dev server. 2020-10-29 10:27:27 -07:00
Dillon Kearns
725101fec9 Fix infinite looping in elm-pages develop from the new generated module. 2020-10-28 07:46:55 -07:00
Dillon Kearns
27fb6a4f82 Make cli script executable. 2020-10-26 20:36:05 -07:00
Dillon Kearns
04792c15d6 Ensure slash separator for content.json fetch. 2020-10-26 20:35:42 -07:00
Dillon Kearns
634f269801 Add closing head tag. 2020-10-26 19:09:45 -07:00
Dillon Kearns
b26d05b88c Generate Template.elm module. 2020-10-26 11:03:43 -07:00
Dillon Kearns
3aa978578b Update template modules file name. 2020-10-26 10:50:11 -07:00
Dillon Kearns
7478642190 Wire in OnPageChange to shared. 2020-10-25 12:06:08 -07:00
Dillon Kearns
3964dc43b6 Use Maybe instead of NoOp for SharedMsg's. 2020-10-25 11:24:52 -07:00
Dillon Kearns
75cca61597 Add a generator for the template modules beta. 2020-10-25 09:15:17 -07:00
Dillon Kearns
3aaf631c62 Generate template modules file in beta build. 2020-10-24 16:35:54 -07:00
Dillon Kearns
12d9decf04 Fix type variables in template modules. 2020-10-24 15:46:01 -07:00
Dillon Kearns
3442cf02a8 Merge branch 'master' into template-modules
# Conflicts:
#	.gitignore
#	examples/docs/src/Main.elm
2020-10-24 13:02:17 -07:00
Dillon Kearns
938692b518 Rename some files in dist and add some preload tags. 2020-10-23 15:56:39 -07:00
Dillon Kearns
61686bd3f7 Make sure elm-optimize-level-2 was successful or else fail beta build. 2020-10-23 15:42:40 -07:00
Dillon Kearns
4ecad413d9 Add generator version. 2020-10-21 10:14:00 -07:00
Dillon Kearns
1d71e5433d Copy style entrypoint from beta-style.css. 2020-10-20 20:55:30 -07:00
Dillon Kearns
2dad51714f Rename entry point to beta-index. 2020-10-20 20:52:36 -07:00
Dillon Kearns
48c31bcca2 Get docs site compiling with elm-pages build/develop. 2020-10-20 19:30:52 -07:00
Dillon Kearns
7376288e88 Pass through title to cli, add icon meta tags, fix external image url to not prepend canonical url. 2020-10-20 19:11:58 -07:00
Dillon Kearns
61a46aef91 Add icons to manifest config. 2020-10-20 16:41:00 -07:00
Dillon Kearns
a4a34f893d Add shebang line for beta cli. 2020-10-19 22:42:26 -07:00
Dillon Kearns
c7af54bbe8 Move file. 2020-10-19 22:30:47 -07:00
Dillon Kearns
e4bcf3f00c Clear service worker registrations. 2020-10-19 21:55:40 -07:00
Dillon Kearns
a9e2ece36d Try creating directory before generating file. 2020-10-19 19:02:50 -07:00
Dillon Kearns
6966d5d5f3 Await mkdir to ensure directory exists before continuing. 2020-10-19 18:45:20 -07:00
Dillon Kearns
dc6c9e9692 Fix head tag renderer. 2020-10-18 19:19:37 -07:00
Dillon Kearns
6910f32c42 Exit with non-zero status code when error is present. 2020-10-17 21:15:56 -07:00
Dillon Kearns
299ebd0edc Use codecs to send out ports to JS. 2020-10-17 18:58:17 -07:00
Dillon Kearns
5a7374114a Copy image directory to dist. 2020-10-16 18:51:29 -07:00
Dillon Kearns
c960dffdca Make sure files exist before trying to mkdir. 2020-10-16 18:41:13 -07:00
Dillon Kearns
1f76899971 Copy nested directory for images folder. 2020-10-16 18:21:28 -07:00
Dillon Kearns
129e9360b1 Move static and image folder contents into dist dir. 2020-10-16 18:00:27 -07:00
Dillon Kearns
22d66c4760 Copy index template in build step. 2020-10-16 16:30:10 -07:00
Dillon Kearns
17aa244fc6 Run terser with npx. 2020-10-16 15:59:43 -07:00
Dillon Kearns
9faaa69e11 Use util.promisfy to ensure compatibility with Node 12. 2020-10-16 15:43:11 -07:00
Dillon Kearns
b8a7b95698 Generate files. 2020-10-16 15:33:51 -07:00
Dillon Kearns
3643f5666d Write out manifest.json file. 2020-10-16 15:19:46 -07:00
Dillon Kearns
8c3e27b3ff Add generate-manifest js function. 2020-10-16 10:36:25 -07:00
Dillon Kearns
4137773928 Import user-index in example. 2020-10-16 10:36:12 -07:00
Dillon Kearns
cc78cb40c5 Add data-url div to example boilerplate. 2020-10-15 20:41:35 -07:00
Dillon Kearns
6c1781b154 Remove hardcoding of raw body in content.json. 2020-10-15 06:33:16 -07:00
Dillon Kearns
3e4ce8dc29 Extract constant. 2020-10-15 06:17:32 -07:00
Dillon Kearns
0b168e5e25 Clean up some async cli code. 2020-10-15 06:10:24 -07:00
Dillon Kearns
9c117fa854 Copy stylesheet and js entrypoint in async function. 2020-10-14 13:21:02 -07:00
Dillon Kearns
3785838fd9 Copy stylesheet and include it. 2020-10-14 12:59:31 -07:00
Dillon Kearns
81df8b7094 Log after pre-rendering each route. 2020-10-13 21:54:23 -07:00
Dillon Kearns
ad0059037a Log http requests with port. 2020-10-13 21:18:15 -07:00
Dillon Kearns
2f6a773b0c Run code generation in beta cli. 2020-10-13 10:03:36 -07:00
Dillon Kearns
eb9c339dcd Run terser. 2020-10-12 18:30:50 -07:00
Dillon Kearns
df3213148f Refactor duplicate shell execution code. 2020-10-12 17:54:05 -07:00
Dillon Kearns
ef952f6acb Add some type annotations. 2020-10-12 17:20:34 -07:00
Dillon Kearns
6a32b0ca5c Include logic for base routes. 2020-10-12 17:03:35 -07:00
Dillon Kearns
a0e3fa0043 Fix issue with importing index.js in beta. 2020-10-12 16:05:46 -07:00
Dillon Kearns
5d6d555849 Run terser on output. 2020-10-11 22:22:58 -07:00
Dillon Kearns
802f43cfb5 Import elm code as an es6 module. 2020-10-11 22:18:33 -07:00
Dillon Kearns
86ea65a3ba Generate multiple pages, and show error messages. 2020-10-11 21:21:34 -07:00
Dillon Kearns
40c3f5a16c Render head tags in beta pre-renderer. 2020-10-11 08:43:38 -07:00
Dillon Kearns
7beaf5ddaf Set up proof of concept for webpack-free build. 2020-10-10 18:07:36 -07:00
Dillon Kearns
707e4837e1 Extract shared template function to collect functions in a single entrypoint. 2020-10-04 13:35:33 -07:00
Dillon Kearns
6b5b21e709 Update Template types. 2020-09-30 13:05:35 -07:00
Dillon Kearns
dd3f824e4e Remove DynamicPayload type and update TemplateType wiring. 2020-09-16 21:08:12 -07:00
Dillon Kearns
fce79cdaf6 Rename GlobalMetadata to TemplateType. 2020-09-16 19:18:25 -07:00
Dillon Kearns
e71e90172a Wire in subscriptions for templates. 2020-09-14 22:05:36 -07:00
Dillon Kearns
55f2a4bcd4 Wire in DynamicPayload for Template modules' update. 2020-09-13 16:38:57 -07:00
Dillon Kearns
785d6ae85a Use site config module. 2020-09-13 07:19:09 -07:00
Dillon Kearns
a9db326fa4 Rename some global things to shared. 2020-09-12 09:16:56 -07:00
Dillon Kearns
6214964257 Rename global to shared. 2020-09-12 09:15:24 -07:00
Dillon Kearns
b762c655a4 Rename module. 2020-09-06 13:37:24 -07:00
Dillon Kearns
9a4fd9a3f3 Remove unused import. 2020-09-06 13:12:55 -07:00
Dillon Kearns
d6790c479c Use static payload for head function. 2020-09-06 12:42:05 -07:00
Dillon Kearns
40614be38f Pass in global static in static bundle. 2020-09-06 12:29:46 -07:00
Dillon Kearns
651de61146 Change Template signatures and use Template alias instead of TemplateDocument module. 2020-09-06 08:41:24 -07:00
Dillon Kearns
eb8c0ffabc Remove save hook. 2020-09-05 22:17:28 -07:00
Dillon Kearns
57310bacd8 Wire in global model to view. 2020-09-05 21:31:14 -07:00
Dillon Kearns
87eb2408cc Stop generating save function. 2020-09-05 21:13:38 -07:00
Dillon Kearns
b66b0ba45c Wire up new shared update msg. 2020-09-05 21:02:05 -07:00
Dillon Kearns
e4a703b8d4 Wire in load function on global msgs. 2020-09-02 07:57:33 -07:00
Dillon Kearns
dc9e34207a Init local model with load from global model. 2020-09-01 23:49:23 -07:00
Dillon Kearns
6bebe4f32c Persist global state. 2020-09-01 23:03:50 -07:00
Dillon Kearns
9e8659b305 Remove toMsg and toGlobalMsg and change msg type for rendered document. 2020-09-01 22:38:57 -07:00
Dillon Kearns
3a0196b69d Use save function on template model updates. 2020-09-01 17:39:05 -07:00