Skip to content

Commit

Permalink
0.4.0 docs (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccpricenytimes authored Feb 13, 2017
1 parent 53770d7 commit 18a8c5b
Show file tree
Hide file tree
Showing 19 changed files with 573 additions and 132 deletions.
69 changes: 66 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@

## Master
# `kyt` Changelog

`kyt-cli` has a separate Changelog [here](/packages/kyt-cli/CHANGELOG.md).

## 0.4.0

### BREAKING CHANGES

#### MONOREPO
#### MONOREPO [#330](https://github.com/NYTimes/kyt/pull/330)
kyt is now a monorepo with several packages
1. kyt-cli - A globally installed package for project setup
- setup command now can create a new project directory with the -d flag.
`kyt-cli setup -d myDirectory`
`kyt-cli setup`
- setup now supports copying devDependencies from starter-kyts
- `setup` accepts a kyt version flag to help with local development [#343](https://github.com/NYTimes/kyt/pull/343)
- kyt-cli includes a `list` command which lists information about supported and recommended starter-kyts [#340](https://github.com/NYTimes/kyt/pull/340)
2. kyt-core - The kyt build and dev systems. Used as a project dependency
- `setup` is now deprecated as part of kyt-core. It can be found in kyt-cli
- `start` now runs the node server without a kyt wrapped command. This means kyt can be installed as a dev dependency
Expand All @@ -17,6 +23,63 @@ kyt is now a monorepo with several packages

e2e tests have been pulled to the top level and will be used to test all packages.

#### Babel Presets [#347](https://github.com/NYTimes/kyt/pull/347)
kyt now supports having your own .babelrc file in your project.

kyt has two presets:
- [babel-preset-core] (/packages/babel-preset-kyt-core) included as the default for kyt
- [babel-preset-react] (/packages/babel-preset-kyt-react) included with react starter-kyts

To update an existing kyt project:
- If your project uses react you'll want to create a .babelrc that points to the react preset. [This one](/packages/kyt-starter-universal/.babelrc) should work.
- If you currently make babel plugin or preset changes via `modifyWebpackConfig`, checkout out the updated [recipe](/docs/Recipes.md)


#### Linter configs
kyt's linter configs are now packaged as separate configs [#344](https://github.com/NYTimes/kyt/pull/344)
[#380](https://github.com/NYTimes/kyt/pull/380)
To update: copy the new linter files into the root of your project.
[.eslintrc.json](/packages/kyt-cli/config/user/.eslintrc.base.json)
[.stylelintrc.json](/packages/kyt-cli/config/user/.stylelintrc.json)


#### New Lint commands [#339](https://github.com/NYTimes/kyt/pull/339)
Lint commands are now as follows:
- `kyt lint-script` for JS
- `kyt lint-style` for CSS/Sass
- `npm run lint` runs both commands (installed by `kyt-cli` setup)
`kyt lint` is deprecated


#### `kyt start` is deprecated
`kyt-cli setup` creates an `npm run start` command to run the server

### FEATURES
- Support babel plugins w/o prefix [#303](https://github.com/NYTimes/kyt/issues/303)
- Bootstrap scripts for local development [#341](https://github.com/NYTimes/kyt/pull/341)
[#377](https://github.com/NYTimes/kyt/pull/377)
- kyt-cli now supports a fully interactive setup in addition to cli args. [#378](https://github.com/NYTimes/kyt/pull/378)

#### Yarn Support
kyt-cli now supports setting up projects using yarn.[#270](https://github.com/NYTimes/kyt/pull/270)


### Tooling updates
- Updated PostCSS loader [#295](https://github.com/NYTimes/kyt/pull/295)
- Add babel-plugin-transform-react-jsx-source to dev [#179](https://github.com/NYTimes/kyt/issues/179)
- Updated babel dependencies [#311](https://github.com/NYTimes/kyt/pull/311)
- Use babel polyfill rather than babel-transform-runtime [#255](https://github.com/NYTimes/kyt/pull/255)
- Updated linter dependencies [#289](https://github.com/NYTimes/kyt/pull/289)

### Bugfixes

- Fixes bug where e2e tests were silently failing [#326](https://github.com/NYTimes/kyt/pull/326)
- Fixes bug where test command wasn't written if an npm default existed [#293](https://github.com/NYTimes/kyt/pull/293)
- Catch SIGINT for all commands [#332](https://github.com/NYTimes/kyt/pull/332)
- Fixes bug where Jest moduleNameMappers didn't match imports with specific Webpack loaders [#363](https://github.com/NYTimes/kyt/pull/363)
- Fixes bug where style-lint only supported one file name [#383](https://github.com/NYTimes/kyt/pull/383)


## 0.3.0 (October 25, 2016)

### BREAKING CHANGES
Expand Down
23 changes: 20 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ Please make sure all PRs are:
2. tested (npm test)
3. Connected to an issue

### kyt local development

Optional: We recommend installing `yarn` to speed up local development.

1. Fork and clone kyt
2. Run `npm run bootstrap` to install the packages in the monorepo. You can also run `update` to reinstall.

We recommend creating a local project with a starter-kyt for testing.

### Testing kyt
The top level `test` command can be run from the root of the repository and will run all jest tests in the packages.

The e2e tests are located in the e2e folder and can be run from the root of the repo with `npm run e2e`

## Linting kyt
The monorepo has a top level `lint` command which runs lint for all the packages.

## Create an RFC

If you want to propose a large feature idea or architecture change you should consider submitting an RFC. It's often helpful to get feedback on your concept in an issue before starting the RFC. RFCs are an evolving process in the kyt repository so expect a lot of changes and guidelines in the future. You can find the kyt RFC template [here](/rfc/template.md).
Expand All @@ -30,7 +47,7 @@ To setup kyt for local development, install `yarn` and run the following:
git clone git@github.com:NYTimes/kyt.git
yarn run bootstrap
```
There are commands for bootstrapping, testing and linting all of the monorepo packages in the root directory package.json file.
There are commands for bootstrapping, testing and linting all of the monorepo packages in the root directory package.json file.

### bootstrap

Expand All @@ -42,15 +59,15 @@ From the root of kyt, run:

### update

Update is useful after you pull down kyt with some minor changes. It will call `npm install` on all of the packages in the repository. For complicated changes to the repository, it is best to use `bootstrap`.
Update is useful after you pull down kyt with some minor changes. It will call `yarn install` on all of the packages in the repository. For complicated changes to the repository, it is best to use `bootstrap`.

From the root of kyt, run:

`yarn run update`

### Testing local kyt-core changes

It is a common workflow to make changes to kyt-core and test them with `kyt-cli setup`. To get around installing the latest kyt-core, there's an option in setup where you can specify which version of kyt you want to reference. For instance, by executing the following locally, you can setup a directory called test and install your local version of kyt-core:
It is a common workflow to make changes to kyt-core and test them with `kyt-cli setup`. To get around installing the latest kyt-core, there's an option in setup to specify which version of kyt you want to reference. For instance, by executing the following locally, you can setup a directory called test and install your local version of kyt-core:

`kyt-cli setup -d test -k file:../kyt/packages/kyt-core`

Expand Down
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

# kyt

Every sizable JavaScript web app needs a common foundation: a setup to build, run, test and lint your code.
kyt is a toolkit that encapsulates and manages the configuration for web apps.
Every sizable JavaScript web app needs a common foundation: a setup to build, run, test and lint your code. kyt is a toolkit that encapsulates and manages the configuration for web apps.

Read more about kyt in our [blog post](http://open.blogs.nytimes.com/2016/09/13/introducing-kyt-our-web-app-configuration-toolkit/).

[![Build Status](https://travis-ci.org/NYTimes/kyt.svg?branch=master)](https://travis-ci.org/NYTimes/kyt) [![Dependency Status](https://david-dm.org/NYTimes/kyt.svg)](https://david-dm.org/NYTimes/kyt) [![npm](https://img.shields.io/npm/v/kyt.svg)](https://www.npmjs.com/package/kyt)

## Upgrading to 0.4.0
Check out our [migration guide](/docs/migration-guides/0.3-0.4.md) and [changelog](/CHANGELOG.md)

## Quick Start

1. Install [Node.js](https://nodejs.org/) (v6.0+ required).
2. Create a directory and initialize npm - `npm init`
3. `npm install --save kyt`
4. `node_modules/.bin/kyt setup` - This will set up your project with application and configuration files so that you can get started with kyt. Learn more about [setup](/docs/commands.md#setup).
5. `npm run dev`
6. Check out `http://localhost:3000`
2. `npm install -g kyt-cli`
3. `kyt-cli setup` - This will set up your project with application and configuration files so that you can get started with kyt. Learn more about [setup](/packages/kyt-cli/README.md).
4. `npm run dev`
5. Check out `http://localhost:3000`

We recommend installing kyt as a dependency in your project.

## How it Works

Expand All @@ -42,11 +42,19 @@ Developers design their own architecture, choosing the tools they need for rende
For advanced use cases, kyt enables developers to add additional tools and configuration.
See our [config override instructions](/docs/kytConfig.md#modifywebpackconfig) for details, and our [recipes](/docs/Recipes.md) for examples.


## Setting up a kyt project
kyt-cli is a utility for bootstrapping kyt projects. It can be installed globally and run to create a new project or integrate kyt with an existing project.

`kyt-cli setup`

See the [kyt-cli](/packages/kyt-cli/README.md) documentation for more details.

## Command line

kyt includes a command line program with all the commands needed for development.

Running `node_modules/.bin/kyt setup` includes these commands as scripts in your package.json:
Running `kyt-cli setup` includes these commands as scripts in your package.json:

```
npm run dev
Expand All @@ -60,7 +68,6 @@ node_modules/.bin/kyt build

Here are the available commands:

* [`setup`](/docs/commands.md#setup) sets up kyt and installs a starter-kyt
* [`dev`](/docs/commands.md#dev) starts a development environment
* [`build`](/docs/commands.md#build) compiles server and client code for production use
* [`start`](/docs/commands.md#start) runs production code
Expand Down Expand Up @@ -100,11 +107,13 @@ See the [kyt config docs](/docs/kytConfig.md) for instructions.
kyt uses Webpack to compile src code and run tests.
See our [recipes](/docs/Recipes.md) for extending configuration.

To configure Babel, kyt respects `.babelrc` files defined at the root of user projects, and provides [presets](/packages/babel-preset-kyt-react) to provide opinionated configurations. (If no `.babelrc` is defined in the user project, [`babel-preset-kyt-core`](https://www.npmjs.com/package/babel-preset-kyt-core) is used.)

## starter-kyts

While kyt can be easily integrated into new or existing Node projects, it is even more powerful when used with a starter-kyt. A starter-kyt offers the benefits of boilerplates while minimizing the amount of new tools to learn and maintain. The kyt CLI includes a `setup` command which installs any preconfigured starter-kyt git repository, adding additional dependencies and building a source directory.
While kyt can be easily integrated into new or existing Node projects, it is even more powerful when used with a starter-kyt. A starter-kyt offers the benefits of boilerplates while minimizing the amount of new tools to learn and maintain. The `kyt-cli setup` command installs any preconfigured starter-kyt git repository, adding additional dependencies and building a source directory.

See our recommended list of [starter-kyts](/docs/commands.md#recommended-starter-kyts).
See our recommended list of [starter-kyts](/packages/kyt-cli/README.md).

### How to build a starter-kyt

Expand Down
51 changes: 41 additions & 10 deletions docs/Recipes.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# kyt recipes
Easy ways to extend kyt
# kyt Recipes

## Use Options in `modifyWebpackConfig`
Easy ways to extend kyt.

## Table of Contents

1. [Extend Webpack Configuration](#extend-webpack-configuration)
1. [Add Webpack Aliases](#add-webpack-aliases)
1. [Add PostCSS Plugins](#add-postcss-plugins)
1. [Add Babel Plugins and Presets](#add-babel-plugins-and-presets)
1. [Add always-mocked modules to Jest configuration](add-always-mocked-modules-to-jest-configuration)

## Extend Webpack Configuration

In kyt.config.js, the [`modifyWebpackConfig`](/docs/kytConfig#modifyWebpackConfig) function is called any time a Webpack config is used.

The `modifyWebpackConfig` function is called any time a Webpack config is used.
It's called with two parameters:
1. baseConfig: The current Webpack config
2. options: an object of useful data for editing configuration
Expand All @@ -24,8 +34,8 @@ if (options.type === 'client') {
}
```


## Add Webpack Aliases

In `kyt.config.js`

```javascript
Expand All @@ -38,6 +48,7 @@ modifyWebpackConfig: (baseConfig, options) => {
```

## Add PostCSS Plugins

in `kyt.config.js`
```javascript
modifyWebpackConfig: (baseConfig, options) => {
Expand All @@ -55,20 +66,40 @@ modifyWebpackConfig: (baseConfig, options) => {
}
```

## Add Babel Plugins and Presets
in kyt.config.js
## Update browser list for autoprefixer
```javascript
modifyWebpackConfig: (baseConfig, options) => {
baseConfig.plugins.push(
new webpack.LoaderOptionsPlugin({
options: {
postcss: [autoprefixer({ browsers: ['last 2 versions', 'ios 8'] })],
context: '/',
},
})
);
return baseConfig;
}
```

const babelLoader = baseConfig.module.rules.find(loader => loader.loader === 'babel-loader');
babelLoader.options.plugins.push(path.resolve('./path/to/my/plugin'));
## Add Babel Plugins and Presets

return baseConfig;
As of v0.4.0, kyt respects user `.babelrc` files.

```bash
npm i --save-dev my-babel-plugin
```

in `.babelrc`
```json
{
"presets": ["kyt-core"],
"plugins": ["my-babel-plugin"]
}
```
Check out the current [Babel configuration](/.babelrc).

## Add always-mocked modules to Jest configuration

in `kyt.config.js`
```javascript
modifyJestConfig: (baseConfig) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/Starterkyts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Starter-kyts

The following is a guide for building starter-kyts. If you would like to know more about installing a starter-kyt, check out the [`setup` command](/docs/commands.md#setup).
The following is a guide for building starter-kyts. If you would like to know more about installing a starter-kyt, check out the [`kyt-cli setup` tool](/packages/kyt-cli/README.md).

## How to build a starter-kyt
starter-kyts act as boilerplates for projects. They use kyt as their build system and add additional source code and tools.
Expand Down
Loading

0 comments on commit 18a8c5b

Please sign in to comment.