Skip to content

Commit b506954

Browse files
committed
chore: define clean state for nx; remove cache from clean
1 parent 4fe3651 commit b506954

File tree

4 files changed

+163
-165
lines changed

4 files changed

+163
-165
lines changed

README.md

Lines changed: 121 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -45,56 +45,56 @@ Spectrum CSS components have build output that uses CSS custom properties to cha
4545
```html
4646
<!-- Include global variables first -->
4747
<link
48-
rel="stylesheet"
49-
href="node_modules/@spectrum-css/vars/dist/spectrum-global.css"
48+
rel="stylesheet"
49+
href="node_modules/@spectrum-css/vars/dist/spectrum-global.css"
5050
/>
5151

5252
<!-- Include only the scales your application needs -->
5353
<link
54-
rel="stylesheet"
55-
href="node_modules/@spectrum-css/vars/dist/spectrum-medium.css"
54+
rel="stylesheet"
55+
href="node_modules/@spectrum-css/vars/dist/spectrum-medium.css"
5656
/>
5757
<link
58-
rel="stylesheet"
59-
href="node_modules/@spectrum-css/vars/dist/spectrum-large.css"
58+
rel="stylesheet"
59+
href="node_modules/@spectrum-css/vars/dist/spectrum-large.css"
6060
/>
6161

6262
<!-- Include only the colorstops your application needs -->
6363
<link
64-
rel="stylesheet"
65-
href="node_modules/@spectrum-css/vars/dist/spectrum-light.css"
64+
rel="stylesheet"
65+
href="node_modules/@spectrum-css/vars/dist/spectrum-light.css"
6666
/>
6767
<link
68-
rel="stylesheet"
69-
href="node_modules/@spectrum-css/vars/dist/spectrum-dark.css"
68+
rel="stylesheet"
69+
href="node_modules/@spectrum-css/vars/dist/spectrum-dark.css"
7070
/>
7171
<link
72-
rel="stylesheet"
73-
href="node_modules/@spectrum-css/vars/dist/spectrum-darkest.css"
72+
rel="stylesheet"
73+
href="node_modules/@spectrum-css/vars/dist/spectrum-darkest.css"
7474
/>
7575

7676
<!-- Include tokens -->
7777
<link
78-
rel="stylesheet"
79-
href="node_modules/@spectrum-css/tokens/dist/index.css"
78+
rel="stylesheet"
79+
href="node_modules/@spectrum-css/tokens/dist/index.css"
8080
/>
8181

8282
<!-- Include index-vars.css for all components you need -->
8383
<link
84-
rel="stylesheet"
85-
href="node_modules/@spectrum-css/page/dist/index-vars.css"
84+
rel="stylesheet"
85+
href="node_modules/@spectrum-css/page/dist/index-vars.css"
8686
/>
8787
<link
88-
rel="stylesheet"
89-
href="node_modules/@spectrum-css/typography/dist/index-vars.css"
88+
rel="stylesheet"
89+
href="node_modules/@spectrum-css/typography/dist/index-vars.css"
9090
/>
9191
<link
92-
rel="stylesheet"
93-
href="node_modules/@spectrum-css/icon/dist/index-vars.css"
92+
rel="stylesheet"
93+
href="node_modules/@spectrum-css/icon/dist/index-vars.css"
9494
/>
9595
<link
96-
rel="stylesheet"
97-
href="node_modules/@spectrum-css/button/dist/index-vars.css"
96+
rel="stylesheet"
97+
href="node_modules/@spectrum-css/button/dist/index-vars.css"
9898
/>
9999
```
100100

@@ -108,27 +108,27 @@ To switch to Express, load vars from `@spectrum-css/expressvars` instead of `@sp
108108

109109
```html
110110
<html class="spectrum spectrum--medium spectrum--light spectrum--express">
111-
<head>
112-
<!-- Include only the scales your application needs -->
113-
<link
114-
rel="stylesheet"
115-
href="node_modules/@spectrum-css/expressvars/dist/spectrum-medium.css"
116-
/>
117-
<link
118-
rel="stylesheet"
119-
href="node_modules/@spectrum-css/expressvars/dist/spectrum-large.css"
120-
/>
121-
122-
<!-- Include only the colorstops your application needs -->
123-
<link
124-
rel="stylesheet"
125-
href="node_modules/@spectrum-css/expressvars/dist/spectrum-light.css"
126-
/>
127-
<link
128-
rel="stylesheet"
129-
href="node_modules/@spectrum-css/expressvars/dist/spectrum-dark.css"
130-
/>
131-
</head>
111+
<head>
112+
<!-- Include only the scales your application needs -->
113+
<link
114+
rel="stylesheet"
115+
href="node_modules/@spectrum-css/expressvars/dist/spectrum-medium.css"
116+
/>
117+
<link
118+
rel="stylesheet"
119+
href="node_modules/@spectrum-css/expressvars/dist/spectrum-large.css"
120+
/>
121+
122+
<!-- Include only the colorstops your application needs -->
123+
<link
124+
rel="stylesheet"
125+
href="node_modules/@spectrum-css/expressvars/dist/spectrum-light.css"
126+
/>
127+
<link
128+
rel="stylesheet"
129+
href="node_modules/@spectrum-css/expressvars/dist/spectrum-dark.css"
130+
/>
131+
</head>
132132
</html>
133133
```
134134

@@ -169,7 +169,7 @@ These icons are released within the [`@adobe/spectrum-css-workflow-icons`](https
169169

170170
```js
171171
loadIcons(
172-
"node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg"
172+
"node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg"
173173
);
174174
```
175175

@@ -212,12 +212,12 @@ Spectrum CSS is designed to be as flexible as possible, and as such, leaves room
212212

213213
```json
214214
{
215-
"name": "my-project",
216-
"devDependencies": {
217-
"@spectrum-css/button": "^3.0.0",
218-
"@spectrum-css/page": "^3.0.0",
219-
"@spectrum-css/vars": "^3.0.0"
220-
}
215+
"name": "my-project",
216+
"devDependencies": {
217+
"@spectrum-css/button": "^3.0.0",
218+
"@spectrum-css/page": "^3.0.0",
219+
"@spectrum-css/vars": "^3.0.0"
220+
}
221221
}
222222
```
223223

@@ -243,12 +243,12 @@ Next, create a `postcss.config.js`:
243243

244244
```js
245245
module.exports = {
246-
plugins: [
247-
require("postcss-import"),
248-
require("postcss-varfallback"),
249-
require("postcss-dropunusedvars"),
250-
require("cssnano"),
251-
],
246+
plugins: [
247+
require("postcss-import"),
248+
require("postcss-varfallback"),
249+
require("postcss-dropunusedvars"),
250+
require("cssnano"),
251+
],
252252
};
253253
```
254254

@@ -278,34 +278,34 @@ Then, add something like this to your `postcss.config.js`:
278278

279279
```js
280280
module.exports = {
281-
plugins: [
282-
require("postcss-transformselectors")({
283-
replace: [
284-
{ search: ".spectrum-Heading--sizeXXL", replace: "h1" },
285-
{ search: ".spectrum-Heading--sizeXL", replace: "h2" },
286-
{ search: ".spectrum-Heading--sizeL", replace: "h3" },
287-
],
288-
transform: (selector) => {
289-
if (selector.startsWith(".spectrum-Heading")) {
290-
// Operate on each selector in a selector list
291-
return selector
292-
.split(",")
293-
.map((selectorPart) => {
294-
// Create separate selectors for each reference to .spectrum-Heading
295-
return ["h1", "h2", "h3"]
296-
.map((h) => {
297-
return selectorPart.replace(".spectrum-Heading", h);
298-
})
299-
.join(",");
300-
})
301-
.join(",");
302-
}
303-
304-
// Don't mess with things that don't have .spectrum-Heading in them
305-
return selector;
306-
},
307-
}),
308-
],
281+
plugins: [
282+
require("postcss-transformselectors")({
283+
replace: [
284+
{ search: ".spectrum-Heading--sizeXXL", replace: "h1" },
285+
{ search: ".spectrum-Heading--sizeXL", replace: "h2" },
286+
{ search: ".spectrum-Heading--sizeL", replace: "h3" },
287+
],
288+
transform: (selector) => {
289+
if (selector.startsWith(".spectrum-Heading")) {
290+
// Operate on each selector in a selector list
291+
return selector
292+
.split(",")
293+
.map((selectorPart) => {
294+
// Create separate selectors for each reference to .spectrum-Heading
295+
return ["h1", "h2", "h3"]
296+
.map((h) => {
297+
return selectorPart.replace(".spectrum-Heading", h);
298+
})
299+
.join(",");
300+
})
301+
.join(",");
302+
}
303+
304+
// Don't mess with things that don't have .spectrum-Heading in them
305+
return selector;
306+
},
307+
}),
308+
],
309309
};
310310
```
311311

@@ -322,71 +322,53 @@ yarn install
322322
yarn start
323323
```
324324

325-
Your `dist/` folder should now have a local copy of the Spectrum CSS docs and minimal CSS files, and your browser should be open with the project's preview site. Editing any of the `.css` or the `.stories.js` files in `components/*` will update the project documentation and live reload in your browser.
325+
Your `dist/` folder should now have a local copy of the compiled CSS files, and your browser should be open with the project's preview site. Editing any of the `.css` or the `.stories.js` files in `components/*` will update the project documentation and live reload in your browser.
326326

327-
**Important:** Ensure you have Node.js > 14 installed or the build system will not run. Node.js > 16.x is preferred.
327+
**Important:** Ensure you have Node.js >= 14 installed or the build system will not run. Node.js 16.x is preferred.
328328

329-
This project is leveraging caching from [Nx](https://nx.dev/) to speed up the build process. If you are seeing unexpected results, you can clear the cache by running `yarn nx clean` or `yarn nx run-many --target clean --all`.
329+
This project is leveraging caching from [Nx](https://nx.dev/) to speed up the build process. If you are seeing unexpected results, you can clear the cache by running `yarn nx reset`.
330330

331331
To spin up the local development environment ([Storybook](https://storybook.js.org/docs/web-components/get-started/introduction)) without first building the components, use: `SKIP_BUILD=true yarn start` as `yarn start` alone will start from a clean build.
332332

333333
### Documentation site
334334

335335
#### Local documentation site
336336

337-
Building the project will build and launch the project documentation site in your browser automatically.
338-
339-
See [site generation](site/README.md) for more information.
340-
341-
#### Generating and deploying external documentation site
342-
343-
Checkout `nextjs` branch, pull, and install dependencies.
344-
345-
```shell
346-
git checkout nextjs
347-
git pull
348-
yarn install
349-
```
350-
351-
Update `yml` data from main
337+
After installing the project, you can spin up a local view of the documentation site with:
352338

353339
```shell
354-
yarn importdata
340+
yarn dev
355341
```
356342

357-
Run `prep` script to build the static site locally
343+
See [site generation](site/README.md) for more information. This is being imminently updated to 11ty so it's advised to hold off opening any pull requests to change the site until that is complete.
358344

359-
```shell
360-
yarn prep
361-
```
362-
363-
Commit changes
364-
365-
```shell
366-
git commit -am '<message here>'
367-
```
345+
#### Generating and deploying external documentation site
368346

369-
Deploy
347+
To generate the documentation site, run the following command:
370348

371349
```shell
372-
yarn deploy
350+
yarn release:site
373351
```
374352

375-
Push changes to `nextjs` branch
376-
377-
```shell
378-
git push origin nextjs
379-
```
353+
This will generate the documentation site in the `dist/` folder and push that content to gh-pages.
380354

381355
### CLI
382356

383357
The following tasks are available:
384358

385-
- `yarn build:all` - Performs a build of all components, documentation site, and storybook
386-
- `yarn build` - Performs a build of all components
387-
- `yarn dev` - Performs a component build, runs storybook, and serves the documentation on the default port (3000), then starts watching components and website files
388-
- `yarn clean` - Cleans all output files for the project and all components
389-
- `yarn watch` - Assuming a build has already been performed, re-starts starts watching components and website files. Presumes a browser is already open to your locally served docs
359+
- `yarn build:all`: Performs a build of all components, documentation site, and storybook
360+
- `yarn build`: Performs a build of all components
361+
- `yarn build:components`: Builds components in parallel; uses cache
362+
- `yarn build:preview`: Builds storybook & dependencies (all components)
363+
- `yarn build:site`: Builds the website only
364+
- `yarn clean`: Cleans all output files for the project and all components
365+
- `yarn ci:storybook`: Builds storybook & dependencies (all components) for CI
366+
- `yarn clean:components`: Deletes compiled assets for all component folders
367+
- `yarn clean:preview`: Deletes the storybook compiled assets
368+
- `yarn dev` - Performs a component build, runs storybook in the background on port (3000), then builds the documentation site, opening the content from `dist/`
369+
- `yarn lint`: Lints packages and css for components
370+
- `yarn start`: Triggers storybook build and dev server
371+
- `yarn watch` - Assuming a build has already been performed, re-starts starts watching components and website files; Presumes a browser is already open to your locally served docs
390372

391373
---
392374

@@ -396,41 +378,32 @@ The following tasks are available:
396378

397379
Releasing individual components is handled by Lerna. When any component or its dependencies change, Lerna will queue that component (and all of its dependents) up for a release.
398380

399-
To release everything that has changed, simply run:
381+
To release everything that has changed, run:
400382

401383
```shell
402384
yarn release
403385
```
404386

405-
Version numbers are automatically determined, changelogs generated, and packages published.
387+
A build of all components is run, then a `lerna publish` command is fired (with settings to prevent publishing private packages). Version numbers are automatically determined, changelogs generated, and packages published to npm.
406388

407-
### Releasing the website
389+
<details>
390+
<summary>Prereleases</summary>
408391

409-
After performing a release, run the following command to release the website:
392+
Before changes are considered production-ready, a prerelease tag might be created to facilitate testing in downstream projects.
410393

411-
```shell
412-
yarn release:docs
413-
```
394+
**Before starting, ensure that you're working from a branch other than `main`.**
414395

415-
### Publishing prereleases
396+
Commit changes using the typical conventional commit syntax.
416397

417-
Occasionally, it can be helpful for our subscribers to test CSS changes before they're considered ready to be part of a stable release. To facilitate this, we can publish prerelease versions.
398+
To publish a prerelease:
418399

419-
To publish prerelease versions:
400+
```shell
401+
yarn release:beta @spectrum-css/accordion,@spectrum-css/actionbutton
402+
```
403+
404+
build the affected package(s) locally, then publish them to npm. An npm task for cleaning, building, and beta publishing is available, and it can be run via the following command: `yarn release:beta`. This command will perform a full `clean` (via the `clean` task), a full `build` (via the `build` task), and will attempt to bump the version numbers in the affected package(s) (via `lerna publish --conventional-prerelease --preid beta --pre-dist-tag beta --no-private`).
420405

421-
- First, be sure that you're working on a branch other than `main`.
422-
- Once your change(s) are ready to be committed, be aware of the severity of the change(s), and be sure to author your commit message so that Lerna understands how to increase the version number(s) of the affected components.
423-
- Once your changes are committed, you **must** build the affected package(s) locally **before** publishing them to npm. An npm task for cleaning, building, and beta publishing is available, and it can be run via the following command: `yarn release:beta-from-package`. This command will perform a full `clean` (via the `clean` task), a full `build` (via the `build` task), and will attempt to bump the version numbers in the affected package(s) (via `lerna publish --conventional-prerelease --preid beta --pre-dist-tag beta --no-private`).
424406
- Depending on the severity of your change(s), and before publishing to npm, Lerna should show a preview of the affected package version numbers that look something like: `@spectrum-css/tag: 3.3.8 => 3.3.9-beta.0`. Additionally, at this time, Lerna will ask if you would like to continue with publishing the changes or cancel.
425407
- Selecting `y` to publish will publish the affected package(s) to npm.
426408

427-
### Manual prerelease versioning & publishing
428-
429-
Occasionally, you may want to run a prerelease for an individual package and skip a version bump for consuming packages. It's possible to manually change a package's version number to achieve this.
430-
431-
- For the package that you want to prerelease, manually alter the version number in the package's `package.json` file.
432-
- For example, let's say you'd like to release a `beta` version of the Switch component. In the Switch's `package.json`, manually change the `version` number from its current number (`"version": "1.0.23"`) to the next appropriate semver version number (`"version": "2.0.0-beta.0"`).
433-
- Save your changes, and commit them with the appropriate conventional commit-style commit message: `chore(switch): manual version bump for beta release` or something similar.
434-
- You **must** run a build **before** continuing with the prerelease. An npm task for cleaning, building, and beta publishing is available, and it can be run via the following command: `yarn release:beta-from-package`. This command will perform a full `clean` (via the `clean` task), a full `build` (via the `build` task), and will attempt to publish the package (via `lerna publish --conventional-prerelease --preid beta --pre-dist-tag beta --no-private`).
435-
- Depending on the severity of your change(s), and before publishing to npm, Lerna should show a preview of the affected package version number that looks something like: `@spectrum-css/switch: 1.0.23 => 2.0.0-beta.0`. Additionally, at this time, Lerna will ask if you would like to continue with publishing the changes or cancel.
436-
- Selecting `y` to publish will publish the affected package(s) to npm.
409+
</details>

0 commit comments

Comments
 (0)