Skip to content

Commit

Permalink
📦 Switch to Yarn workspaces; overhaul build system (#1741)
Browse files Browse the repository at this point in the history
* Switch to yarn workspaces, upgrade some dev dependencies

* [core] fix typescript compilation

* Remove require-shim.d.ts files, we now use @types/node

* [table] fix typescript compilation

* update tsconfig.json files

* [docs] fix typescript compilation

* [labs] fix typescript compilation

* [core] fix some tests

* bump to webpack 3!

remove localResolve support -- not necessary with hoisting

* fix ts-loader errors

* clean yarn.lock

* massage package.json versions to hoist as much as possible

* upgrade site-landing and table preview to webpack 3

* get karma webpacking

* karma serves/includes correct files

* ⭐ test compile errors now fail the build!

* fix core and datetime tests

* fix webpack-watch

* quick ignore ContextMenu component cuz it's untestable (not exported)

* bump range slider test coverage

* Fix Table test typings

* Comment out broken tests :/

* Refactor build system, remove Gulp (#1786)

* Remove Gulpfile.js
  • Loading branch information
adidahiya authored and giladgray committed Nov 16, 2017
1 parent 4a363aa commit 858ceb1
Show file tree
Hide file tree
Showing 338 changed files with 5,947 additions and 13,024 deletions.
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspace-experimental true
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ install dependencies:
```sh
git clone [email protected]:<username>/blueprint.git # using ssh
cd blueprint
npm install
npm run bootstrap
yarn
```

## Developing
Expand Down
136 changes: 0 additions & 136 deletions Gulpfile.js

This file was deleted.

81 changes: 61 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,83 @@ If you rely heavily on mobile interactions and are looking for a mobile-first UI

## Packages

This repository contains multiple projects in the `packages/` directory that are distributed as separate packages on NPM:
This repository contains multiple projects in the `packages/` directory that fall into 3 categories:

[![npm](https://img.shields.io/npm/v/@blueprintjs/core.svg?label=@blueprintjs/core)](https://www.npmjs.com/package/@blueprintjs/core) &ndash; Core styles & components.
### Libraries

[![npm](https://img.shields.io/npm/v/@blueprintjs/datetime.svg?label=@blueprintjs/datetime)](https://www.npmjs.com/package/@blueprintjs/datetime) &ndash; Components for interacting with dates and times.
These are the component libraries we publish to NPM.

[![npm](https://img.shields.io/npm/v/@blueprintjs/docs.svg?label=@blueprintjs/docs)](https://www.npmjs.com/package/@blueprintjs/docs) &ndash; Documentation theme for [Documentalist](https://github.com/palantir/documentalist) data.
- [![npm](https://img.shields.io/npm/v/@blueprintjs/core.svg?label=@blueprintjs/core)](https://www.npmjs.com/package/@blueprintjs/core) &ndash; Core styles & components.
- [![npm](https://img.shields.io/npm/v/@blueprintjs/datetime.svg?label=@blueprintjs/datetime)](https://www.npmjs.com/package/@blueprintjs/datetime) &ndash; Components for interacting with dates and times.
- [![npm](https://img.shields.io/npm/v/@blueprintjs/docs.svg?label=@blueprintjs/docs)](https://www.npmjs.com/package/@blueprintjs/docs) &ndash; Documentation theme for [Documentalist](https://github.com/palantir/documentalist) data.
- [![npm](https://img.shields.io/npm/v/@blueprintjs/table.svg?label=@blueprintjs/table)](https://www.npmjs.com/package/@blueprintjs/table) &ndash; Scalable interactive table component.
- [![npm](https://img.shields.io/npm/v/@blueprintjs/labs.svg?label=@blueprintjs/labs)](https://www.npmjs.com/package/@blueprintjs/labs) &ndash; Incubator and staging area for new components still under initial development.

[![npm](https://img.shields.io/npm/v/@blueprintjs/table.svg?label=@blueprintjs/table)](https://www.npmjs.com/package/@blueprintjs/table) &ndash; Scalable interactive table component.
### Applications

[![npm](https://img.shields.io/npm/v/@blueprintjs/labs.svg?label=@blueprintjs/labs)](https://www.npmjs.com/package/@blueprintjs/labs) &ndash; Incubator and staging area for new components still under initial development.
These are hosted on GitHub Pages as static web applications.

The other packages (`site-docs` and `site-landing`) are not published to NPM as they are used to build the documentation site.
- `docs-app`
- `landing-app`

### Build tooling

These private packages define development dependencies and contain build configuration. They adhere to standard NPM package layout&mdash;this allows us to keep clear API boundaries for build configuration and isolate groups of `devDependencies`. In the future, we might publish these packages to allow other Blueprint projects to use this infrastructure outside this monorepo.

- `karma-build-scripts`
- `node-build-scripts`
- `tslint-config`
- `webpack-build-scripts`

## Development

We use [Lerna](https://lernajs.io/) to manage inter-package dependencies in this monorepo.
Builds are orchestrated via [Gulp](http://gulpjs.com/) tasks.
[Lerna](https://lernajs.io/) manages inter-package dependencies in this monorepo.
Builds are orchestrated via `lerna run` and NPM scripts.

__Prerequisites__: Node.js v8+, Yarn v1.0+

### One-time setup

After cloning this repo, run:

1. `yarn` to install all dependencies.
1. `yarn verify` to ensure you have all the build tooling working properly.

### Incorporating upstream changes

__Prerequisites__: Node.js v6+, Yarn v0.28+
If you were previously in a working state and have just pulled new code from `develop`:

1. `git clone` this repository (or fork if you lack permissions).
1. `yarn` to install dependencies at the root of the repo.
1. `yarn bootstrap` to install package dependencies install and symlink them using [Lerna](https://lernajs.io/).
1. `yarn gulp` to compile and start the server and watcher.
1. Open your browser to [localhost:9000/packages/site-docs/dist/](http://localhost:9000/packages/site-docs/dist/).
- If there were package dependency changes, run `yarn` at the root.
- This command is very quick if there are no new things to install.
- Run `yarn compile-libs` to get the latest built versions of the library packages in this repo.
- This command is quicker than `yarn verify` since it doesn't build the application packages (`docs-app`, `landing-app`, etc.) or run tests

### Updating build dependencies
### Developing libraries

1. `yarn add <package-name>` or `yarn upgrade <package-name>`.
Each library has its own dev script which you can run to watch changes to that package and run the docs application with webpack-dev-server: `yarn dev:core`, `yarn dev:datetime`, etc.

- One exception is `table`&mdash;since it has its own playground application for development, the `dev:table` script doesn't run the docs site.
- You may also choose to watch changes across all packages by running `yarn dev:all` from the root directory.

### Updating dependencies

1. Edit the `package.json` where you wish to change dependencies.
1. Run `yarn` at the root to update lockfiles.
1. Commit the result.

### Updating package dependencies
### Updating documentation

Much of Blueprint's documentation lives inside source code as JSDoc comments in `.tsx?` files and KSS markup in `.scss` files. This documentation is extracted and converted into static JSON data using [documentalist](https://github.com/palantir/documentalist/).

If you are updating documentation sources (_not_ the docs UI code which lives in `packages/docs-app`), you'll need to run `yarn generate-docs-data` from the `docs-app` package to see it reflected in the application. Note that `yarn bundle` in this package also runs this script.

### Updating icons

The [One-time setup](#one-time-setup) and [Incorporating upstream changes](#incorporating-upstream-changes) steps should produce the generated
source code in this repo used to build the icons documentation. This is sufficient for most development workflows.

1. Update the relevant `package.json` file. Make sure to retain the `^` semver range.
1. Run `yarn bootstrap` and commit the result.
If you are updating icons or adding new ones, you'll need to run `yarn compile` in `packages/core` to see those changes reflected before
running any of the dev scripts.

## Contributing

Expand Down
52 changes: 20 additions & 32 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,51 @@
machine:
pre:
- mkdir ~/yarn
environment:
PATH: $PATH:$HOME/yarn/bin:$HOME/$CIRCLE_PROJECT_REPONAME/node_modules/.bin:$HOME/$CIRCLE_PROJECT_REPONAME/scripts
YARN_VERSION: 1.2.1
node:
version: 8.5.0

general:
artifacts:
# compiled assets for each package
- packages/core/dist
- packages/datetime/dist
- packages/docs/dist
- packages/labs/dist
- packages/site-docs/dist
- packages/site-landing/dist
- packages/docs-app/dist
- packages/landing-app/dist
- packages/table/dist
# code coverage reports
- packages/core/coverage
- packages/datetime/coverage
- packages/table/coverage
# preview pages
- packages/table/preview
# GH Pages content
- docs

machine:
pre:
- mkdir ~/yarn
environment:
YARN_VERSION: 0.28.4
PATH: $PATH:$HOME/$CIRCLE_PROJECT_REPONAME/node_modules/.bin
node:
version: 7.10.0

dependencies:
cache_directories:
- ~/yarn
- ~/.cache/yarn
- ~/$CIRCLE_PROJECT_REPONAME/packages/core/node_modules
- ~/$CIRCLE_PROJECT_REPONAME/packages/datetime/node_modules
- ~/$CIRCLE_PROJECT_REPONAME/packages/docs/node_modules
- ~/$CIRCLE_PROJECT_REPONAME/packages/labs/node_modules
- ~/$CIRCLE_PROJECT_REPONAME/packages/site-docs/node_modules
- ~/$CIRCLE_PROJECT_REPONAME/packages/site-landing/node_modules
- ~/$CIRCLE_PROJECT_REPONAME/packages/table/node_modules
# non-zero exit codes in `dependencies` group will fail the build early
# so these following commands will block the build and prevent tests
override:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
- yarn install --pure-lockfile
- echo "Checking if yarn.lock changed..." && git diff --exit-code
- yarn bootstrap
- yarn build:gulp
- yarn
- echo "Checking if lockfiles changed..." && git diff --exit-code
- npm rebuild node-sass
- yarn compile-libs

test:
override:
- gulp check
- gulp test
- case $CIRCLE_NODE_INDEX in 0) yarn dist ;; 1) yarn test ;; 2) yarn lint ;; esac:
parallel: true

deployment:
preview:
branch: /.*/
commands:
- ./scripts/preview.sh
- build-docs-artifacts
- submit-preview-comment
npm:
tag: /release-.*/
owner: palantir
commands:
- ./scripts/npmPublish.sh
- publish-npm-semver-tagged
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "2.0.0",
"version": "2.4.2",
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"importHelpers": true,
"jsx": "react",
"module": "commonjs",
"moduleResolution": "node",
Expand All @@ -12,12 +12,10 @@
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true,
"removeComments": false,
"sourceMap": false,
"stripInternal": true,
"target": "es5",
"paths": {
"@blueprintjs/docs": ["../../docs/dist/index"]
}
"target": "es5"
}
}
29 changes: 0 additions & 29 deletions gulp/aliases.js

This file was deleted.

Loading

1 comment on commit 858ceb1

@blueprint-bot
Copy link

Choose a reason for hiding this comment

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

📦 Switch to Yarn workspaces; overhaul build system (#1741)

Preview: documentation
Coverage: core | datetime

Please sign in to comment.