Skip to content
This repository was archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
merge: remote-tracking branch 'origin/master' into fix-1715
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Jun 2, 2018
2 parents 0cbad58 + 6536d1f commit 976faa7
Show file tree
Hide file tree
Showing 35 changed files with 2,064 additions and 1,415 deletions.
19 changes: 5 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"parser": "babel-eslint",
"extends": [
"airbnb",
"prettier",
"prettier/flowtype"
],
"extends": ["airbnb", "prettier", "prettier/flowtype"],
"globals": {
"__SERVER__": true
},
Expand All @@ -14,14 +10,7 @@
"prettier"
],
"rules": {
"semi": 0,
"quotes": 0,
"comma-dangle": 0,
"curly": [
2,
"multi-line"
],
"arrow-parens": 0,
"curly": [2, "multi-line"],
"class-methods-use-this": 0,
"symbol-description": 0,
"no-unused-vars": [
Expand All @@ -37,6 +26,7 @@
"react/jsx-filename-extension": 0,
"react/prefer-stateless-function": 0,
"react/no-multi-comp": 0,
"react/require-default-props": 0,
"flowtype-errors/show-errors": 2,
"no-prototype-builtins": 0,
"no-duplicate-imports": 0,
Expand All @@ -63,7 +53,8 @@
"ForOfStatement",
"LabeledStatement",
"WithStatement"
]
],
"no-return-assign": 0
},
"env": {
"jest": true,
Expand Down
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@
[options]
suppress_comment=.*\\$FlowFixMe
suppress_comment=.*\\$FlowInvalidInputTest
unsafe.enable_getters_and_setters=true
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ addons:
packages:
- libnss3
- google-chrome-beta
branches:
only: master
env:
global:
- GOOGLE_CHROME_BINARY="/usr/bin/google-chrome-beta"
Expand All @@ -16,13 +18,15 @@ node_js:
script:
- node --version
- yarn --version
- yarn run build
- yarn build
- yarn test
# Tests have to run before Danger runs because
# danger-plugin-jest references the test output
- yarn run test
- yarn run danger
- yarn run flow
- yarn run lint && yarn run typescript && yarn run tslint
# - yarn danger
- yarn flow
- yarn lint
- yarn typescript
- yarn tslint
notifications:
email:
on_failure: change
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ _The format is based on [Keep a Changelog](http://keepachangelog.com/) and this

## Unreleased

- n/a
* Upgrade flow-bin to latest, by @halvves (see #1748)

* Update various CI bits, by @probablyup (see #1769)

* Reimplement SSR stream handling as a transform stream rather than a second-order readable stream, by @probablyup (see #1768)

* Allow React Component as attr, by @valerybugakov (see #1751)

## [v3.3.0] - 2018-05-25

Expand Down
14 changes: 8 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
version: "{build}"
branches:
only:
- master
skip_tags: true
build: off
clone_depth: 1
Expand All @@ -7,19 +10,18 @@ matrix:
fast_finish: true
environment:
matrix:
- nodejs_version: 7
- nodejs_version: 6
- nodejs_version: 8
init:
- git config --global core.autocrlf input
install:
- ps: Install-Product node $env:nodejs_version x64
- ps: 'Install-Product node $env:nodejs_version x64'
- set CI=true
- yarn
cache:
- '%LOCALAPPDATA%/Yarn'
test_script:
- node --version
- yarn --version
- yarn run build
- yarn run flow
- yarn run lint && npm run test
- yarn build
- yarn flow
- yarn test
65 changes: 45 additions & 20 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,74 @@ import jest from 'danger-plugin-jest'

jest()

const jsModifiedFiles = danger.git.modified_files.filter(path => path.startsWith('src') && path.endsWith('js'))
const vendorModifiedFiles = danger.git.modified_files.filter(path => path.startsWith('src/vendor') && path.endsWith('js'))
const jsModifiedFiles = danger.git.modified_files.filter(
path => path.startsWith('src') && path.endsWith('js')
)
const vendorModifiedFiles = danger.git.modified_files.filter(
path => path.startsWith('src/vendor') && path.endsWith('js')
)

const hasAppChanges = jsModifiedFiles.filter(filepath => !filepath.endsWith('test.js')).length > 0
const jsTestChanges = jsModifiedFiles.filter(filepath => filepath.endsWith('test.js'))
const hasAppChanges =
jsModifiedFiles.filter(filepath => !filepath.endsWith('test.js')).length > 0
const jsTestChanges = jsModifiedFiles.filter(filepath =>
filepath.endsWith('test.js')
)
const hasTestChanges = jsTestChanges.length > 0

// Congrats, version bump up!
danger.git.diffForFile('package.json').then(packageDiff => {
if (
packageDiff && packageDiff.version && packageDiff.version.before && packageDiff.version.after
packageDiff &&
packageDiff.version &&
packageDiff.version.before &&
packageDiff.version.after
) {
if (semver.lt(packageDiff.version.before, packageDiff.version.after)) {
message(':tada: Version BUMP UP!')
}
}
})

// Warn when there is a big PR
const bigPRThreshold = 500
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
warn(':exclamation: Big PR')
}

// Fail if there are app changes without a CHANGELOG
if (!danger.git.modified_files.includes('CHANGELOG.md') && hasAppChanges) {
const changelogLink = 'https://github.com/styled-components/styled-components/blob/master/CHANGELOG.md'
fail(`Please include a CHANGELOG entry. You can find it at <a href='${changelogLink}'>CHANGELOG.md</a>`)
const changelogLink =
'https://github.com/styled-components/styled-components/blob/master/CHANGELOG.md'
fail(
`Please include a CHANGELOG entry. You can find it at <a href='${changelogLink}'>CHANGELOG.md</a>`
)
}

// Warn if there are library changes, but not tests (excluding vendor)
const libraryOnlyFiles = jsModifiedFiles.filter(file => !vendorModifiedFiles.includes(file))
const libraryOnlyFiles = jsModifiedFiles.filter(
file => !vendorModifiedFiles.includes(file)
)
if (libraryOnlyFiles.length > 0 && !hasTestChanges) {
warn("There are library changes, but not tests. That's OK as long as you're refactoring existing code")
warn(
"There are library changes, but not tests. That's OK as long as you're refactoring existing code"
)
}

// Warn if StyledComponent.js was edited but not StyledNativeComponent.js or viceversa
const hasStyledChanges = danger.git.modified_files.find(path => path.endsWith('StyledComponent.js')) !== null
const hasNativeStyledChanges = danger.git.modified_files.find(path => path.endsWith('StyledNativeComponent.js')) !== null
const hasStyledChanges =
danger.git.modified_files.find(path =>
path.endsWith('StyledComponent.js')
) !== null
const hasNativeStyledChanges =
danger.git.modified_files.find(path =>
path.endsWith('StyledNativeComponent.js')
) !== null
if (hasStyledChanges && !hasNativeStyledChanges) {
warn("A change was made in StyledComponent.js that wasn't made in StyledNativeComponent.js or viceversa.")
warn(
"A change was made in StyledComponent.js that wasn't made in StyledNativeComponent.js or viceversa."
)
}

// Changes to these files may need SemVer bumps
const semverBumpFiles = ['ThemeProvider.js', 'StyledComponent.js', 'StyledNativeComponent.js']
const semverBumpFiles = [
'ThemeProvider.js',
'StyledComponent.js',
'StyledNativeComponent.js',
]
semverBumpFiles.forEach(file => {
if (jsModifiedFiles.includes(file)) {
warn('Changes to #{file} might be SemVer major changes.')
Expand All @@ -61,5 +84,7 @@ semverBumpFiles.forEach(file => {
// Be careful of leaving testing shortcuts in the codebase
jsTestChanges.forEach(file => {
const content = fs.readFileSync(file).toString()
if (content.includes('it.only') || content.includes('describe.only')) { fail(`an \`only\` was left in tests (${file})`) }
if (content.includes('it.only') || content.includes('describe.only')) {
fail(`an \`only\` was left in tests (${file})`)
}
})
Loading

0 comments on commit 976faa7

Please sign in to comment.