Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Add support for generating and initializing site projects #632

Merged
merged 9 commits into from
Sep 19, 2019

Conversation

ashleymichal
Copy link
Contributor

wrangler generate --site

# creates a new directory structure from an external repo (currently not the real thing)
$ wrangler generate --site
$ cd worker
$ tree
.
├── README.md
├── public
│   └── index.html
├── workers-site
│   ├── index.js
│   ├── package-lock.json
│   └── package.json
└── wrangler.toml
# update the wrangler.toml here to have bucket = "./public"
$ wrangler publish

wrangler init --site

inside an existing project, run

$ wrangler init --site
tree (in addition to your existing project)
.
├── workers-site
│   ├── index.js
│   ├── package-lock.json
│   └── package.json
└── wrangler.toml
# update the wrangler.toml with your build asset folder
$ wrangler publish

@ashleymichal ashleymichal added changelog - feature regression Something is broken, but works in previous releases sites labels Sep 19, 2019
@ashleymichal ashleymichal added this to the KV Additions milestone Sep 19, 2019
@ashleymichal ashleymichal self-assigned this Sep 19, 2019
@gabbifish
Copy link
Contributor

note to self: I think it would be super important to highlight that folks bringing their own site generators should wrangler init --site and to print out a message saying something along the lines of "Hello! please change your bucket value in wrangler.toml to the output directory of your static site generator."

Copy link
Contributor

@gabbifish gabbifish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments attached! An overarching thing I'm a confused about is where the scaffolding is introduced--this PR makes it seem like it happens in init, but I guess I thought it was supposed to happen in generate?

src/commands/build/wranglerjs/mod.rs Outdated Show resolved Hide resolved
src/commands/build/wranglerjs/mod.rs Outdated Show resolved Hide resolved
src/commands/generate.rs Outdated Show resolved Hide resolved
src/commands/generate.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/settings/target/mod.rs Outdated Show resolved Hide resolved
src/settings/target/mod.rs Outdated Show resolved Hide resolved
@gabbifish gabbifish self-requested a review September 19, 2019 22:03
@@ -182,6 +188,27 @@ fn setup_build(target: &Target) -> Result<(Command, PathBuf, Bundle), failure::E
Ok((command, temp_file, bundle))
}

pub fn scaffold_site_worker(target: &Target) -> Result<(), failure::Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg this is still killing me. do we just go ahead with this?

Copy link
Contributor

@gabbifish gabbifish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving given the little time we have atm. we can do nitty cleanup later!

@ashleymichal ashleymichal merged commit 5385c86 into feat-kv-additions Sep 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the alewis/build-site branch September 19, 2019 22:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Something is broken, but works in previous releases sites
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants