Skip to content

Commit b201fd6

Browse files
committed
chore: merge ui-token-scripts into ui-scripts
Also add documentation to ui-scripts commands and simplify it a bit.
1 parent fc77c9f commit b201fd6

30 files changed

+143
-988
lines changed

.env.example

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
NPM_TOKEN=
22
NPM_USERNAME=
33
NPM_EMAIL=
4-
GIT_EMAIL=""
5-
GIT_USERNAME=
6-
GIT_REMOTE_URL=gerrit:instructure-ui
7-
GIT_REMOTE_NAME=origin
8-
JIRA_CONSUMER_KEY=
9-
JIRA_TOKEN=
10-
JIRA_SECRET=
11-
JIRA_PEM_PATH=/Users/your_user_name/.ssh/jira.pem
12-
SLACK_USERNAME=instui
13-
SLACK_WEBHOOK=
14-
SSH_KEY_PATH=
15-
SSH_USERNAME=
16-
CHROMATIC_APP_CODE=
17-
GERRIT_HOST=
18-
GERRIT_PORT=

package-lock.json

Lines changed: 6 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"build": "lerna run build --stream",
4141
"build:watch": "lerna run build:watch --stream",
4242
"build:docs": "lerna run bundle --stream --scope docs-app",
43-
"build:tokens": "ui-token-scripts generate-all-tokens",
43+
"build:tokens": "ui-scripts generate-all-tokens",
4444
"build:types": "tsc -b tsconfig.references.json",
4545
"build:ts": "lerna run prepare-build --stream --scope @instructure/ui-icons && npm run build:types --verbose",
4646
"clean": "node scripts/clean.js",
@@ -69,7 +69,6 @@
6969
"@commitlint/cli": "^17.7.1",
7070
"@commitlint/config-conventional": "^17.7.0",
7171
"@instructure/ui-scripts": "8.41.1",
72-
"@instructure/ui-token-scripts": "8.41.1",
7372
"@testing-library/dom": "^9.3.1",
7473
"@testing-library/jest-dom": "^5.17.0",
7574
"@testing-library/react": "^14.0.0",

packages/eslint-plugin-instructure-ui/lib/rules/no-relative-package-imports.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24+
25+
// note: This cannot be converted to ESM until ESLint v9 is released:
26+
// https://github.com/eslint/eslint/issues/15453#issuecomment-1002015088
2427
const path = require('path')
2528
const { readPackage } = require('@instructure/pkg-utils')
2629

packages/instui-config/package-lists/v9/package-list.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"@instructure/ui-themes",
106106
"@instructure/ui-time-select",
107107
"@instructure/ui-toggle-details",
108-
"@instructure/ui-token-scripts",
109108
"@instructure/ui-tooltip",
110109
"@instructure/ui-top-nav-bar",
111110
"@instructure/ui-tray",

packages/ui-scripts/README.md

Lines changed: 52 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,73 @@ category: packages
88
[![MIT License][license-badge]][license] 
99
[![Code of Conduct][coc-badge]][coc]
1010

11-
A CLI tool for UI component libraries made by Instructure Inc.
11+
A CLI tool for InstUI build and publish tools made by Instructure Inc.
1212

13-
### Installation
13+
### Scripts
14+
15+
For more documentation on available options and parameters for individual commands run:
1416

1517
```sh
16-
npm install @instructure/ui-scripts
18+
ui-scripts <command> --help
1719
```
1820

19-
### Scripts
20-
21-
#### `build`
21+
#### build
2222

2323
To build (babel transpile) a package to be consumed as a library:
2424

25-
`npm run ui-scripts build`
25+
`npm run ui-scripts build --modules cjs` writes commonjs modules to the lib/ directory.
26+
27+
`npm run ui-scripts build --modules es` writes es modules to the es/ directory.
28+
29+
`npm run ui-scripts build --modules es,cjs` writes es modules to both directories.
30+
31+
If not specified, `modules` defaults to `es`.
2632

2733
To build (webpack) a package to be consumed as an application:
2834

2935
`npm run ui-scripts bundle`
3036

31-
#### `clean`
37+
#### bump version
38+
39+
To update all package versions
40+
(defaults to determining the version automatically using commit messages):
41+
42+
`npm run ui-scripts bump [version|major|minor|patch]`
43+
44+
#### clean
3245

3346
To clean out built/generated files from a package:
3447

3548
`npm run ui-scripts clean`
3649

37-
#### `modules`
50+
#### deprecate
3851

39-
`npm run ui-scripts build --modules cjs` writes commonjs modules to the lib/ directory.
52+
Deprecates ALL of a certain version of instUI npm packages by running `npm deprecate`.
53+
`versionToDeprecate` defaults to the current version.
4054

41-
`npm run ui-scripts build --modules es` writes es modules to the es/ directory.
55+
`npm run ui-scripts deprecate --versionToDeprecate 5.11.0 --fixVersion 5.11.1`
4256

43-
`npm run ui-scripts build --modules es,cjs` writes es modules to both directories.
57+
#### examples (Storybook)
4458

45-
If not specified, `modules` defaults to `es`.
59+
To build component examples and start up a dev server with hot reloading:
4660

47-
#### `test`
61+
`npm run ui-scripts examples --watch -p 8080`
4862

49-
To run tests for a package:
63+
To build component examples for deploying:
5064

51-
`npm run ui-scripts test`
65+
`npm run ui-scripts examples`
66+
67+
#### generating design tokens
68+
69+
`npm run generate-tokens <options>`
70+
71+
Generate cross-platform design tokens for the given theme.
5272

53-
#### `lint`
73+
`npm run generate-all-tokens`
74+
75+
Generate cross-platform design tokens for all themes in the repo.
76+
77+
#### lint
5478

5579
To lint (eslint/stylelint) all files:
5680

@@ -64,49 +88,19 @@ To fix lint issues:
6488

6589
`npm run ui-scripts lint --fix`
6690

67-
#### `install-react`
68-
69-
To install a specific version of React and ReactDOM without updating `package.json`
70-
(defaults to the versions specified in the resolutions field):
71-
72-
`npm run ui-scripts install-react [version]`
73-
74-
#### `bump`
75-
76-
To update all package versions
77-
(defaults to determining the version automatically using commit messages):
78-
79-
`npm run ui-scripts bump [version|major|minor|patch]`
80-
81-
#### `publish`
91+
#### publish to npm
8292

8393
To publish all packages (defaults to current version):
8494

8595
`npm run ui-scripts publish [version]`
8696

87-
#### `deploy-docs`
88-
89-
To run the deploy of the documentation (to Github pages):
90-
91-
`npm run ui-scripts deploy-docs`
92-
93-
#### `examples`
94-
95-
To build component examples and start up a dev server with hot reloading:
96-
97-
`npm run ui-scripts examples --watch -p 8080`
98-
99-
To build component examples for deploying:
100-
101-
`npm run ui-scripts examples`
102-
103-
#### `server`
97+
#### server
10498

10599
To start up a server to test production builds of examples or docs:
106100

107101
`npm run ui-scripts server -p 8080`
108102

109-
#### `tag`
103+
#### npm tag
110104

111105
To add an NPM dist-tag for all packages:
112106

@@ -116,55 +110,26 @@ To remove an NPM dist-tag for all packages:
116110

117111
`npm run ui-scripts tag rm 5.11.0 latest`
118112

119-
#### `deprecate`
113+
#### running tests
120114

121-
To deprecate all packages (optional arguments: version, fix version):
115+
To run all tests:
122116

123-
`npm run ui-scripts deprecate 5.11.0 5.11.1`
117+
`npm run ui-scripts test`
124118

125-
### Configuration
119+
To run tests for a package:
126120

127-
If you'd like to use the publish, deploy, and release scripts, you'll need to configure your project as follows:
121+
`npm run ui-scripts test -- --scope @instructure/ui-avatar`
128122

129-
#### Project level
130-
131-
Add the config to your project level `package.json` file:
132-
133-
```json
134-
"config": {
135-
"ui-scripts": {
136-
"slack_emoji": ":instui:",
137-
"slack_channel": "#instui",
138-
"jira_host": "instructure.atlassian.net",
139-
"jira_project_id": "17900",
140-
"jira_project_key": "INSTUI",
141-
"npm_scope": "@instructure:registry=https://registry.npmjs.org/",
142-
"gh_pages_branch": "gh-pages",
143-
"gh_pages_dir": "packages/__docs__/__build__",
144-
"gh_pages_cname": "instructure.design",
145-
"changelog_url": "https://instructure.design/#CHANGELOG"
146-
}
147-
}
148-
```
123+
### Configuration
149124

150-
#### Environment variables
125+
If you'd like to use the publish, deploy, and release scripts, you'll need to configure your project as follows:
151126

152-
Add a `.env` file to your project root:
127+
Add a `.env` file to your project root or define these env vars for your shell:
153128

154129
```sh
155130
NPM_TOKEN=
156131
NPM_USERNAME=
157132
NPM_EMAIL=
158-
GIT_EMAIL=""
159-
GIT_USERNAME=
160-
GIT_REMOTE_URL=gerrit:instructure-ui
161-
GIT_REMOTE_NAME=origin
162-
JIRA_CONSUMER_KEY=
163-
JIRA_TOKEN=
164-
JIRA_SECRET=
165-
JIRA_PEM_PATH=/Users/your_user_name/.ssh/jira.pem
166-
SLACK_USERNAME=instui
167-
SLACK_WEBHOOK=
168133
```
169134

170135
[npm]: https://img.shields.io/npm/v/@instructure/ui-scripts.svg

packages/ui-scripts/lib/build/babel.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ const specifyCJSFormat = path.resolve(__dirname, 'specify-commonjs-format.js')
3232

3333
export default {
3434
command: 'build',
35-
desc: '',
35+
desc: 'Build the packages with Babel.js',
3636
builder: (yargs) => {
37-
yargs.option('copy-files', { boolean: true, desc: '' })
38-
yargs.option('watch', { boolean: true, desc: '' })
37+
yargs.option('copy-files', {
38+
boolean: true,
39+
desc: 'Copy files that will not be compiled'
40+
})
41+
yargs.option('watch', {
42+
boolean: true,
43+
desc: 'Run constantly and recompile on changes'
44+
})
3945
yargs.option('modules', {
4046
string: true,
41-
desc: '',
47+
desc: 'What kind of modules to build. "es": build into the /es folder using ESM; "cjs": build into the /lib folder using commonJS',
4248
choices: ['es', 'cjs'],
4349
default: 'es',
4450
coerce: (value) => value.split(',')

packages/ui-scripts/lib/build/clean.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import fs from 'fs'
2626

2727
export default {
2828
command: 'clean',
29-
desc: '',
29+
desc: 'Delete generated files and build outputs',
3030
handler: async () => {
3131
const dirs = [
3232
'__build__',

0 commit comments

Comments
 (0)