Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Primer #404

Merged
merged 16 commits into from Jul 24, 2017
Merged

Update Primer #404

merged 16 commits into from Jul 24, 2017

Conversation

sophshep
Copy link

@sophshep sophshep commented Jun 21, 2017

I've updated to our new version of Primer (primer-css@7.0.0-2), as listed here: primer/css#230 (comment). No issues! Everything worked as expected 🎉

I'd love to merge this since it updates all the colors and other various improvements we've made to primer in the time since it was last included here!

cc/ @github/design-systems

@@ -1 +0,0 @@
.state{display:inline-block;padding:4px 8px;font-weight:600;line-height:20px;color:#fff;text-align:center;background-color:#999;border-radius:3px}.state-open,.state-proposed,.state-reopened{background-color:#6cc644}.state-merged{background-color:#6e5494}.state-closed{background-color:#bd2c00}.state-renamed{background-color:#fffa5d}
Copy link
Member

Choose a reason for hiding this comment

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

If you need primer-states then include the primer-labels package. States were moved into the labels package, and the labels package was added to the product package. If you don't need states then you can delete all these files and references to them.

Copy link
Author

Choose a reason for hiding this comment

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

👍 ... i don't need them. will delete.

Copy link
Member

@broccolini broccolini left a comment

Choose a reason for hiding this comment

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

Thanks for testing this @sophshep 💖 Happy to hear things are working as expected.

Heads up, this version of Primer is a pre-release which I set up for testing before merging in the monorepo pr. It's totally fine to leave the open source site pointing to this, however I will be updating this to a major release once I've merged in the primer monorepo pr (probably today). You can update to the major release when I've published that if you like. Nothing should really change apart from this number and maybe some content on the primer readme, so should be fairly simple to update.

@hzoo hzoo mentioned this pull request Jun 24, 2017
9 tasks
@bkeepers bkeepers mentioned this pull request Jun 27, 2017
@nayafia
Copy link
Contributor

nayafia commented Jul 11, 2017

@broccolini @sophshep hi! 👋 ok to merge this, or do we need to update version?

@sophshep
Copy link
Author

do we need to update version?

@nayafia We should update to an even newer version! I'll take care of this this week.

@sophshep
Copy link
Author

This is good to go from the design side. All markup has been updated to allow for new changes from the latest version of Primer.

One thing that has me stumped is the failing CI test. It says $gray-300 is an undefined variable, but it's almost definitely not. I tested it here and it compiled and changed visually, so I'm not sure how to troubleshoot.

Any ideas @github/design-systems & @MikeMcQuaid?

@shawnbot
Copy link
Contributor

Hey @sophshep, I think the problem is that Travis is caching your node_modules directory. I honestly don't know how the Travis cache interacts with having that directory committed in git — which is generally not recommended, but might be necessary here because you need to publish the site on Pages? But it's possible that Travis is overwriting the directory with whatever is in its cache before building.

If you need to publish on Pages with npm modules, there are two ways that might work better than committing node_modules:

  1. Write some scripts that copy the requisite SCSS files from node_modules/primer-*/**/*.scss to Jekyll's Sass directory (e.g. _sass), and commit that directory to git.
  2. Build the site in CI and publish the resulting static files from Travis using a tool like gh-pages.

I'll try blowing away the cache and restarting the build, and if that works we can discuss whether it makes sense to change the publishing strategy.

@shawnbot
Copy link
Contributor

Well, deleting the cache for this branch didn't do it. I cloned the repo locally, ran script/test, and got a completely different error from Travis (formatted for clarity):

Conversion error:
Jekyll::Converters::Scss encountered an error while converting 'assets/css/index.scss':
File to import not found or unreadable: ./lib/variables/typography.scss.
Load paths: <paths> /Users/shawnbot/github/opensource.guide/assets/css on line 2

A bunch of other load paths were listed where I put the <paths> placeholder, and those are added by this line. Adding nested node_modules directories is unnecessary if you're using npm@3 or greater, which uses a flat dependency tree. You can confirm this by making sure that all of the primer-* directories are listed in node_modules, rather than as subdirectories of the individual modules.

Anyway, that's not really the problem. On my end, it looks like primer-support@4.0.7 was installed without a lib/variables directory:

shawnbot@github:~/github/opensource.guide% tree node_modules/primer-support 
node_modules/primer-support
├── CHANGELOG.md
├── LICENSE
├── README.md
├── index.scss
├── lib
│   └── mixins
│       ├── buttons.scss
│       ├── layout.scss
│       ├── misc.scss
│       └── typography.scss
└── package.json

2 directories, 9 files

But, if unpkg is to be believed, this directory was published, and it includes $gray-300. So... no idea. I reinstalled everything with npm install --force, and that did the right thing. But then I got another, completely different error:

Conversion error:
Jekyll::Converters::Scss encountered an error while converting 'assets/css/index.scss':
Undefined variable: "$alt-body-font". on line 106

shawnbot and others added 7 commits July 21, 2017 14:35
Previously, `node_modules` was in `.gitignore` because there was a lot
of dependencies for the tests that don't need to be committed. However,
npm is also used to manage the primer dependency, which _does_ need to
be committed so GitHub Pages can build the website. At some point,
someone (whose name rhymes with "Landon Creepers") thought it'd be fine
to just type `git add -f node_modules/primer*` to commit the primer
dependencies and leave everything else ignored. This works…until you
want to update primer. Any update requires that the author knows about
this awful `.gitignore` setup, and uses the dreadful `-f` flag.

This commit:

- Moves the dependencies needed for tests into `test/package.json`
- Adds `test/node_modules` to `.gitignore`
- Removes `node_modules` from `.gitignore`
@bkeepers
Copy link

@shawnbot, @sophshep: sorry for the confusion with tests failing. The fix was to git add -f node_modules/primer* (3c955ad) and then remove node_modules from .gitignore (longer explanation for why this was set up like this in the first place in 874a049).

Quora appears to be acting up, which was breaking the tests again, so I ignored that from the link checker.

@bkeepers bkeepers merged commit e2783c4 into gh-pages Jul 24, 2017
@bkeepers bkeepers deleted the upgrade-primer branch July 24, 2017 17:54
@shawnbot
Copy link
Contributor

Fantastic, thanks @bkeepers! 🍻

Copy link

@WojasKrk WojasKrk left a comment

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants