Skip to content

Reorganize docs for easier deploys#26732

Merged
mdo merged 13 commits intov4-devfrom
mv-docs
Jul 12, 2018
Merged

Reorganize docs for easier deploys#26732
mdo merged 13 commits intov4-devfrom
mv-docs

Conversation

@mdo
Copy link
Copy Markdown
Member

@mdo mdo commented Jun 21, 2018

With the current docs directory setup, I'm making too many mistakes and have to manually address path changes and directory moves on deploy. This makes for a frustrating experience developing locally and shipping releases. With this PR, we're basically back to the same setup from v3—duplicating the dist/ directory into our site/docs/ directory. Not the most ideal, but very straightforward for me as the release manager.

I still need to double check the service worker stuff, asset paths, and confirm the watch tasks pickup the copy-pasta.

/cc @twbs/team


  • mkdir site
  • git mv docs/ site/docs/
  • git mv _layouts/ site/_layouts/
  • git mv _data/ site/_data/
  • git mv _includes site/_includes/
  • git mv assets site/docs/4.1/assets/
  • Update _config.yml's source to "site"
  • git mv favicon.ico site/favicon.ico
  • git mv index.html site/index.html
  • git mv sw.js site/sw.js
  • git mv robots.txt site/robots.txt
  • Update sw.js path
  • Update CSS/JS paths
  • Update social image paths
  • Modify package.json scripts do duplicate dist into site directory
    • css-main needs && cp -r dist/css/ site/docs/4.1/dist/css/ added
    • js-main needs && cp -r dist/js/ site/docs/4.1/dist/js/ added
  • Test, test, test!

Fixes #26637 and fixes #26267 along the way.

@mdo mdo force-pushed the mv-docs branch 2 times, most recently from 62b4535 to f91e7ff Compare June 21, 2018 04:33
@XhmikosR
Copy link
Copy Markdown
Member

Oops, sorry for the conflicts.

I haven't tested this myself, I will try it, but I'm not sure how many things one can catch locally :/ I mean, most, if not all of the issues, emerged in the live site.

@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jun 21, 2018

I haven't tested this myself, I will try it, but I'm not sure how many things one can catch locally :/ I mean, most, if not all of the issues, emerged in the live site.

That's right, and those all resulted from the versioning of our docs and me manually moving directories around and then globally find-and-replacing paths. Was bound to blow up in my face :). We'll know soon enough!

And no worries on conflicts, I can resolve.

@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jun 22, 2018

@Johann-S @XhmikosR Can you peep the JS test changes in c38f49e? I'm not worried right now since these paths are referencing files that are not included in the npm package or anything like that.

@mdo mdo force-pushed the mv-docs branch 3 times, most recently from 322726c to 0ce65aa Compare June 22, 2018 02:07
@XhmikosR
Copy link
Copy Markdown
Member

Looks good to me. Are there any other such changes in the branch? I still haven't had the time to test the branch :/ I'll do it later today.

@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jun 22, 2018

@XhmikosR Pushed some more changes to fine tune the watch and dist scripts. This takes care of my two primary workflows, but I want to make sure paths, service worker, and other things are working for you locally with the latest changes here.

Comment thread package.json Outdated
"bundlesize": "^0.15.3",
"clean-css-cli": "^4.1.11",
"coveralls": "^3.0.1",
"cpx": "^1.5.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need cpx? We already have shx.

Comment thread _config.yml Outdated
- sache.json
- twbsconfig.yml
- docs/4.1/assets/scss/
- docs/4.1/assets/js/src/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is needed for development.

@XhmikosR
Copy link
Copy Markdown
Member

Service worker generation is currently broken (npm run docs-github).

Also, I'm not sure the redirects make sense any more; we'd need to check each one.

And it seems one has to manually run the css-copy and js-copy tasks before building locally. You didn't notice because you have those files there already.

In that case, we are better off hooking up a predocs-compile script which will run the 2 copy tasks.

@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jun 25, 2018

@XhmikosR For our service worker file, do we need to version that as well I assume? Would replacing it with v4.2's cause issues for the docs in /4.1/ once live?

@XhmikosR
Copy link
Copy Markdown
Member

I'm not sure about it, TBH. In theory, since the service worker is registered in the root, it will cover everything for us.

I still need to test this locally and try and see if there's something else broken.

@XhmikosR
Copy link
Copy Markdown
Member

@mdo: can you do a rebase against v4-dev?

@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jul 3, 2018

@XhmikosR I added some script changes to simplify local dev and more. Check out 21c3af9 and 492d3b5 when you have time—this should ensure the copy tasks happen at all times. I've tested changes to docs CSS and JS, as well as the main CSS and JS.

Also tested running the npm start to account for my usual dev workflow and running build/ship.sh 4.1.2 to see how shipping goes. So far, so good, save for one thing in Chrome. Note though that I'm running the beta of macOS Mojave, so that might cause some issues.

screen shot 2018-07-03 at 1 11 56 am

@XhmikosR
Copy link
Copy Markdown
Member

XhmikosR commented Jul 3, 2018

@mdo: I'm gonna try to test this branch in the next days and let you know.

A couple of things:

  1. tests break
  2. it's the first time I see the inject.preload.js; make sure you clear the localhost service worker if you use the same address with a service worker. I will confirm this when I try the branch
  3. should I update my rebased branch and force push to this one?

@XhmikosR
Copy link
Copy Markdown
Member

XhmikosR commented Jul 3, 2018

Oh, might be one of your extensions for issue 2.

@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jul 3, 2018

Can confirm, it's from an extension. Disabled them and it's clear. Broken tests appear to be from broken links—reviewing those now. And yes, feel free to force push after tests are fixed :).

@XhmikosR
Copy link
Copy Markdown
Member

XhmikosR commented Jul 8, 2018

@XhmikosR
Copy link
Copy Markdown
Member

XhmikosR commented Jul 8, 2018

Also, @mdo do you want this in 4.1.2 or 4.2.0? If it's 4.1.2 I'll test it ASAP today or tomorrow.

@mdo mdo mentioned this pull request Jul 9, 2018
mdo and others added 13 commits July 12, 2018 09:11
With the current docs directory setup, I'm making too many mistakes and have to manually address path changes and directory moves on deploy. This makes for a frustrating experience developing locally and shipping releases. With this PR, we're basically back to the same setup from v3—duplicating the dist directory into our docs directory. Not the most ideal, but very straightforward for me as the release manager.
- Updates nodemon scripts to watch specific directories instead of ignoring several
- Split watch tasks for CSS and JS into main and docs
- Add docs-watch script to serve the docs instead of just build
- Add new start script so that instead of two tabs, one for docs-watch and one for watch, we just run npm start
@mdo
Copy link
Copy Markdown
Member Author

mdo commented Jul 12, 2018

CI failures are very likely rate limits, so merging away!

@mdo mdo merged commit 6589408 into v4-dev Jul 12, 2018
@mdo mdo deleted the mv-docs branch July 12, 2018 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants