guigrpa / oao Goto Github PK
View Code? Open in Web Editor NEWA Yarn-based, opinionated monorepo management tool
License: MIT License
A Yarn-based, opinionated monorepo management tool
License: MIT License
Do I steal lerna.json
from another project, or are there some commands I can run?
Ever since yarn upgraded past 0.25.4, I am unable to run bootstrap in Neutrino, there seems to be problems linking packages. I tried switching to workspaces as well but couldn't because of compatibility issues with yarn.
Example log:
https://travis-ci.org/mozilla-neutrino/neutrino-dev/jobs/280543596
Have you noticed anything put of sorts with yarn that would prevent us from upgrading? Right now I have to pin yarn to keep things from busting.
Such a flag would be required in order to support application sub-packages that should run inside the monorepo. See #16 for background.
In #51, the yarn link neutrino
command failed with:
2017-10-10T14:09:45.076Z main TRACE ┌── Run cmd yarn link neutrino at packages/neutrino-middleware-env [CREATED]
2017-10-10T14:10:03.867Z storyboard WARN └── REVEALED PAST LOGS END HERE
2017-10-10T14:10:03.867Z yarn ERROR | Killed
2017-10-10T14:10:03.868Z yarn INFO |
2017-10-10T14:10:04.008Z main ERROR Command 'yarn link neutrino' failed at packages/neutrino-middleware-env
main ERROR name: 'Error'
main ERROR message: Command failed: /bin/sh -c yarn link neutrino
main ERROR message: Killed
main ERROR message:
main ERROR stack: Error: Command failed: /bin/sh -c yarn link neutrino
main ERROR stack: Killed
main ERROR stack:
main ERROR stack: at Promise.all.then.arr (/home/travis/build/edmorley/neutrino-dev/node_modules/oao/node_modules/execa/index.js:210:11)
main ERROR stack: at process._tickCallback (internal/process/next_tick.js:109:7)
2017-10-10T14:10:07.704Z main TRACE └── Run cmd yarn link neutrino at packages/neutrino-middleware-env [CLOSED]
Error: Command failed: yarn link neutrino
at _callee2$ (/home/travis/build/edmorley/neutrino-dev/node_modules/oao/lib/utils/shell.js:173:19)
at tryCatch (/home/travis/build/edmorley/neutrino-dev/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/home/travis/build/edmorley/neutrino-dev/node_modules/regenerator-runtime/runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/home/travis/build/edmorley/neutrino-dev/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/home/travis/build/edmorley/neutrino-dev/node_modules/oao/lib/utils/shell.js:28:191)
at /home/travis/build/edmorley/neutrino-dev/node_modules/oao/lib/utils/shell.js:28:402
at process._tickCallback (internal/process/next_tick.js:109:7)
2017-10-10T14:10:07.712Z storyboard INFO └── ROOT STORY: Node.js 6.11.4 on Linux 64-bit, SB 3.1.3 [CLOSED]
This error message doesn't really help with debugging the problem, since:
>1
?)Many thanks :-)
When sub-packages reference another one, I'm currently using *
but dunno if that's kept in sync somehow?
(My project currently has no tags)
Hey @guigrpa - Awesome job with this CLI - Really enjoying it so far! :)
The only thing I currently am missing is a run
command similar to the lerna run
command. Basically it would iterate through all packages, check if the provided script name is within the package.json
and if that is the case it would execute a yarn run <script-name>
.
Would you be up for such a contribution? I would be willing to do it in the next few days and create a PR to this repository! :)
Hello,
I am comming (again sorry :-p) with my continuous integration issues
After putting all skip options:
$ oao publish --no-master --no-confirm --no-check-uncommitted --no-check-unpulled --no-git-commit --version 0.1.0
Nothing happen during the publish:
2017-03-08T07:52:23.571Z storyboard INFO ┌── ROOT STORY: Node.js 7.6.0 on Win32 64-bit, SB 3.1.1 [CREATED]
2017-03-08T07:52:23.572Z storyboard INFO Log filter: *:DEBUG
0.7.3
2017-03-08T07:52:23.824Z storyboard INFO └── ROOT STORY: Node.js 7.6.0 on Win32 64-bit, SB 3.1.1 [CLOSED]
Done in 2.45s.
Is there a way to force the publish ?
I would like to discuss some improvements:
allSpecs[ROOT_PACKAGE].specs.version
) is null
and --new-version
is specified then publish
will be skipped.I would like to improve publish
command:
--new-version
is specified then it will be used;--new-version
is not specified then master version will be used in case of missing git version;--new-version
is not specified then git version will be used in case of successfully resolved next version;Here is a simple fix for that:
// Get last tag and find packages requiring updates
const lastTag = await gitLastTag();
// Determine a suitable version number
let nextVersion;
if (!newVersion) {
const masterVersion = await getMasterVersion(allSpecs, lastTag);
if (masterVersion !== null && confirm) {
nextVersion = await getNextVersion(masterVersion);
} else {
nextVersion = masterVersion;
}
} else {
nextVersion = newVersion;
}
if (!nextVersion) {
mainStory.error('No version have been specified');
throw new Error('INVALID_VERSION');
}
const dirty = await findPackagesToUpdate(allSpecs, lastTag, nextVersion);
if (!dirty.length) {
mainStory.info('No sub-packages have been updated');
return;
}
allSpecs[pkgName].version
instead of master/git/--new-version
versions;[email protected]
is published then it should be skipped.Hello,
What do you think about having a --no-git
during the publish process ? Or one option --no-[step]
for each step related to a git action (like --no-master
)
Git steps:
Thx
Reason being, I have oao bootstrap --src '{examples,packages}/*'
in my package.json
, but if I do oao status
or oao add
, I have to redeclare this --src
over & over again.
Having "oao": { "src": "{examples,packages}/*" }
in package.json
could help remedy this.
I've been experimenting with oao
and liking the simple workflow. One major hiccup I've hit is that it is difficult to effectively build docker
images out of one of the monorepo's packages when it depends on another private: true
package.
For local testing, the linking solution works quite well. However, when it comes time to build out images, I'm hitting a major workflow barrier. It boils down to somehow getting the private, local packages into the docker build context in a way that yarn
can read them.
Any ideas?
In CI it would be helpful to install package dependencies with a frozen lockfile so we can catch when package.json or lock files are out of step with what yarn installs.
Maybe a oao bootstrap --frozen
flag, or proxy any unrecognized flag directly to yarn, e.g. yarn bootstrap --frozen-lockfile
?
There seems to be something out of step with bumping versions with dependent sub-packages. Let's take the following example:
package alpha
:
{
"name": "alpha",
"version": "1.0.0"
}
package beta
:
{
"name": "beta",
"version": "1.0.0",
"dependencies": {
"alpha": "1.0.0"
}
}
If I want to make updates to alpha
, I have to manually update the dependency version in beta
to pick up the changes. If alpha
has new dependencies, and thereby a new yarn.lock file, those deps won't be picked up in the yarn.lock file of beta
.
Running bootstrap
after this work doesn't make any changes either.
When running oao bootstrap
an error is thrown:
Error: Package name does not match directory name
This is due to a package module having a scoped name versus the folder name
// package name
@scopedname/module-name
// folder name
scopedname-module-name
STR:
.travis.yml
, replacing the yarn install step --version 1.0.0
with --version 0.28.4
Expected:
All four Travis jobs pass (each push triggers jobs on 2 node versions).
Actual:
Worth noting:
node_modules
present, and the yarn cache is empty..travis.yml
I'm running oao directly rather than via a yarn run
command, to rule out any leftover YARN_SILENT
issues, however there is still no useful stdout/stderr from the failed yarn link command (I'll file a new issue for adding more debugging info for cases like these).yarn-error.log
files created that might have shed some light on the error.The yarn 1.0.0 release notes are here:
https://github.com/yarnpkg/yarn/releases/tag/v1.0.0
Hello there! Firstly, thanks you for the oao tool, it's really awesome.
I've a feature request to introduce to oao all 'cmd'
command a flag (may be --except <args...>
) for excepting a list of packages for which to run the cmd
command.
Example:
oao all 'webpack' --except pkg1 pkg3
packages
- pkg1
- pkg2
- pkg3
- pkg4
It'll run the webpack
command for pkg2
, pkg4
, except for pkg1
, pkg3
.
Even though installation is successful, an unmet peer dependency warning is issued:
warning "[email protected]" has unmet peer dependency "storyboard-core@^3.0.0-rc.0".
This can be traced back to yarnpkg/yarn#2688.
Keeping this open to be able to trace.
Overload oao add|remove
and detect internal dependencies. Use the current version number as the minimum required, with a caret.
I don't know why, but sometimes when I will run bootstrap
the subpackages dependencies declarations are removed. I figure out that oao
remove subpackages dependencies and them, put they again, I think that when some error happens in this process, the declarations are removed and aren't put again in package.json
When trying to install a new dependency in a sub-package, yarn complains that it is unable to find a version matching a linked dependency. For example:
Monorepo is at v1.0.0. We start development on major version 2.0.0. Package sub-b
depends on sub-a
. When you try to yarn add
anything new in sub-b
, yarn will attempt to fix node_modules up by putting the correct version of sub-a
2.0.0 in, but it can't because it doesn't exist yet. Calamity ensues.
As a workaround I used npm to save the new dependency, deleted the yarn.lock files, and re-ran oao bootstrap
.
Currently status command throws the following error:
TypeError: Cannot read property 'length' of undefined
at field (/Users/mdreizin/.config/yarn/global/node_modules/oao/lib/status.js:227:10)
at _callee3$ (/Users/mdreizin/.config/yarn/global/node_modules/oao/lib/status.js:177:51)
at tryCatch (/Users/mdreizin/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:64:40)
at Generator.invoke [as _invoke] (/Users/mdreizin/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:299:22)
at Generator.prototype.(anonymous function) [as next] (/Users/mdreizin/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:116:21)
at step (/Users/mdreizin/.config/yarn/global/node_modules/oao/lib/status.js:13:191)
at /Users/mdreizin/.config/yarn/global/node_modules/oao/lib/status.js:13:361
Ran oao for the first time.
oao status
Error: INVALID_DIR_NAME
at validatePkgName (/Users/burdon/.config/yarn/global/node_modules/oao/lib/utils/readSpecs.js:88:11)
at readOneSpec (/Users/burdon/.config/yarn/global/node_modules/oao/lib/utils/readSpecs.js:75:3)
at /Users/burdon/.config/yarn/global/node_modules/oao/lib/utils/readSpecs.js:46:25
at Array.forEach (native)
at _callee$ (/Users/burdon/.config/yarn/global/node_modules/oao/lib/utils/readSpecs.js:45:22)
at tryCatch (/Users/burdon/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/Users/burdon/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/Users/burdon/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/Users/burdon/.config/yarn/global/node_modules/oao/lib/utils/readSpecs.js:24:191)
at /Users/burdon/.config/yarn/global/node_modules/oao/lib/utils/readSpecs.js:24:361
It would be nice to have ability to run watch tasks.
"scripts": {
"watch": "babel src --out-dir dist --source-maps --watch --copy-files"
}
Currently oao
freezes on the first package :(
What's weird is that I've used git for years, have a project we've been working on for ~2 years, and this command failed:
$ oao status
It's due to this command here:
Line 34 in a865dc3
I was able to fix it with this:
$ git push --set-upstream origin master
Both yarn outdated
and yarn upgrade-interactive
return Outdated lockfile. Please run yarn install
and try again., likely do to the oao dependencies.
oao upgrade
seems to bail with an error on the 1st outdated package.
❯ oao all "yarn upgrade-interactive"
2017-08-30T15:44:00.857Z storyboard INFO ┌── ROOT STORY: null, SB 3.1.1 [CREATED]
2017-08-30T15:44:00.858Z storyboard INFO Log filter: *:DEBUG
2017-08-30T15:44:01.168Z main INFO ┌── Run cmd yarn upgrade-interactive at examples/with-404 [CREATED]
2017-08-30T15:44:01.393Z yarn INFO yarn upgrade-interactive v0.27.5
2017-08-30T15:44:01.527Z yarn ERROR error Outdated lockfile. Please run `yarn install` and try again.
2017-08-30T15:44:01.527Z yarn INFO info Visit https://yarnpkg.com/en/docs/cli/upgrade-interactive for documentation about this command.
2017-08-30T15:44:01.537Z yarn INFO
2017-08-30T15:44:01.541Z main ERROR Command 'yarn upgrade-interactive' failed at examples/with-404
main ERROR name: 'Error'
main ERROR message: Command failed: /bin/sh -c yarn upgrade-interactive
main ERROR message: error Outdated lockfile. Please run `yarn install` and try again.
main ERROR message: yarn upgrade-interactive v0.27.5
main ERROR message: info Visit https://yarnpkg.com/en/docs/cli/upgrade-interactive for documentation about this command.
main ERROR message:
main ERROR stack: Error: Command failed: /bin/sh -c yarn upgrade-interactive
main ERROR stack: error Outdated lockfile. Please run `yarn install` and try again.
main ERROR stack: yarn upgrade-interactive v0.27.5
main ERROR stack: info Visit https://yarnpkg.com/en/docs/cli/upgrade-interactive for documentation about this command.
main ERROR stack:
main ERROR stack: at Promise.all.then.arr (/Users/eric/.config/yarn/global/node_modules/execa/index.js:210:11)
main ERROR stack: at process._tickCallback (internal/process/next_tick.js:109:7)
2017-08-30T15:44:01.543Z main INFO └── Run cmd yarn upgrade-interactive at examples/with-404 [CLOSED]
My current setup:
/packages
/project-core
/bin
/start
package.json
Is there a way for the package-core
project (which references "bin": "./bin/start"
) to be "linked" or installed in a way as part of the root project?
The ideal being:
{
"dependencies": {
"project-core": "*"
},
"scripts": {
"start": "project-core"
}
}
Given this scenario:
- packages/[email protected]
- packages/app-one
- deps: [email protected]
- packages/app-two
- deps: [email protected]
The default behavior seems to be to link
[email protected]
into both app-one
and app-two
, even though app-one
is only satisfied by 1.0.0
. I'm a bit surprised this is happening (and that it also seems to be the case in lerna), as I would expect oao
to try to fetch a version of module-one
that satisfies its package.json
instead once it notices that the local version does not. Right now you could end up with hard to track issues during development if one of the apps is using an incompatible version, especially since this also does not seem to be picked up by oao outdated
(which seems to be because yarn outdated
does not like symlinked modules). Is there any reasononing behind this behavior?
I guess this is also partly covered by #16 and the yarn knit
discussion, but would there perhaps be a workaround that can be used in the meantime? Could oao outdated
for example warn for version inconsistencies in consuming packages so that people running a publish are at least aware of an incompatibility?
Suppose I have this:
packages/
example-a/ (example-a)
scoped-b/ (@scoped/b)
When I run:
$ oao add example-a @scoped/b
Yarn attempts to run yarn install @scoped/b
(which doesn't exist yet).
When a command failed to run, there is a waning about the promise rejection (node 7.5.0 on windows 10) :
(node:11656) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed: tsc
(node:11656) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero
exit code.
Full log :
$ oao all tsc
2017-02-20T14:31:48.728Z storyboard INFO ┌── ROOT STORY: Node.js 7.5.0 on Win32 64-bit, SB 3.0.0 [CREATED]
2017-02-20T14:31:48.729Z storyboard INFO Log filter: *:DEBUG
2017-02-20T14:31:48.921Z main INFO ┌── Run cmd tsc at packages/lib-1 [CREATED]
2017-02-20T14:31:50.119Z tsc INFO |
2017-02-20T14:31:50.122Z main INFO └── Run cmd tsc at packages/lib-1 [CLOSED]
2017-02-20T14:31:50.123Z main INFO ┌── Run cmd tsc at packages/lib-2 [CREATED]
2017-02-20T14:31:51.551Z tsc INFO |
2017-02-20T14:31:51.552Z main INFO └── Run cmd tsc at packages/lib-2 [CLOSED]
2017-02-20T14:31:51.552Z main INFO ┌── Run cmd tsc at packages/lib-3 [CREATED]
2017-02-20T14:31:52.764Z tsc INFO | src/lib-3.module.ts(12,8): error TS2307: Cannot find module 'ng2-translate'.
2017-02-20T14:31:52.779Z tsc INFO |
2017-02-20T14:31:52.779Z main ERROR Command failed [2]
2017-02-20T14:31:52.780Z main INFO └── Run cmd tsc at packages/lib-3 [CLOSED]
(node:11656) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed: tsc
(node:11656) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero
exit code.
2017-02-20T14:31:52.782Z storyboard INFO └── ROOT STORY: Node.js 7.5.0 on Win32 64-bit, SB 3.0.0 [CLOSED]
Done in 4.68s.
By the way, maybe you can help, when I want to compile lib-3 which have a dependency graph like :
(internal) lib-3 -> (internal) lib-1 -> (external) ng2-translate
I doesn't fin the ng2-translate but it's a dependency of lib-1 not of lib-3...probably caused by the link...(sorry for this stupid question)
If you execute a command in a lot of your packages and it failed in one of them, the error output might not be completely visible which creates more effort for the developer since he has to cd
into the failed package and re-run the command again to see the full output.
It would be cool if the whole output of the failed command would be printed after the summary.
As far as I can see, the thing keeping us from switching from lerna to oao is that oao doesn't have the ability to run scripts in dependency order, which is something lerna does by default. Basically, this means that it will run scripts in packages with no internal dependencies first, and then outwards from there. This is something generally needed to compile typescript inside of a mono-repo.
The parameter --ignore-errors
(for oao all
and oao run-script
) is very useful. I would think it is not intended that it is not documented. Am i right? 😉
Hello,
In case of having cross dependencies between packages, what do you think about updating also the version of those dependencies ?
BEFORE
packages/lib1/package.json
:
{
"name": "lib-1",
"version":"0.1.0"
}
packages/lib2/package.json
:
{
"name": "lib-2",
"version":"0.1.0",
"peerDependencies": {
"lib-1": "0.1.0"
}
}
RESET ALL VERSION
$ oao reset-all-versions 0.2.0
AFTER
packages/lib1/package.json
:
{
"name": "lib-1",
"version":"0.2.0"
}
packages/lib2/package.json
:
{
"name": "lib-2",
"version":"0.2.0",
"peerDependencies": {
"lib-1": "0.1.0" ---> THIS IS NOT UPDATED (same for dependencies or devDependencies)
}
}
What do you think ?
Hello,
I get this error when I try to execute a command using oao all :
$ oao all ls
2017-02-21T07:47:14.368Z storyboard INFO ┌── ROOT STORY: Node.js 7.5.0 on Win32 64-bit, SB 3.0.0 [CREATED]
2017-02-21T07:47:14.370Z storyboard INFO Log filter: *:DEBUG
2017-02-21T07:47:14.557Z main INFO ┌── Run cmd ls at packages/lib-1 [CREATED]
2017-02-21T07:47:14.675Z ls INFO | index.ts
2017-02-21T07:47:14.676Z ls INFO | node_modules
2017-02-21T07:47:14.676Z ls INFO | package.json
2017-02-21T07:47:14.681Z ls INFO | rollup.config.js
2017-02-21T07:47:14.681Z ls INFO | src
2017-02-21T07:47:14.682Z ls INFO | yarn.lock
2017-02-21T07:47:14.683Z ls INFO |
2017-02-21T07:47:14.688Z main INFO └── Run cmd ls at packages/lib-1 [CLOSED]
2017-02-21T07:47:14.689Z main INFO ┌── Run cmd ls at packages/lib-2 [CREATED]
2017-02-21T07:47:14.710Z ls INFO | index.ts
2017-02-21T07:47:14.710Z ls INFO | node_modules
2017-02-21T07:47:14.711Z ls INFO | package.json
2017-02-21T07:47:14.711Z ls INFO | rollup.config.js
2017-02-21T07:47:14.711Z ls INFO | src
2017-02-21T07:47:14.711Z ls INFO | yarn.lock
2017-02-21T07:47:14.715Z ls INFO |
2017-02-21T07:47:14.716Z main INFO └── Run cmd ls at packages/lib-2 [CLOSED]
2017-02-21T07:47:14.716Z main INFO ┌── Run cmd ls at packages/lib-3 [CREATED]
2017-02-21T07:47:14.738Z ls INFO | index.ts
2017-02-21T07:47:14.739Z ls INFO | node_modules
2017-02-21T07:47:14.739Z ls INFO | package.json
2017-02-21T07:47:14.739Z ls INFO | rollup.config.js
2017-02-21T07:47:14.739Z ls INFO | src
2017-02-21T07:47:14.739Z ls INFO | yarn.lock
2017-02-21T07:47:14.742Z ls INFO |
2017-02-21T07:47:14.744Z main INFO └── Run cmd ls at packages/lib-3 [CLOSED]
2017-02-21T07:47:14.744Z main INFO ┌── Run cmd ls at packages/tsconfig.json [CREATED]
cd: not a directory: packages/tsconfig.json
2017-02-21T07:47:14.765Z ls INFO | node_modules
2017-02-21T07:47:14.766Z ls INFO | package.json
2017-02-21T07:47:14.766Z ls INFO | packages
2017-02-21T07:47:14.766Z ls INFO | scripts
2017-02-21T07:47:14.767Z ls INFO | yarn.lock
2017-02-21T07:47:14.770Z ls INFO |
2017-02-21T07:47:14.771Z main INFO └── Run cmd ls at packages/tsconfig.json [CLOSED]
2017-02-21T07:47:14.772Z storyboard INFO └── ROOT STORY: Node.js 7.5.0 on Win32 64-bit, SB 3.0.0 [CLOSED]
The last "block" is not a folder...
Right now just doing an installation of oao and running it throws an error:
❯ ./node_modules/.bin/oao bootstrap
module.js:471
throw err;
^
Error: Cannot find module 'babel-polyfill'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/eli/code/neutrino-dev/node_modules/oao/lib/index.js:4:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Looking at the code, it is indeed looking for babel-polyfill in the compiled code, but it's only listed as a dev dependency. This should be either a dependency or peer dependency.
I am opening this discussion because, since I am using this very helpful library, there are many questions that come to my mind.
First of all, I use this client to help me building a monorepo with libraries based on Angular 2. Those libraries will by used by all Angular apps in my company. The architecture that I am trying to resolve is describes HERE.
As you can read in the README, there are a lot of issues that I can solve with oao but I still need to write some scripts for particular parts.
Like everybody, I started to use Lerna at the first time. But it was changing too much my way of working (I mean the company way). I am not saying it's a bad way but companies have their own rules and usually you can't change them easely.
When I tried to fit lerna to it, I had to add a lot of --skip-something
options on each command...It was ugly and finally I don't felt that lerna could helps me.
First I wrote some scripts, then I tried Yerna...and finally oao....and I like it because it is simple and it use yarn (with good hacks ;-)) !
Oao helped me with oao bootstrap
and oao all
but for example, I cannot profite of oao prepublish/publish
. Why ? Because It's already specifying a list of rules that I am forced to follow (some examples) :
oao prepublish
:
oao ppublish
:
master
: companies can have their own git workflow and they can use other branches. (don't react too fast like "Stupid guys, there is an option for that", continue reading ;-))I know I can solve a lot of those issue with options : --no-master, --no-confirm,...and probably may more coming like lerna. But why didn't we think in another way : putting in place a working core without rules (I am not saying removing checks like verifying that glob paths are directories, ...).
And later, adding options to add functionnalities.
It can also be a config file, for example :
oao.json
{
"bootstrap": {
"packages": [
"packages/*",
"other/*"
],
"...": "..."
},
"prepublish": {
"strictVersion": true,
"copyFromRoot": {
"packageFields": [
"description",
"author"
],
"readme": true
},
"...": "..."
},
"publish": {
"strictBranch": "master",
"confirm": true,
"strictCommit": true,
"...": "..."
}
}
Or we could even have a core that allows to plug a list of configurations, plugins, etc...
Ref doc : Asks the user for confirmation that it has built all sub-packages for publishing (using something like yarn build).
Fine, when I build my app :
dist/
folder at the root containing the list of built packages (I transpile and rollup my packages).dist/
, the package.json
and I replace placeholders version for each package.dist/
, the README.md
for each package.And now, you should think : "ok, but it's not my business". My issues here are :
oao bootstrap
my dist folder. Links will enter in conflict with the original ones...how do I do ?I think it could be good to have a relation between the source files and the built files. I mean, my tool should be able to take in account my dist/
folder at the root or in each package folder.
I don't know exactly how but, I think the build steps should be part of the tool.
Me ;-) and many others. When I expose the subject during meetups, I feel that people are interested by the monorepos but they don't find a good tool, or they create many differents ways of doing it.
I you already know, english is not my main language so, in advance, sorry for my bad sentences probably too strict and not in a good and polite way
Thank you if you read all of this. I am really open to your constructive criticism ! Today I am not enough good in node js developments to start those kind of project but I hope some of my ideas will became debates, issues, CR, etc...
It would be nice to have ability to run tasks concurrently like lerna
For some reason I always get an authentication error when trying to use oao publish
. When that command fails, if I use oao all "npm publish"
, everything publishes fine after that.
❯ yarn release
yarn release v0.20.3
$ yarn release:pre && oao publish
yarn release:pre v0.20.3
$ oao prepublish
2017-02-17T16:10:05.512Z storyboard INFO ┌── ROOT STORY: Node.js 6.9.1 on Darwin 64-bit, SB 3.0.0-rc.2 [CREATED]
2017-02-17T16:10:05.512Z storyboard INFO Log filter: *:DEBUG
2017-02-17T16:10:05.646Z main INFO Reading all package.json files...
2017-02-17T16:10:05.649Z main DEBUG Copying README-LINK.md -> packages/neutrino/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.653Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-airbnb-base/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.653Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-jest/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.654Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-karma/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.654Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-mocha/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.655Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-node/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.655Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-react/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.656Z main DEBUG Copying README-LINK.md -> packages/neutrino-preset-web/README.md...
cp: no such file or directory: README-LINK.md
2017-02-17T16:10:05.658Z main INFO Updating package attributes
main INFO description: undefined
main INFO keywords: undefined
main INFO author: 'Eli Perelman <[email protected]>'
main INFO license: 'MPL-2.0'
main INFO homepage: 'https://neutrino.js.org'
main INFO bugs: 'https://github.com/mozilla-neutrino/neutrino-dev/issues'
main INFO repository: 'mozilla-neutrino/neutrino-dev'
2017-02-17T16:10:05.662Z main WARN Please make sure you commit all changes before you attempt "oao publish"
2017-02-17T16:10:05.663Z storyboard INFO └── ROOT STORY: Node.js 6.9.1 on Darwin 64-bit, SB 3.0.0-rc.2 [CLOSED]
✨ Done in 0.56s.
2017-02-17T16:10:05.950Z storyboard INFO ┌── ROOT STORY: Node.js 6.9.1 on Darwin 64-bit, SB 3.0.0-rc.2 [CREATED]
2017-02-17T16:10:05.951Z storyboard INFO Log filter: *:DEBUG
2017-02-17T16:10:06.102Z main INFO Reading all package.json files...
? Have you built all your packages for production? Yes
2017-02-17T16:10:09.326Z main INFO Current branch: master
2017-02-17T16:10:09.343Z main INFO No uncommitted changes
2017-02-17T16:10:09.356Z main INFO Remote history matches local history
2017-02-17T16:10:09.401Z main INFO - Package neutrino (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.414Z main INFO - Package neutrino-preset-airbnb-base (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.428Z main INFO - Package neutrino-preset-jest (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.444Z main INFO - Package neutrino-preset-karma (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.457Z main INFO - Package neutrino-preset-mocha (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.471Z main INFO - Package neutrino-preset-node (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.486Z main INFO - Package neutrino-preset-react (currently 4.0.0) has changed (#files: 2)
2017-02-17T16:10:09.500Z main INFO - Package neutrino-preset-web (currently 4.0.0) has changed (#files: 1)
2017-02-17T16:10:09.502Z main INFO Last tag found: v4.0.0
? Current version is 4.0.0. Next one? Patch (4.0.1)
? Confirm publish (8 package/s, v4.0.1)? Yes
2017-02-17T16:10:25.580Z main INFO ┌── Run cmd npm publish at packages/neutrino [CREATED]
2017-02-17T16:10:27.448Z npm ERROR | npm ERR! publish Failed PUT 401
2017-02-17T16:10:27.450Z npm ERROR | npm ERR! Darwin 16.4.0
2017-02-17T16:10:27.450Z npm ERROR | npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "publish"
2017-02-17T16:10:27.450Z npm ERROR | npm ERR! node v6.9.1
2017-02-17T16:10:27.450Z npm ERROR | npm ERR! npm v4.1.2
2017-02-17T16:10:27.450Z npm ERROR | npm ERR! code E401
2017-02-17T16:10:27.453Z npm ERROR | npm ERR! Could not authenticate eliperelman : neutrino
2017-02-17T16:10:27.453Z npm ERROR | npm ERR!
2017-02-17T16:10:27.453Z npm ERROR | npm ERR! If you need help, you may report this error at:
2017-02-17T16:10:27.453Z npm ERROR | npm ERR! <https://github.com/npm/npm/issues>
2017-02-17T16:10:27.459Z npm ERROR | npm ERR! Please include the following file with any support request:
2017-02-17T16:10:27.459Z npm ERROR | npm ERR! /Users/eli/code/neutrino-dev/packages/neutrino/npm-debug.log
2017-02-17T16:10:27.467Z npm INFO |
2017-02-17T16:10:27.468Z main ERROR Command failed [1]
2017-02-17T16:10:27.469Z main INFO └── Run cmd npm publish at packages/neutrino [CLOSED]
(node:74967) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed: npm publish
2017-02-17T16:10:27.471Z storyboard INFO └── ROOT STORY: Node.js 6.9.1 on Darwin 64-bit, SB 3.0.0-rc.2 [CLOSED]
✨ Done in 22.69s.
Hello,
If the CI environment is reponsible on the publishing, it should be able to provide the version in command line.
$ oao publish --version 0.1.0-rc.0
First of all thanks for your reactivity !
It would be nice to have ability to filter only the directories that have a package.json inside
Hello,
Is there an option to auto-confirm when we use reset-all-version
on a CI environment ? If not, would it be good to add a --no-confirm
option ?
thx
STR:
git clone https://github.com/mozilla-neutrino/neutrino-dev
cd neutrino-dev && git checkout 13adea32550de2f1eae9ae79f2980f8a2f6b5e82
yarn install
(this installs oao v0.8.0)yarn bootstrap
(which runs oao bootstrap
from the local node_modules
)yarn bootstrap
Expected:
The second time bootstrap is run, the duration is significantly less than the first, ideally <5-10s.
Actual:
The first bootstrap took 125 seconds (see https://emorley.pastebin.mozilla.org/9024429), the second still took 63 seconds (see https://emorley.pastebin.mozilla.org/9024430), even though it had nothing to do.
This also affects us on Travis, since it means caching the sub-package's node_modules gives little time saving (and in fact quite a disadvantage, given travis-ci/travis-ci#7898) - see neutrinojs/neutrino#248.
Do you have any ideas as to what might be causing this?
Many thanks!
Hello folks! I started using oao
and enjoying it so far.
A minor thing is that I don't see the Node ...
thing in the console output:
2017-07-12T10:01:01.759Z storyboard INFO ┌── ROOT STORY: null, SB 3.1.1 [CREATED]
The only thing that I have to add here is that I am using nvm
for managing the Node version.
Thanks for your work on oao
!
Hello,
For the package lib-2, the "revealed end logs" line appears before the error is displayed :
> oao bootstrap -s ./packages/*/
2017-02-21T08:06:48.363Z storyboard INFO ┌── ROOT STORY: Node.js 7.5.0 on Win32 64-bit, SB 3.0.0 [CREATED]
2017-02-21T08:06:48.364Z storyboard INFO Log filter: *:DEBUG
2017-02-21T08:06:48.549Z main INFO Reading all package.json files...
2017-02-21T08:06:48.551Z main INFO PASS 1: processing @bamaa/lib-1...
2017-02-21T08:06:48.552Z main INFO - Registering...
2017-02-21T08:06:48.924Z main INFO - Installing external dependencies...
2017-02-21T08:06:49.320Z main INFO PASS 1: processing @bamaa/lib-2...
2017-02-21T08:06:49.321Z main INFO - Registering...
2017-02-21T08:06:49.681Z main INFO - Installing external dependencies...
2017-02-21T08:06:50.176Z storyboard WARN ┌── REVEALED PAST LOGS BEGIN HERE (due to warning/error)
2017-02-21T08:06:49.682Z main TRACE ┌── Run cmd yarn install at ./packages/lib-2/ [CREATED]
2017-02-21T08:06:49.970Z yarn INFO | yarn install v0.20.3
2017-02-21T08:06:50.040Z yarn INFO | [1/4] Resolving packages...
2017-02-21T08:06:50.141Z yarn INFO | [2/4] Fetching packages...
2017-02-21T08:06:50.175Z yarn INFO | [3/4] Linking dependencies...
2017-02-21T08:06:50.178Z storyboard WARN └── REVEALED PAST LOGS END HERE
2017-02-21T08:06:50.176Z yarn ERROR | warning "[email protected]" has unmet peer dependency "@angular/core@^2.0.0".
2017-02-21T08:06:50.178Z yarn ERROR | warning "[email protected]" has unmet peer dependency "@angular/http@^2.0.0".
2017-02-21T08:06:50.288Z yarn INFO | [4/4] Building fresh packages...
2017-02-21T08:06:50.297Z yarn INFO | Done in 0.34s.
2017-02-21T08:06:50.315Z yarn INFO |
2017-02-21T08:06:50.317Z main TRACE └── Run cmd yarn install at ./packages/lib-2/ [CLOSED]
2017-02-21T08:06:50.318Z main INFO PASS 1: processing @bamaa/lib-3...
2017-02-21T08:06:50.318Z main INFO - Registering...
2017-02-21T08:06:50.680Z main INFO - Installing external dependencies...
2017-02-21T08:06:51.061Z main INFO PASS 2: installing internal deps for @bamaa/lib-1...
2017-02-21T08:06:51.061Z main INFO PASS 2: installing internal deps for @bamaa/lib-2...
2017-02-21T08:06:51.062Z main INFO PASS 2: installing internal deps for @bamaa/lib-3...
2017-02-21T08:06:51.062Z main INFO - Linking to @bamaa/lib-1...
2017-02-21T08:06:51.425Z main INFO - Linking to @bamaa/lib-2...
2017-02-21T08:06:51.803Z storyboard INFO └── ROOT STORY: Node.js 7.5.0 on Win32 64-bit, SB 3.0.0 [CLOSED]
Hello,
would you be interested by a pull-request for mercurial support ?
STR:
Expected:
The Travis run passes.
Actual:
The Travis run fails with errors like:
2017-10-10T16:16:07.815Z storyboard WARN ┌── REVEALED PAST LOGS BEGIN HERE (due to warning/error)
2017-10-10T16:16:02.162Z main TRACE ┌── Run cmd yarn install --frozen-lockfile at packages/neutrino-middleware-clean [CREATED]
2017-10-10T16:16:03.870Z yarn INFO | yarn install v0.28.4
2017-10-10T16:16:05.368Z yarn INFO | [1/4] Resolving packages...
2017-10-10T16:16:05.719Z yarn INFO | [2/4] Fetching packages...
2017-10-10T16:16:07.816Z storyboard WARN └── REVEALED PAST LOGS END HERE
2017-10-10T16:16:07.815Z yarn ERROR | error An unexpected error occurred: "https://registry.yarnpkg.com/deepmerge/-/deepmerge-1.5.2.tgz: ENOENT: no such file or directory, open '/home/travis/.cache/yarn/v1/npm-deepmerge-1.5.2-10499d868844cdad4fee0842df8c7f6f0c95a753/.yarn-tarball.tgz'".
Examples:
This was using yarn 0.28.4 and oao 0.10.3.
Other observations:
I believe this is due to yarnpkg/yarn#2629 - the summary of which is:
--mutex
option for locking (like lerna does after lerna/lerna#764)As such I think oao needs to either:
--mutex
to avoid the concurrency issues. (I'm presuming this will slow things down slightly, but presumably not as much as disabling parallel mode entirely)What is the best way to run a script in a sub-package from the root-package?
Sub-package /packages/app/package.json
:
"scripts": {
"start": "neutrino start"
}
Root-package /package.json
:
"scripts": {
"start": "oao app start"
}
Obviously, that doesn't work. But is there something like that I'm not aware of?
Hello,
I would like to use oao during my build inside a docker image but I have an issue during the bootstrap :
16:36:59.680 $ oao bootstrap -s ./packages/*/
16:36:59.985 2017-02-22T15:36:59.974Z storyboard INFO ??? ROOT STORY: Node.js 7.5.0 on Linux 64-bit, SB 3.0.0 [CREATED]
16:36:59.986 2017-02-22T15:36:59.975Z storyboard INFO Log filter: *:DEBUG
16:37:00.174 2017-02-22T15:37:00.173Z storyboard INFO ??? ROOT STORY: Node.js 7.5.0 on Linux 64-bit, SB 3.0.0 [CLOSED]
16:37:00.174 /home/app/node_modules/oao/lib/index.js:60
16:37:00.174 return (0, _bootstrap2.default)(cmd.opts());
16:37:00.174 ^
16:37:00.174
16:37:00.174 TypeError: cmd.opts is not a function
16:37:00.174 at Command.<anonymous> (/home/app/node_modules/oao/lib/index.js:60:39)
16:37:00.174 at Command.listener (/home/app/node_modules/commander/index.js:301:8)
16:37:00.174 at emitTwo (events.js:106:13)
16:37:00.175 at Command.emit (events.js:192:7)
16:37:00.175 at Command.parseArgs (/home/app/node_modules/commander/index.js:615:12)
16:37:00.175 at Command.parse (/home/app/node_modules/commander/index.js:458:21)
16:37:00.175 at Object.<anonymous> (/home/app/node_modules/oao/lib/index.js:98:21)
16:37:00.175 at Module._compile (module.js:571:32)
16:37:00.175 at Object.Module._extensions..js (module.js:580:10)
16:37:00.175 at Module.load (module.js:488:32)
16:37:00.181 error Command failed with exit code 1.
16:37:00.181 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
16:37:00.186 ERROR: "bootstrap" exited with 1.
16:37:00.192 error Command failed with exit code 1.
My docker-compose.yml :
version: '2'
services:
js-build:
container_name: js-build
image: node:7.5.0
command: npm install yarn -g --progress=false && npm install && yarn build"
working_dir: /home/app
volumes:
- .:/home/app
You can run it using the command :
docker-compose run js-build
Logger produces a lot of empty lines in Terminal/iTerm.
I have tested mot popular terminals and it works correctly in Hyper:
yarn run v0.20.3
$ oao all "yarn run build" --parallel
2017-02-23T09:01:53.343Z storyboard INFO ┌── ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0 [CREATED]
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
1 ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
1 ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
2 Run cmd yarn run build at packages/app
<a lot of empty lines>
1 ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
2 Run cmd yarn run build at packages/app
<a lot of empty lines>
3 Run cmd yarn run build at packages/app-config
<a lot of empty lines>
1 ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
2 Run cmd yarn run build at packages/app
<a lot of empty lines>
3 Run cmd yarn run build at packages/app-config
<a lot of empty lines>
4 Run cmd yarn run build at packages/app-di
<a lot of empty lines>
1 ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
2 Run cmd yarn run build at packages/app
<a lot of empty lines>
3 Run cmd yarn run build at packages/app-config
<a lot of empty lines>
4 Run cmd yarn run build at packages/app-di
<a lot of empty lines>
5 Run cmd yarn run build at packages/app-registry
<a lot of empty lines>
1 ROOT STORY: Node.js 7.5.0 on Darwin 64-bit, SB 3.0.0
2017-02-23T09:01:53.344Z storyboard INFO Log filter: *:DEBUG
<a lot of empty lines>
2 Run cmd yarn run build at packages/app
<ok>
2017-02-23T09:01:55.124Z yarn INFO Done in 1.35s.
2017-02-23T09:01:55.142Z yarn INFO
3 Run cmd yarn run build at packages/app-config
<ok>
2017-02-23T09:01:54.597Z yarn INFO Done in 0.80s.
2017-02-23T09:01:54.618Z yarn INFO
5 Run cmd yarn run build at packages/app-registry
<ok>
2017-02-23T09:01:54.853Z yarn INFO Done in 1.05s.
✨ Done in 2.23s.
NOTE: extracted issue from #13
Hello,
Sometimes, in a monorepo, it could be good to change the version of a library in all packages. For example, if packages uses Angular or React, we would like to be sure that all packages are sharing the same version.
I think there are different ways of doing :
$ oao set-version @angular 4.0.0 --> all dependencies of this scope are updated
$ oao set-version @angular/core,@angular/http 4.0.0 --> only core and http are updated
In my case it is what I am doing, I don't like my solution :
BEFORE
package.json
:
{
"name": "root",
"version":"0.1.0"
"peerDependenciesPlaceholders": {
"0.0.0-ANGULAR_VERSION_PLACEHOLDER": "^4.0.0-rc.1"
}
}
packages/lib1/package.json
:
{
"name": "lib-1",
"version":"0.1.0",
"peerDependencies": {
"@angular/core": "0.0.0-ANGULAR_VERSION_PLACEHOLDER",
}
}
RUN INTERNAL SCRIPT
I run internal script that replaces placeholders on all packages corresponding to the placeholders found in peerDependenciesPlaceholders
of the root package.json
AFTER
packages/lib1/package.json
:
{
"name": "lib-1",
"version":"0.1.0",
"peerDependencies": {
"@angular/core": "^4.0.0-rc.1"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.