Skip to content

Commit

Permalink
adds lerna; removes dev yarn support (#530)
Browse files Browse the repository at this point in the history
quick update
  • Loading branch information
delambo authored Aug 17, 2017
1 parent a11bb86 commit e3912bb
Show file tree
Hide file tree
Showing 36 changed files with 53,927 additions and 26,613 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build/Release

# Dependency directory
node_modules
!e2e_tests/fixtures/**/node_modules

# Optional npm cache directory
.npm
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
node_js:
- 6
script: yarn run update && yarn run lint && yarn test && yarn run e2e
script: npm run bootstrap && npm run lint && npm test && npm run e2e
58 changes: 23 additions & 35 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,44 @@ Please make sure all PRs are:
3. Connected to an issue
4. Update the [CHANGELOG](/CHANGELOG.md) (for MASTER) to reflect your PR changes.

### kyt local development
### Create an RFC

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`
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).

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

## Create an RFC
We recommend installing `npm` version 5.3.0 or later: `npm i npm -g`

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).
1. Fork and clone kyt
2. Run `npm run bootstrap` to install the packages in the monorepo.

## Build a starter-kyt
[lerna](https://github.com/lerna/lerna) is used to manage the monorepo but most of the development commands should be exercised through root directory package.json scripts. The following are some useful npm scripts for development:

Have a great idea for a boilerplate? Build it on top of kyt and let us know about it. Directions are [here](/docs/Starterkyts.md).
We feature [recommended starter-kyts](/docs/commands.md#recommended-starter-kyts)
### bootstrap

## kyt local development
`bootstrap` will install `node_modules` (hoisting most dependencies to the root `node_modules` directory) across all of the packages and symlink local package dependencies. Starter kyt sources (`starter-src/`) are fully installed (not hoisted) and `kyt` is linked.

To setup kyt for local development, install `yarn` and run the following:
From the root of kyt, run:

```
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.
`npm run bootstrap`

### bootstrap
### clean-bootstrap

Bootstrap will set you up with a clean slate. Every time it is run, it will remove and re-install the node_modules across all of the packages, npm link `kyt-cli` and `kyt` so you can run them locally on the command line, and symlink local monorepo dependencies..
`clean-bootstrap` is useful after you make or pull down kyt with dependency changes. It will remove `node_modules` directories before calling `bootstrap`.

From the root of kyt, run:

`yarn run bootstrap`
`npm run clean-bootstrap`

### update
### Test

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`.
Unit tests for all packages in the monorepo can be run from the root of the repository: `npm run test`.

From the root of kyt, run:
Similarly, e2e tests, located in the `e2e` directory can be run from the root of the repository: `npm run e2e`

### Lint

`yarn run update`
The monorepo has a top level `lint` command which runs lint for all the packages: `npm run lint`

### Testing local kyt-core changes

Expand All @@ -79,6 +66,7 @@ To test setting up/installing local starter-kyts, you need to specify the `--loc

`kyt-cli setup -d test --local-path /path/to/my-local-starter-kyt-dir`

### Testing kyt
## Build a starter-kyt

More instructions TK
Have a great idea for a boilerplate? Build it on top of kyt and let us know about it. Directions are [here](/docs/Starterkyts.md).
We feature [recommended starter-kyts](/docs/commands.md#recommended-starter-kyts)
79 changes: 0 additions & 79 deletions bootstrap.js

This file was deleted.

62 changes: 0 additions & 62 deletions clean.js

This file was deleted.

1 change: 1 addition & 0 deletions e2e_tests/fixtures/build-default/node_modules/.gitkeep

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "stylelint-config-kyt",
"extends": "../packages/stylelint-config-kyt",

"rules": {
}
Expand Down
2 changes: 1 addition & 1 deletion e2e_tests/fixtures/lintStyle-user-rc/.stylelintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "stylelint-config-kyt",
"extends": "../packages/stylelint-config-kyt",

"rules": {
}
Expand Down
3 changes: 0 additions & 3 deletions e2e_tests/fixtures/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = {
const stagePath = path.join(rootDir, stageName);
shell.mkdir(stagePath);
shell.exec(`cp -a ${rootDir}/e2e_tests/fixtures/${fixtureName}/. ${stagePath}/`);
shell.ln('-s',
path.join(rootDir, 'packages/kyt-core/node_modules'),
path.join(stagePath, 'node_modules'));
shell.cd(stagePath);
},

Expand Down
2 changes: 1 addition & 1 deletion e2e_tests/tests/kyt-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const stageName = 'stage-build';
describe('kyt build', () => {
it('should compile files into a build directory', () => {
util.setupStageWithFixture(stageName, 'build-default');
const output = shell.exec('npm run build');
const output = shell.exec('kyt build');
expect(shell.test('-f', 'build/publicAssets.json')).toBe(true);
expect(shell.test('-d', 'build/server')).toBe(true);

Expand Down
4 changes: 2 additions & 2 deletions e2e_tests/tests/starter-kyt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const kill = require('../utils/psKill');
const path = require('path');
const fs = require('fs');

// shell.config.silent = true;
shell.config.silent = true;

describe('starter kyts', () => {
describe('kyt-starter-universal', () => {
Expand All @@ -17,7 +17,7 @@ describe('starter kyts', () => {
it('should start a dev server on :3000', () => {
let outputTest;
const run = new Promise(resolve => {
const child = shell.exec('node_modules/kyt/cli/index.js dev', () => {
const child = shell.exec('node_modules/.bin/kyt dev', () => {
resolve(outputTest);
});
child.stdout.on('data', data => {
Expand Down
12 changes: 12 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"lerna": "2.0.0",
"packages": ["packages/*", "packages/**/starter-src"],
"commands": {
"bootstrap": {
"hoist": true,
"ignore": "kyt-starter-*"
}
},
"loglevel": "verbose",
"version": "independent"
}
Loading

0 comments on commit e3912bb

Please sign in to comment.