forked from atlassian/extract-react-types
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make this repository a mono-repo with all the related projects in here (
atlassian#40) Moved the following package in this repository: 1. kind2string 2. pretty-proptypes 3. extract-react-types-loader 4. extract-react-types using bolt(http://boltpkg.com/) to manage the mono-repo.
- Loading branch information
1 parent
c35845f
commit 0f9879b
Showing
63 changed files
with
5,980 additions
and
1,036 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@atlaskit/build-releases`, a build tool that works with `bolt` to help you release components from a mono-repository. You can find the full documentation for it [here](https://www.npmjs.com/package/@atlaskit/build-releases) | ||
|
||
To help you get started though, here are some things you should know about this folder: | ||
|
||
## Changesets are automatically generated | ||
|
||
Changesets are generated by the `build-releases changeset` command, though it may have been given a new name within your repository. As long as you are following a changeset release flow, you shouldn't have any problems. | ||
|
||
## Each changeset is its own folder | ||
|
||
We use hashes by default for these folder names to avoid collisions when generating them, but there's no harm that will come from renaming them. | ||
|
||
## Changesets are automatically removed | ||
|
||
When `build-releases version` or equivalent command is run, all the changeset folders are removed. This is so we only ever use a changeset once. This makes this a very bad place to store any other information. | ||
|
||
## Changesets come in two parts | ||
|
||
You should treat these parts quite differently: | ||
|
||
- `changes.md` is a file you should feel free to edit as much as you want. It will be prepended to your changelog when you next run your version command. | ||
- `changes.json` is a file that includes information about releases, what should be versioned by the version command. We strongly recommend against editing this directly, as you may make a new changeset that puts your bolt repository into an invalid state. | ||
|
||
## I want to edit the information in a `changes.json` - how do I do it safely? | ||
|
||
The best option is to make a new changeset using the changeset command, copy over the `changes.md`, then delete the old changeset. | ||
|
||
## Can I rename the folder for my changeset? | ||
|
||
Absolutely! We need unique hashes to make changesets play nicely with git, but changing your folder from our hash to your own name isn't going to cause any problems. | ||
|
||
## Can I manually delete changesets? | ||
|
||
You can, but you should be aware this will remove the intent to release communicated by the changeset, and should be done with caution. |
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,82 @@ | ||
/* | ||
Hey, welcome to the changeset config! This file has been generated | ||
for you with the default configs we use, and some comments around | ||
what options mean, so that it's easy to customise your workflow. | ||
You should update this as you need to craft your workflow. | ||
Config provided by a CI command takes precedence over the contents of this file. | ||
If a config option isn't present here, we will fall back to the defaults. | ||
*/ | ||
|
||
const changesetOptions = { | ||
// If true, we will automatically commit the changeset when the command is run | ||
commit: false, | ||
}; | ||
|
||
// This function takes information about a changeset to generate an entry for it in your | ||
// changelog. We provide the full changeset object as well as the version. | ||
// It may be a good idea to replace the commit hash with a link to the commit. | ||
|
||
/* the default shape is: | ||
- [patch] ABCDEFG: | ||
A summary message you wrote, indented | ||
*/ | ||
|
||
const getReleaseLine = async (changeset, versionType) => { | ||
const indentedSummary = changeset.summary | ||
.split('\n') | ||
.map(l => ` ${l}`.trimRight()) | ||
.join('\n'); | ||
|
||
return `- [${versionType}] ${changeset.commit}:\n\n${indentedSummary}`; | ||
}; | ||
|
||
// This function takes information about what dependencies we are updating in the package. | ||
// It provides an array of related changesets, as well as the dependencies updated. | ||
|
||
/* | ||
- Updated dependencies: [ABCDEFG]: | ||
- Updated dependencies: [HIJKLMN]: | ||
- [email protected] | ||
- [email protected] | ||
*/ | ||
const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => { | ||
if (dependenciesUpdated.length === 0) return ''; | ||
|
||
const changesetLinks = changesets.map( | ||
changeset => `- Updated dependencies [${changeset.commit}]:`, | ||
); | ||
|
||
const updatedDepenenciesList = dependenciesUpdated.map( | ||
dependency => ` - ${dependency.name}@${dependency.version}`, | ||
); | ||
|
||
return [...changesetLinks, ...updatedDepenenciesList].join('\n'); | ||
}; | ||
|
||
const versionOptions = { | ||
// If true, we will automatically commit the version updating when the command is run | ||
commit: false, | ||
// Adds a skipCI flag to the commit - only valid if `commit` is also true. | ||
skipCI: false, | ||
// Do not modify the `changelog.md` files for packages that are updated | ||
noChangelog: false, | ||
// A function that returns a string. It takes in options about a change. This allows you to customise your changelog entries | ||
getReleaseLine, | ||
// A function that returns a string. It takes in options about when a pacakge is updated because | ||
getDependencyReleaseLine, | ||
}; | ||
|
||
const publishOptions = { | ||
// This sets whether unpublished packages are public by default. We err on the side of caution here. | ||
public: false, | ||
}; | ||
|
||
module.exports = { | ||
versionOptions, | ||
changesetOptions, | ||
publishOptions, | ||
}; |
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,5 @@ | ||
[ignore] | ||
.*/packages/kind2string/.* | ||
|
||
[include] | ||
|
||
|
@@ -7,3 +8,4 @@ | |
[lints] | ||
|
||
[options] | ||
emoji=true |
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,3 +1,15 @@ | ||
node_modules | ||
|
||
**/dist | ||
|
||
# ignore all logs | ||
*.log | ||
.vscode | ||
|
||
# ignore editor generated files | ||
.vscode | ||
.idea | ||
.iml | ||
|
||
|
||
# ignore yarn.locks generated in packages | ||
packages/**/**/yarn.lock |
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,6 @@ | ||
// @flow | ||
declare module 'babel-errors' { | ||
declare module.exports: { | ||
wrapErrorWithCodeFrame: (any, any) => any, | ||
}; | ||
} |
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,4 @@ | ||
// @flow | ||
declare module 'kind2string' { | ||
declare module.exports: any; | ||
} |
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,21 +1,16 @@ | ||
{ | ||
"name": "extract-react-types", | ||
"version": "0.15.1", | ||
"main": "index.js", | ||
"repository": "atlassian/extract-react-types", | ||
"author": "James Kyle <[email protected]>", | ||
"license": "Apache-2.0", | ||
"name": "extract-react-types-mono-repo", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"test": "jest" | ||
"changeset": "bolt build-releases changeset" | ||
}, | ||
"bolt": { | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
}, | ||
"keywords": [ | ||
"react", | ||
"flow", | ||
"typescript", | ||
"prop-types", | ||
"documentation" | ||
], | ||
"dependencies": { | ||
"@atlaskit/build-releases": "^3.0.3", | ||
"@babel/core": "7.0.0-beta.56", | ||
"@babel/types": "^7.0.0-beta.56", | ||
"ast-pretty-print": "^2.0.1", | ||
|
@@ -31,11 +26,29 @@ | |
"babel-type-scopes": "^1.1.0", | ||
"babylon": "^7.0.0-beta.22", | ||
"babylon-options": "^2.0.1", | ||
"emotion": "^9.1.1", | ||
"react-markings": "^1.2.0", | ||
"strip-indent": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "0.61.0", | ||
"jest": "^21.2.1", | ||
"prettier": "^1.13.7" | ||
"babel-cli": "^6.26.0", | ||
"babel-plugin-emotion": "^9.1.0", | ||
"babel-plugin-syntax-dynamic-import": "^6.18.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-flow": "^6.23.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"flow-bin": "^0.69.0", | ||
"jest": "^23.6.0", | ||
"jsdom": "^11.7.0", | ||
"prettier": "^1.13.7", | ||
"react": "^16.3.1", | ||
"react-addons-test-utils": "^15.6.2", | ||
"react-dom": "^16.3.1" | ||
} | ||
} |
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,27 @@ | ||
# extract-react-types-loader | ||
|
||
## 0.3.0 | ||
- [minor] [882a85c](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/882a85c): | ||
|
||
- Use version 0.15.0 of extract-react-types - the breaking change cannot be absorbed by changes in this package. | ||
|
||
## 0.2.2 | ||
- [patch] Upgrade extract-react-types to add TypeScript support. [c742e5a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c742e5a) | ||
|
||
## 0.2.1 | ||
- [patch] Remove console log [e16d2b6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e16d2b6) | ||
|
||
## 0.2.0 | ||
- [minor] Add pathFilter function to resolve atlaskit:src paths within atlaskit [c5214a3](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c5214a3) | ||
|
||
## 0.1.3 | ||
- [patch] Sanity test release, no actual change [481c086](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/481c086) | ||
|
||
## 0.1.2 | ||
- [patch] Upgrade extract-react-types version [f78d035](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/f78d035) | ||
|
||
## 0.1.1 | ||
- [patch] Makes packages Flow types compatible with version 0.67 [25daac0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/25daac0) | ||
|
||
## 0.1.0 | ||
- [minor] Npm fell behind code [9684be0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9684be0) |
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,67 @@ | ||
// @flow | ||
|
||
const path = require('path'); | ||
const extractReactTypes = require('extract-react-types'); | ||
|
||
const devProps = { | ||
classes: [ | ||
{ | ||
value: { | ||
kind: 'object', | ||
members: [ | ||
{ | ||
kind: 'property', | ||
key: { kind: 'id', name: 'Warning' }, | ||
value: { kind: 'any' }, | ||
optional: false, | ||
leadingComments: [ | ||
{ | ||
type: 'commentBlock', | ||
value: `extract-react-types is not being run in dev mode for speed reasons. If you need to | ||
see prop types add the environment variable \`FORCE_EXTRACT_REACT_TYPES\` | ||
eg: | ||
- \`FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>\` | ||
- \`FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>\``, | ||
raw: '**', | ||
}, | ||
], | ||
default: { | ||
kind: 'string', | ||
value: 'Prop types are not shown in dev mode', | ||
}, | ||
}, | ||
], | ||
referenceIdName: 'AvatarPropTypes', | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = function extractReactTypesLoader(content /* : string */) { | ||
if ( | ||
!['staging', 'production'].includes(process.env.WEBSITE_ENV) && | ||
!process.env.FORCE_EXTRACT_REACT_TYPES | ||
) { | ||
return `module.exports = ${JSON.stringify(devProps)}`; | ||
} | ||
|
||
const filename = this.resource; | ||
const ext = path.extname(filename); | ||
const typeSystem = ext === '.ts' || ext === '.tsx' ? 'typescript' : 'flow'; | ||
|
||
const resolveOpts = { | ||
pathFilter: (pkg, location, dist) => { | ||
if ( | ||
pkg['atlaskit:src'] && | ||
location.includes('node_modules') && | ||
location.includes(pkg.main) | ||
) { | ||
return location.replace(dist, pkg['atlaskit:src']); | ||
} | ||
return null; | ||
}, | ||
}; | ||
|
||
const types = extractReactTypes(content, typeSystem, filename, resolveOpts); | ||
return `module.exports = ${JSON.stringify(types)}`; | ||
}; |
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,8 @@ | ||
{ | ||
"name": "extract-react-types-loader", | ||
"version": "0.3.0", | ||
"main": "index.js", | ||
"dependencies": { | ||
"extract-react-types": "^0.15.1" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,41 @@ | ||
{ | ||
"name": "extract-react-types", | ||
"version": "0.15.1", | ||
"main": "index.js", | ||
"repository": "atlassian/extract-react-types", | ||
"author": "James Kyle <[email protected]>", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"flow", | ||
"typescript", | ||
"prop-types", | ||
"documentation" | ||
], | ||
"dependencies": { | ||
"@babel/core": "7.0.0-beta.56", | ||
"@babel/types": "^7.0.0-beta.56", | ||
"ast-pretty-print": "^2.0.1", | ||
"babel-errors": "^1.1.1", | ||
"babel-explode-module": "^3.0.0", | ||
"babel-file": "^3.0.0", | ||
"babel-file-loader": "^2.0.0", | ||
"babel-flow-identifiers": "^1.1.3", | ||
"babel-helper-simplify-module": "^2.2.1", | ||
"babel-identifiers": "^1.1.2", | ||
"babel-normalize-comments": "^1.0.1", | ||
"babel-react-components": "^1.1.0", | ||
"babel-type-scopes": "^1.1.0", | ||
"babylon": "^7.0.0-beta.22", | ||
"babylon-options": "^2.0.1", | ||
"strip-indent": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.69.0", | ||
"jest": "^23.6.0", | ||
"prettier": "^1.13.7" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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,9 @@ | ||
{ | ||
"presets": ["env", "flow"], | ||
"plugins": [ | ||
"transform-object-rest-spread", | ||
"transform-runtime", | ||
"syntax-dynamic-import" | ||
], | ||
"ignore": ["node_modules"] | ||
} |
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,12 @@ | ||
# pretty-proptypes | ||
|
||
## 0.5.1 | ||
|
||
Thanks [Michael Blaszczyk](https://github.com/Blasz) for these contributions! | ||
- Add converters for typeParam and typeParamsDeclaration | ||
- Add reduceToObj function - previously this lived in pretty-proptypes | ||
|
||
## 0.5.0 | ||
|
||
- Add new converters for export and exportSpecifier types | ||
- Modernize dependent version of extract-react-types |
Oops, something went wrong.