-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
feat(chore): add project tools and utilities #270
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7e4dd3d
misc(add commitlinting): adds commit linting to the cli
evenstensberg a400809
misc(add eslint ignore items): adds build folder and commit linter to…
evenstensberg db243b6
chore(add new items to chore): adds chore command
evenstensberg 6dc12af
chore(linting): lint added files
evenstensberg 7adfdcf
chore(remove cmd): removes f command
evenstensberg 6cc31ce
chore(revise cmd): changelog is now CHANGELOG
evenstensberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | ||
* applicable law or agreed to in writing, software distributed under the | ||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
*/ | ||
// Based on https://github.com/GoogleChrome/lighthouse/blob/master/.cz-config.js | ||
|
||
'use strict'; | ||
|
||
module.exports = { | ||
allowBreakingChanges: ['ast'], | ||
allowCustomScopes: true, | ||
scopes: [], | ||
types: [ | ||
{value: 'new_feature', name: 'new_feature: A new feature'}, { | ||
value: 'ast', | ||
name: 'ast: init, migrate, add, etc' | ||
}, | ||
{value: 'tests', name: 'tests: Tests, jest, binTestCases etc'}, | ||
{value: 'docs', name: 'docs: Documentation'}, | ||
{value: 'deps', name: 'deps: Dependency bumps only'}, | ||
{value: 'cli', name: 'cli: core CLI things'}, | ||
{value: 'misc', name: 'misc: Other formats like tweaks and such'}, | ||
{value: 'chore', name: 'chore: Updating docs, linting etc'}, | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
**/__testfixtures__/* | ||
coverage | ||
test | ||
docs | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ jsdoc.json | |
.appveyor.yml | ||
.codecov.yml | ||
*.snap | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
* Based on: https://github.com/GoogleChrome/lighthouse/blob/master/build/changelog-generator/ | ||
*/ | ||
"use strict"; | ||
const readFileSync = require("fs").readFileSync; | ||
const resolve = require("path").resolve; | ||
const mainTemplate = readFileSync( | ||
resolve(__dirname, "templates/template.hbs") | ||
).toString(); | ||
const headerPartial = readFileSync( | ||
resolve(__dirname, "templates/header.hbs") | ||
).toString(); | ||
const commitPartial = readFileSync( | ||
resolve(__dirname, "templates/commit.hbs") | ||
).toString(); | ||
|
||
const pullRequestRegex = /\(#(\d+)\)$/; | ||
const parserOpts = { | ||
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/, | ||
headerCorrespondence: ["type", "scope", "message"] | ||
}; | ||
|
||
process.stderr.write(` | ||
> Be sure to have the latest git tags locally: | ||
git fetch --tags | ||
|
||
`); | ||
|
||
const writerOpts = { | ||
mainTemplate, | ||
headerPartial, | ||
commitPartial, | ||
transform: commit => { | ||
if (typeof commit.hash === "string") { | ||
commit.hash = commit.hash.substring(0, 7); | ||
} | ||
|
||
if (commit.type === "test") { | ||
commit.type = "tests"; | ||
} else if (commit.type === "cli") { | ||
commit.type = "CLI"; | ||
} else if (commit.type === "new_feature") { | ||
commit.type = "New Features"; | ||
} | ||
|
||
if (commit.type) { | ||
commit.type = commit.type.replace(/_/g, " "); | ||
commit.type = | ||
commit.type.substring(0, 1).toUpperCase() + commit.type.substring(1); | ||
} else { | ||
commit.type = "Misc"; | ||
} | ||
|
||
let pullRequestMatch = commit.header.match(pullRequestRegex); | ||
// if header does not provide a PR we try the message | ||
if (!pullRequestMatch && commit.message) { | ||
pullRequestMatch = commit.message.match(pullRequestRegex); | ||
} | ||
|
||
if (pullRequestMatch) { | ||
commit.header = commit.header.replace(pullRequestMatch[0], "").trim(); | ||
if (commit.message) { | ||
commit.message = commit.message.replace(pullRequestMatch[0], "").trim(); | ||
} | ||
|
||
commit.PR = pullRequestMatch[1]; | ||
} | ||
|
||
return commit; | ||
}, | ||
groupBy: "type", | ||
commitGroupsSort: (a, b) => { | ||
// put new feature on the top | ||
if (a.title === "New Features") { | ||
return -1; | ||
} | ||
if (b.title === "New Features") { | ||
return 1; | ||
} | ||
|
||
// put misc on the bottom | ||
if (a.title === "Misc") { | ||
return 1; | ||
} | ||
if (b.title === "Misc") { | ||
return -1; | ||
} | ||
|
||
return a.title.localeCompare(b.title); | ||
}, | ||
commitsSort: ["type", "scope"] | ||
}; | ||
|
||
module.exports = { | ||
writerOpts, | ||
parserOpts | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{{!-- | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
From: https://github.com/GoogleChrome/lighthouse/blob/master/build/changelog-generator/ | ||
--}} | ||
* {{#if scope}}{{scope}}: {{/if~}} | ||
{{#if message ~}} | ||
{{~message~}} | ||
{{~else~}} | ||
{{~header~}} | ||
{{~/if ~}} | ||
{{~!-- PR number/commit hash --}} | ||
{{~#if @root.linkReferences~}} | ||
{{~#if PR}} ([#{{PR}}]( | ||
{{~#if @root.host}}{{~@root.host}}/{{/if~}} | ||
{{~#if @root.owner ~}}{{@root.owner}}/{{/if~}} | ||
{{~@root.repository}}/pull/{{PR}})) | ||
{{~else}} ([{{hash}}]( | ||
{{~#if @root.host}}{{~@root.host}}/{{/if~}} | ||
{{~#if @root.owner ~}}{{@root.owner}}/{{/if~}} | ||
{{~@root.repository}}/{{@root.commit}}/{{hash}})) | ||
{{~/if~}} | ||
{{~else~}} | ||
{{~hash~}} | ||
{{~/if~}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{!-- | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
From: https://github.com/GoogleChrome/lighthouse/blob/master/build/changelog-generator/ | ||
--}} | ||
<a name="{{version}}"></a> | ||
# {{version}} ({{date}}) | ||
{{#if @root.linkCompare~}} | ||
[Full Changelog]({{~@root.repoUrl}}/compare/{{previousTag}}...{{currentTag}}) | ||
{{~/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{!-- | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
From: https://github.com/GoogleChrome/lighthouse/blob/master/build/changelog-generator/ | ||
--}} | ||
{{> header}} | ||
|
||
{{#each commitGroups}} | ||
|
||
{{#if title~}} | ||
## {{title}} | ||
|
||
{{/if}} | ||
{{#each commits}} | ||
{{~> commit root=@root}} | ||
|
||
{{/each}} | ||
{{/each}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
// Config from https://github.com/GoogleChrome/lighthouse/blob/master/commitlint.config.js | ||
"use strict"; | ||
|
||
module.exports = { | ||
extends: ["cz"], | ||
rules: { | ||
"body-leading-blank": [1, "always"], | ||
"body-tense": [1, "always", ["present-imperative"]], | ||
"footer-leading-blank": [1, "always"], | ||
"footer-tense": [1, "always", ["present-imperative"]], | ||
"header-max-length": [2, "always", 80], | ||
lang: [0, "always", "eng"], | ||
"scope-case": [2, "always", "lowerCase"], | ||
"scope-empty": [0, "never"], | ||
"subject-case": [1, "always", "lowerCase"], | ||
"subject-empty": [0, "never"], | ||
"subject-full-stop": [2, "never", "."], | ||
"subject-tense": [1, "always", ["present-imperative"]], | ||
"type-case": [2, "always", "lowerCase"], | ||
"type-empty": [2, "never"] | ||
// The scope-enum : defined in the cz-config | ||
// The 'type-enum': defined in the cz-config | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this needed? Shouldn't
yarn bundlesize
already call the bin file?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.
another question: are we adding bundlesize so users can use it?
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.
It's for CI's for now, we could add it to as a feature to webpack, but that needs some work