-
Notifications
You must be signed in to change notification settings - Fork 214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR! The Travis end-to-end times are actually quicker than master
, even with the added overhead (though guess since smaller matrix). Definitely a better tradeoff IMO.
package.json
Outdated
"validate:eslintrc:root": "eslint --no-eslintrc --print-config . -c ./.eslintrc.js > /dev/null", | ||
"validate:eslintrc:eslint": "eslint --no-eslintrc --print-config . -c ./packages/eslint/eslintrc.js > /dev/null", | ||
"validate:eslintrc:airbnb": "eslint --no-eslintrc --print-config . -c ./packages/airbnb/eslintrc.js > /dev/null", | ||
"validate:eslintrc:airbnb-base": "eslint --no-eslintrc --print-config . -c ./packages/airbnb-base/eslintrc.js > /dev/null", | ||
"validate:eslintrc:standardjs": "eslint --no-eslintrc --print-config . -c ./packages/standardjs/eslintrc.js > /dev/null", | ||
"validate:eslintrc": "yarn validate:eslintrc:eslint && yarn validate:eslintrc:airbnb-base && yarn validate:eslintrc:airbnb && yarn validate:eslintrc:standardjs && yarn validate:eslintrc:root", | ||
"version": "yarn changelog --package && git add CHANGELOG.md" | ||
"version": "([[ -n \"$NEUTRINO_RELEASE\" ]] && yarn changelog --package && git add CHANGELOG.md) || exit 0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bash 4 and above has a new -v
conditional for "is this variable set" that doesn't need the dollar sign or quotes - that could make this easier to read. Also the current || exit 0
will hide any real errors that occur during the changelog command.
Something like this should work? (Rather than using [[ ! -v NEUTRINO_RELEASE ]]
, I've inverted the conditional name/purpose to avoid the negation)
"version": "[[ -v SKIP_CHANGELOG ]] || yarn changelog --package && git add CHANGELOG.md"
...or using test
(I can't decide which looks cleaner):
"version": "test -v SKIP_CHANGELOG || yarn changelog --package && git add CHANGELOG.md"
package.json
Outdated
"release:preview": "yarn build && lerna publish --force-publish=* --skip-git --skip-npm", | ||
"test": "yarn test:all --no-verbose --match '!*@neutrinojs*'", | ||
"test:all": "nyc --reporter lcov ava --verbose --fail-fast packages/*/test", | ||
"test": "ava --fail-fast packages/*/test '!packages/create-project/test'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The !packages/create-project/test
doesn't seem to work for me locally (the create project test still tries to run), however it might just be a Windows-only issue. (Happy to ignore so long as it works for you / on Travis)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's because it should be double-quoted?
scripts/test-create-project-ci.sh
Outdated
yarn verdaccio --config verdaccio.yml & sleep 10; | ||
yarn config set registry "http://localhost:4873"; | ||
npm config set registry "http://localhost:4873"; | ||
scripts/npm-adduser.js; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's possible to use anonymous publish mode to avoid the need for the npm-adduser.js
step and the npm
dependency?
https://www.verdaccio.org/docs/en/authentification.html#anonymous-publish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooooooo lemme try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I remember trying this but was unable to get it to work in the past. I'll try it again.
scripts/test-create-project-ci.sh
Outdated
--skip-npm \ | ||
--registry http://localhost:4873/ \ | ||
--yes \ | ||
--repo-version $(node_modules/.bin/semver -i patch $(npm view neutrino version)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use --cd-version
here to avoid the external request and dep on semver
?
https://github.com/lerna/lerna#--cd-version
If not, perhaps let's use yarn for the version lookup instead of npm (yarn info neutrino version
).
scripts/test-create-project-ci.sh
Outdated
--registry http://localhost:4873/ \ | ||
--yes \ | ||
--repo-version $(node_modules/.bin/semver -i patch $(npm view neutrino version)); | ||
yarn lerna exec npm publish --registry http://localhost:4873/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we try using yarn instead of npm here?
|
||
test.serial(preset, async t => { | ||
if (tester) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only 3 lines different between the true and false case here - what do you think about flattening this conditional and inlining them, to reduce duplication/potential for deviation and clarify what's different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
scripts/test-create-project-ci.sh
Outdated
--yes \ | ||
--repo-version $(node_modules/.bin/semver -i patch $(npm view neutrino version)); | ||
yarn lerna exec npm publish --registry http://localhost:4873/; | ||
yarn test:create-project; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing newline
@@ -0,0 +1,15 @@ | |||
#! /usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change this to (whitespace and "strict mode"):
#!/usr/bin/env bash
set -euo pipefail
Also, the ;
at the end of each line isn't needed (it's only required when skipping the newline between multiple commands).
Btw a handy tool for bash scripts linting is:
https://github.com/koalaman/shellcheck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, lost this in one my my resets.
package.json
Outdated
"link:all": "lerna exec yarn link", | ||
"lint": "node packages/neutrino/bin/neutrino lint", | ||
"precommit": "lint-staged", | ||
"random": "node -e \"process.stdout.write(require('crypto').randomBytes(8).toString('hex'))\"", | ||
"release": "yarn build && lerna publish --force-publish=*", | ||
"release": "yarn build && NEUTRINO_RELEASE=true lerna publish --force-publish=*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pre-existing yarn build
doesn't actually do anything as far as I can tell? Should we remove it (either now or at another time)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
import { packages } from '../commands/init/utils' | ||
|
||
if (process.env.NODE_ENV !== 'test') { | ||
process.env.NODE_ENV = 'test'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this isn't needed since Neutrino sets NODE_ENV
appropriately anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used it to drive stdio
, but it was no longer used:
Alright, let's see what happens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The quoting change for yarn test
fixed the issue for me btw :-)
package.json
Outdated
"changelog": "auto-changelog --remote upstream --commit-limit false", | ||
"link:all": "lerna exec yarn link", | ||
"lint": "node packages/neutrino/bin/neutrino lint", | ||
"precommit": "lint-staged", | ||
"random": "node -e \"process.stdout.write(require('crypto').randomBytes(8).toString('hex'))\"", | ||
"release": "yarn build && NEUTRINO_RELEASE=true lerna publish --force-publish=*", | ||
"release": "SKIP_CHANGELOG=true lerna publish --force-publish=*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SKIP_CHANGELOG
needs to be moved to test:create-project
now
"test:all": "nyc --reporter lcov ava --verbose --fail-fast packages/*/test", | ||
"release": "lerna publish --force-publish=*", | ||
"release:preview": "lerna publish --force-publish=* --skip-git --skip-npm", | ||
"test": "ava --fail-fast packages/*/test \"!packages/create-project/test\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document yarn test
(and possibly yarn test:create-project
, depending on how well it works locally) in development.md
? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
scripts/test-create-project-ci.sh
Outdated
export SKIP_CHANGELOG=true | ||
export YARN_AUTH_TOKEN="//localhost:4873/:_authToken=token" | ||
|
||
yarn verdaccio --config verdaccio.yml & sleep 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way to ensure verdaccio has started, but save spending the full 10 seconds if it was faster, would be to do:
yarn verdaccio --config verdaccio.yml &
yarn config set registry "http://localhost:4873"
# Wait until Verdaccio has started and is accepting connections.
while ! nc -zw 1 localhost 4873; do sleep 1; done
(The wait line deliberately being after the yarn config set
, since it gives a few more seconds for verdaccio to start, whilst also making use of the time, before sitting around idle)
scripts/test-create-project-ci.sh
Outdated
|
||
yarn verdaccio --config verdaccio.yml & sleep 10 | ||
yarn config set registry "http://localhost:4873" | ||
npm config set registry "http://localhost:4873" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The npm config
line is no longer needed I think?
Fixes #702.