Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monorepo #330

Merged
merged 35 commits into from
Dec 9, 2016
Merged

Monorepo #330

merged 35 commits into from
Dec 9, 2016

Conversation

ccpricenytimes
Copy link
Contributor

@ccpricenytimes ccpricenytimes commented Nov 23, 2016

fixes #323
fixes #327
Makes kyt a mono repo 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
  • setup now supports copying devDependencies from starter-kyts
  1. 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
  1. kyt-utils - Shared kyt code. Not to be used independently
  2. starter-kyts - kyt-starter-static and kyt-starter-universal now live in the yt repo.

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

Tasks before merge:

  • prepublish kyt-utils as alpha

  • point kyt-cli and kyt-core dependency to kyt-utils alpha rather than file dependency

  • Fix ToDos in setup

Post Merge:

  • Prepublish kyt-cli as alpha -- and test. Then remove hack

I've also started the docs which can get merged after all the monorepo packages are published.
https://github.com/NYTimes/kyt/compare/monorepo...monorepo-docs?expand=1

@ccpricenytimes ccpricenytimes changed the title Monorepo WIP: Monorepo Nov 23, 2016
@ccpricenytimes ccpricenytimes changed the title WIP: Monorepo Monorepo Dec 3, 2016
Copy link
Contributor

@jaredmcdonald jaredmcdonald left a comment

Choose a reason for hiding this comment

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

looks great overall! i have a bunch of microfeedback to take or leave

@@ -1,4 +1,4 @@
language: node_js
node_js:
- 6.0
script: npm run lint && npm test && npm run e2e
script: cd packages/kyt-core && npm install && cd ../kyt-cli && npm install && cd ../kyt-utils && npm install && cd ../.. && npm run lint && npm install && npm test && npm run e2e
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe worth breaking out into a separate script?

- `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
3. kyt-utils - Shared kyt code. Not to be used independently
4. starter-kyts - kyt-starter-static and kyt-starter-universal now live in the yt repo.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo, yt => kyt

},
"engines": {
"node": ">=6.1.0"
"private": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

what does "private": true mean here? and the version? maybe if this is just for the e2e tests, we could move those to another folder at the root level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

means it won't let you publish to npm, it's just as a safeguard. I think its nice to have these at the root level because you can run all the tests and linting at once.

@@ -0,0 +1,5 @@
{
"extends": [
"../kyt-core/config/.eslintrc.base.json"
Copy link
Contributor

Choose a reason for hiding this comment

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

is the idea that this will change to a versioned dependency once kyt-core is (pre)published? thoughts on publishing the eslint configs separately too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because this linting is just for when you're locally developing I think it's fine to point to another package. We can certainly revisit publishing the eslint configs. Thoughts @delambo?

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good!

userKytConfigPath,
userNodeModulesPath,
userPackageJSONPath,
} = require('../../utils/paths')(); // eslint-disable-line import/newline-after-import
// eslint-disable-next-line import/no-dynamic-require
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can lose the eslint comment now, it's not a "dynamic require" anymore

const tmpDir = path.resolve(userRootPath, '\.kyt-tmp'); // eslint-disable-line no-useless-escape
const repoURL = args.repository || 'https://github.com/NYTimes/kyt-starter-universal.git';
const removeTmpDir = () => shell.rm('-rf', tmpDir);
const tmpRepo = path.resolve(userRootPath, '\.kyt-tmp'); // eslint-disable-line no-useless-escape
Copy link
Contributor

Choose a reason for hiding this comment

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

this should just be equivalent to '.kyt-tmp' without the eslint comment, no?

type: 'list',
name: 'starterChoice',
message: 'Which starter-kyt would you like to install?', // eslint-disable-line
choices: ['Universal', 'Static'],
Copy link
Contributor

Choose a reason for hiding this comment

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

probably ok for now but it would be cool to have this assembled by just reading the contents of packages/starter-kyts, or at least some configuration somewhere?

also, maybe it's worth having a third option for "Specify a remote repository" where you don't necessarily need knowledge of the -r flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm yeah that sounds cool actually, maybe a post merge task?

{
type: 'confirm',
name: 'cliVersion',
message: 'There is a newer version of kyt-cli available. \n We recommend you upgrade before you continue. \n Would you like to proceed anyway?',
Copy link
Contributor

Choose a reason for hiding this comment

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

could this message output the installed and latest version of kyt-cli? (e.g. "You have 0.4.0 installed, the latest is 0.5.2")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah definitely! we can test after we prepublish

};


program
Copy link
Contributor

Choose a reason for hiding this comment

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

another potential command this might have (just spitballing) could be ls-starter-kyts (or something with a better name) - lists available local starter kyts

i'd also add to the docs for the options (directory defaults to ., setup doesn't necessarily need a github url since it will prompt for static and universal, -r is a repo address for a starter-kyt)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ls-starter-kyts would involve finding the kyt repo and looking for the list because kyt-cli won't have any of that info locally, we should be thinking about how to keep all this connected though. I want to think through this a little more. Let's chat about it

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, yeah, maybe there is a way to do this but let's not block this pr on it

### BREAKING CHANGES

#### MONOREPO
kyt is now a mono repo with several packages
Copy link
Member

Choose a reason for hiding this comment

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

We should probably stay consistent on the name "monorepo"

"kyt-cli": "index.js"
},
"scripts": {
"test": "jest --testPathPattern /__tests__/",
Copy link
Member

Choose a reason for hiding this comment

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

Do we need test and lint here? I thought that we were testing and linting from the main /package.json.

Copy link
Contributor

Choose a reason for hiding this comment

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

i think the main package.json just runs the sub-packages' scripts

@@ -1,6 +1,24 @@

## Master

## 0.4.0 (TBD)
Copy link
Member

Choose a reason for hiding this comment

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

er, shouldn't this go under the "## Master" section?

@@ -0,0 +1,32 @@
{
"name": "kyt-cli",
"version": "0.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

Start at 0.0.1

@@ -0,0 +1,21 @@
{
"name": "kyt-utils",
"version": "0.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

Start at 0.0.1.

ccpricenytimes and others added 5 commits December 9, 2016 14:43
* 'monorepo' of github.com:NYTimes/kyt:
  removing branch specific code and changing cli version to alpha to prep for publish after merge
  update kyt-utils to point to npm
@delambo delambo merged commit 7385b0c into master Dec 9, 2016
@delambo delambo deleted the monorepo branch December 9, 2016 21:09
tizmagik added a commit that referenced this pull request Dec 14, 2016
* master: (35 commits)
  creates local copies of packages so e2e tests use latest code (#345)
  adds style and script linter packages (#344)
  now using npm version to check for kyt-cli updates (#337)
  Adds kyt version option to setup command (#343)
  make lint-script command; lint now runs scripts and style (#339)
  Adds bootstrap scripts (#341)
  fixes test coverage command (#342)
  Run test from root directory (#336)
  Monorepo (#330)
  [ci skip] document Jest/Watchman issue and common workaround (#334)
  Catch SIGINT (#332)
  Fixes e2e tests (#326)
  Removes deprecated reflect eslint rule (#325)
  Upgrade Linter dependencies (#289)
  [doc]fix path of eslintrc and stylelintrc (#321)
  Update unit tests for changes made to resolve #303 (#318)
  adds ISSUE_TEMPLATE (#317)
  Adds rfc template (#316)
  document possible kyt setup repository url formats (#314)
  Overwrites default npm init test script on setup (#293)
  ...

# Conflicts:
#	.travis.yml
#	e2e_tests/tests/cli.test.js
#	package.json
#	packages/kyt-cli/cli/actions/setup.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request]copy devDependencies when use kyt setup from starter RFC: Monorepo
3 participants