From 9bf343a9b41a5478f757a6e232602d4b5747acf5 Mon Sep 17 00:00:00 2001 From: Jon Rohan Date: Thu, 25 Mar 2021 16:11:16 -0700 Subject: [PATCH] Put migration info back --- .../content/support/v16-migration.mdx | 102 +++--------------- 1 file changed, 15 insertions(+), 87 deletions(-) rename MIGRATING.md => docs/content/support/v16-migration.mdx (78%) diff --git a/MIGRATING.md b/docs/content/support/v16-migration.mdx similarity index 78% rename from MIGRATING.md rename to docs/content/support/v16-migration.mdx index 7ed0bbba..97d7a5ef 100644 --- a/MIGRATING.md +++ b/docs/content/support/v16-migration.mdx @@ -1,8 +1,11 @@ -# 16.0.0 +--- +title: Primer v16 Migration Guide +description: 'Guide for migrating to version 16.0.0 of Primer' +--- Primer v16.0.0 introduces the idea of _color modes_ and _functional variables_. A color mode defines a set of colors in the Primer system that differs from that of other color modes. Currently, Primer ships with a light mode and a dark mode. -Because colors differ in each color mode, it doesn't make sense to try to make an element a specific color; instead, Primer now applies colors based on the function of an element using functional variables. As a result, the Sass color variables that existed in Primer prior to version 16.0.0 have been replaced with functional CSS variables. These variables have different values depending on the current color mode. For a list of the new functional CSS color variables, see [the color system page](https://primer.style/support/color-system). The color utility classes have also been updated to match; see [the color utilities page](https://primer.style/utilities/colors) for more information. +Because colors differ in each color mode, it doesn't make sense to try to make an element a specific color; instead, Primer now applies colors based on the function of an element using functional variables. As a result, the Sass color variables that existed in Primer prior to version 16.0.0 have been replaced with functional CSS variables. These variables have different values depending on the current color mode. For a list of the new functional CSS color variables, see [the color system page](/support/color-system). The color utility classes have also been updated to match; see [the color utilities page](/utilities/colors) for more information. ## Migration guide @@ -18,20 +21,20 @@ Most components don't need to be updated and should work without making changes. #### Counters -| `v15` | `v16` | +| [`v15`](https://primer.style/css/components/labels#counters) | `v16` | | ------------------------------------------------------------ | --------------------- | | `.Counter--gray` | `.Counter--primary` | | `.Counter--gray-light` | `.Counter--secondary` | #### Dropdwon -| `v15` | `v16` | +| [`v15`](https://primer.style/css/components/dropdown#dark) | `v16` | | ---------------------------------------------------------- | ----- | | `.dropdown-menu-dark` | n/a | #### Labels -| `v15` | `v16` | +| [`v15`](https://primer.style/css/components/labels) | `v16` | | --------------------------------------------------- | ------------------- | | `.Label--gray-darker` | `.Label--primary` | | `.Label--gray` | `.Label--secondary` | @@ -45,7 +48,7 @@ Most components don't need to be updated and should work without making changes. #### States -| `v15` | `v16` | +| [`v15`](https://primer.style/css/components/labels#states) | `v16` | | ---------------------------------------------------------- | ---------------- | | n/a | `.State--draft` | | `.State--green` | `.State--open` | @@ -54,11 +57,11 @@ Most components don't need to be updated and should work without making changes. ### Utility classes -See [the color utility classes page](https://primer.style/utilities/colors) for a list of all the functional color utility classes. +See [the color utility classes page](/utilities/colors) for a list of all the functional color utility classes. #### Text -| `v15` | `v16` | +| [`v15`](https://primer.style/css/utilities/colors#text-color-utilities) | `v16` | | ----------------------------------------------------------------------- | ----------------------- | | `.text-gray-dark` | `.color-text-primary` | | `.text-gray` | `.color-text-secondary` | @@ -89,7 +92,7 @@ See [the color utility classes page](https://primer.style/utilities/colors) for #### Border -| `v15` | `v16` | +| [`v15`](https://primer.style/css/utilities/borders#border-color-utilities) | `v16` | | -------------------------------------------------------------------------- | ------------------------- | | `.border-gray` | `.color-border-primary` | | `.border-gray-light` | `.color-border-secondary` | @@ -114,7 +117,7 @@ See [the color utility classes page](https://primer.style/utilities/colors) for #### Background -| `v15` | `v16` | +| [`v15`](https://primer.style/css/utilities/colors#background-utilities) | `v16` | | ----------------------------------------------------------------------- | --------------------------- | | `.bg-white` | `.color-bg-primary` | | `.bg-gray-light` | `.color-bg-secondary` | @@ -150,7 +153,7 @@ See [the color utility classes page](https://primer.style/utilities/colors) for The `link` utilities are part of the `Link` component. -| `v15` | `v16` | +| [`v15`](https://primer.style/css/utilities/colors##link-colors) | `v16` | | --------------------------------------------------------------- | ------------------ | | `.link-gray-dark` | `.Link--primary` | | `.link-gray` | `.Link--secondary` | @@ -168,7 +171,7 @@ The `link` utilities are part of the `Link` component. ### Variables -See [the color system page](https://primer.style/support/color-system) for a list of all the functional CSS variables. +See [the color system page](/support/color-system) for a list of all the functional CSS variables. #### Text @@ -304,78 +307,3 @@ It doesn't always work perfectly, therefore functional variables should be used ### Misc There are a few more selectors and variables that got removed. Please refer to [deprecations.js](https://github.com/primer/css/blob/master/deprecations.js) for a complete list. - -# 12.0.0 -The v12 release marks a major transition from small, single-purpose npm packages (`primer-core`, `primer-marketing`, `primer-utilities`, etc.) to a single package — `@primer/css` — which contains all of the SCSS source files in subdirectories. Here's what you need to do to migrate different parts of your app: - -## npm -First, install the new package. - -```sh -npm install --save @primer/css -``` - -If you use the `primer` package, all you'll need to do is: - -```sh -npm uninstall --save primer -``` - -If you use other packages, such as `primer-utilities`, you will need to uninstall each one by name or use a command line tool like [jq](https://stedolan.github.io/jq/) to list them: - -```sh -jq -r '.dependencies | keys[] | select(.|startswith("primer"))' package.json -``` - -And, if you're feeling saucy, uninstall them all by piping that to `xargs npm uninstall`. :sparkles: - -## Sass -There are a couple of things you'll need to change in your Sass setup when migrating to v12. This section is intentionally vague because environments vary wildly between text editors, Sass implementations, and application frameworks. When in doubt, consult the relevant documentation, and feel free to [file an issue][help] if you think that we can help. - -### Sass imports -Generally speaking, all of your Sass `@import` statements can be migrated with the following search-and-replace operations, **in the following order**: - -* If you import `primer/index.scss` or `primer`, just replace `primer` with `@primer/css` and you're done! -* Otherwise... - 1. Replace `primer-marketing-` with `@primer/css/marketing/`, e.g. - * `primer-marketing-buttons/index.scss` becomes `@primer/css/marketing/buttons/index.scss` - * `primer-marketing-utilities/index.scss` becomes `@primer/css/marketing/utilities/index.scss` - 1. Replace `primer-` with `@primer/css/`, e.g. - * `primer-markdown/index.scss` becomes `@primer/css/markdown/index.scss` - * `primer-utilities/index.scss` becomes `@primer/css/utilities/index.scss` - 1. Delete `lib/` from every Primer CSS path, e.g. - * `primer-forms/lib/form-control.scss` becomes `@primer/css/forms/form-control.scss` - * `primer-navigation/lib/subnav.scss` becomes `@primer/css/navigation/subnav.scss` - -If your text editor supports search and replace regular expressions, the following patterns should work: - -| find | replace | -| :--- | :--- | -| `primer-marketing-(\w+)(\/lib)?` | `@primer/css/marketing/$1` | -| `primer-(\w+)(\/lib)?` | `@primer/css/$1` | -| `primer\b` | `@primer/css` - -#### `primer-migrate` -You can also use the included [`primer-migrate` script](bin/primer-migrate): - -```sh -npx -p @primer/css primer-migrate path/to/**/*.scss -``` - -### Sass include paths -If you've installed Primer CSS with npm, you very likely already have `node_modules` listed in your Sass `includePaths` option, and you won't need to change anything. :tada: - -If you've installed Primer CSS with something _other than_ npm, or you don't know how it was installed, consult the documentation for your setup first, then [let us know][help] if you still can't figure it out. - -## Compiled CSS files - -The compiled CSS files can be found under `/dist` in case you want to directly link to them. - -## Fonts -The marketing-specific font files published in the [`fonts` directory](https://unpkg.com/primer-marketing-support@2.0.0/fonts/) of `primer-marketing-support@2.0.0` are published in the `fonts` directory of `@primer/css`. If you use these fonts, you'll need to do the following: - -1. Update any scripts that copy the `.woff` font files from `node_modules/primer-marketing-support/fonts` into your application to look for them in `node_modules/@primer/css/fonts`. -1. Update any webpack (or other bundler) resolution rules that look for fonts in `primer-marketing-support/fonts` to look for them in `@primer/css/fonts`. -1. Customize the [`$marketing-font-path` variable](src/marketing/support/variables.scss#L1) to match the path from which they're served. - -[help]: https://github.com/primer/css/issues/new?title=Help!&labels=v12,migration