Skip to content

Commit

Permalink
feat: switch to Yarn Workspaces (#690)
Browse files Browse the repository at this point in the history
* feat: switch to Yarn

* chore: bump version in .nvmrc

* chore: travis

* chore: update path to config

* fix: patterns for ci
  • Loading branch information
staylor authored Nov 24, 2020
1 parent 063d85f commit e029ef9
Show file tree
Hide file tree
Showing 24 changed files with 13,529 additions and 21,101 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.caches
stage-cli

# Logs
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.18.3
14.5.0
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
language: node_js
node_js:
- 12.14.1
- 14.5.0
- lts/dubnium
- lts/erbium
script: npm run bootstrap && npm run lint:ci && npm run test:ci && npm run e2e
before_script:
- yarn exec lerna run prepare
script:
- yarn lint:ci
- yarn test:ci
- yarn e2e
cache: yarn
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ See something you think we should address? Open an issue.

Please make sure all PRs are:

1. linted (`npm run lint`)
1. tested (`npm t`)
1. linted (`yarn lint`)
1. tested (`yarn test`)
1. Connected to an issue
1. Update the [CHANGELOG](/CHANGELOG.md) (for MASTER) to reflect your PR changes.

Expand All @@ -22,7 +22,7 @@ If you want to propose a large feature idea or architecture change you should co

1. `nvm use`
1. Fork and clone `kyt`
1. Run `npm run bootstrap` to install the packages in the monorepo
1. Run `yarn bootstrap` to install the packages in the monorepo

[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:

Expand All @@ -32,25 +32,25 @@ If you want to propose a large feature idea or architecture change you should co

From the root of `kyt`, run:

`npm run bootstrap`
`yarn bootstrap`

### clean-bootstrap

`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:

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

### Test

Unit tests for all packages in the monorepo can be run from the root of the repository: `npm t`.
Unit tests for all packages in the monorepo can be run from the root of the repository: `yarn test`.

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

### Lint

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

## Build a `starter-kyt`

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ brew install nvm
nvm use
```

1. `npm install --save-dev kyt`
1. `yarn add --dev kyt`
1. `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](/packages/kyt-core/README.md).
1. `npm run dev`
1. `yarn dev`
1. Check out `http://localhost:3000`

## Features
Expand Down Expand Up @@ -57,7 +57,7 @@ See the [kyt](/packages/kyt-core/README.md) documentation for more details.
Running `kyt setup` includes these commands as scripts in your `package.json`:

```
npm run dev
yarn dev
```

Or you can run a command using `npx kyt {command}`:
Expand Down
2 changes: 1 addition & 1 deletion docs/Starterkyts.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following is a guide for building `starter-kyt`s. If you would like to know
...
"scripts": {
"typings": "typings install",
"lint": "npm run tslint 'src/**/*.ts'"
"lint": "yarn tslint 'src/**/*.ts'"
},
"kyt": {
"version": "0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
`kyt setup` includes these commands as scripts in your `package.json`:

```
npm run dev
yarn dev
```

Or you can run a command with `npx kyt command`
Expand Down
1 change: 0 additions & 1 deletion e2e_tests/tests/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('KYT CLI', () => {

it('sets up the package json scripts', () => {
const userPackageJSON = jest.requireActual(path.join(process.cwd(), 'package.json'));
// eslint-disable-next-line import/no-unresolved
const { scripts } = userPackageJSON;

expect(scripts.dev).toBe('kyt dev');
Expand Down
6 changes: 3 additions & 3 deletions e2e_tests/tests/starter-kyt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('starter kyts', () => {
shell.cd(path.join(util.rootDir, 'packages/kyt-starter-universal/starter-src'));
});

jest.setTimeout(1000000); // eslint-disable-line no-undef
jest.setTimeout(1000000);

it('should start a dev server on :3000', () => {
let outputTest;
Expand All @@ -34,7 +34,7 @@ describe('starter kyts', () => {
return run.then(test => expect(test).toBe(true));
});

jest.setTimeout(400000); // eslint-disable-line no-undef
jest.setTimeout(400000);

it('should build and run', () => {
let outputTest;
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('starter kyts', () => {
shell.cd(path.join(util.rootDir, 'packages/kyt-starter-static/starter-src'));
});

window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000; // eslint-disable-line no-undef
window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;

it('should start a server on :3001', () => {
let outputTest;
Expand Down
10 changes: 10 additions & 0 deletions jest-runner-eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
cliOptions: {
cache: true,
cacheLocation: '.caches/eslint',
ext: ['.js', '.json'],
fix: !!process.env.ESLINT_FIX,
quiet: !!process.env.ESLINT_QUIET,
reportUnusedDisableDirectives: true,
},
};
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const jestConfig = {

if (process.env.CI) {
jestConfig.coverageReporters = ['lcov', 'text-summary'];
jestConfig.reporters = [[require.resolve('jest-silent-reporter'), { useDots: true }]];
jestConfig.reporters = [['jest-silent-reporter', { useDots: true }]];
}

module.exports = jestConfig;
20 changes: 20 additions & 0 deletions jest.eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require('path');

const jestConfig = {
runner: 'jest-runner-eslint',
displayName: 'lint',
rootDir: __dirname,
cacheDirectory: path.join(__dirname, '.caches/jest-runner-eslint'),
testMatch: ['<rootDir>/**/*.js(on)?'],
testPathIgnorePatterns: ['/node_modules/', '/lib/', '/stage-cli/', '/.caches/', '/coverage/'],
haste: {
computeSha1: true,
throwOnModuleCollision: false,
},
};

if (process.env.CI) {
jestConfig.reporters = [['jest-silent-reporter', { useDots: true }]];
}

module.exports = jestConfig;
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"npmClient": "npm",
"packages": ["packages/*", "packages/**/starter-src"],
"npmClient": "yarn",
"version": "independent",
"useWorkspaces": true,
"command": {
"publish": {
"conventionalCommits": true
Expand Down
Loading

0 comments on commit e029ef9

Please sign in to comment.