Skip to content

Commit 0f9879b

Browse files
authored
Make this repository a mono-repo with all the related projects in here (#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.
1 parent c35845f commit 0f9879b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+5980
-1036
lines changed

.changeset/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Changesets
2+
3+
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)
4+
5+
To help you get started though, here are some things you should know about this folder:
6+
7+
## Changesets are automatically generated
8+
9+
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.
10+
11+
## Each changeset is its own folder
12+
13+
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.
14+
15+
## Changesets are automatically removed
16+
17+
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.
18+
19+
## Changesets come in two parts
20+
21+
You should treat these parts quite differently:
22+
23+
- `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.
24+
- `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.
25+
26+
## I want to edit the information in a `changes.json` - how do I do it safely?
27+
28+
The best option is to make a new changeset using the changeset command, copy over the `changes.md`, then delete the old changeset.
29+
30+
## Can I rename the folder for my changeset?
31+
32+
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.
33+
34+
## Can I manually delete changesets?
35+
36+
You can, but you should be aware this will remove the intent to release communicated by the changeset, and should be done with caution.

.changeset/config.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
Hey, welcome to the changeset config! This file has been generated
3+
for you with the default configs we use, and some comments around
4+
what options mean, so that it's easy to customise your workflow.
5+
6+
You should update this as you need to craft your workflow.
7+
8+
Config provided by a CI command takes precedence over the contents of this file.
9+
10+
If a config option isn't present here, we will fall back to the defaults.
11+
*/
12+
13+
const changesetOptions = {
14+
// If true, we will automatically commit the changeset when the command is run
15+
commit: false,
16+
};
17+
18+
// This function takes information about a changeset to generate an entry for it in your
19+
// changelog. We provide the full changeset object as well as the version.
20+
// It may be a good idea to replace the commit hash with a link to the commit.
21+
22+
/* the default shape is:
23+
- [patch] ABCDEFG:
24+
25+
A summary message you wrote, indented
26+
*/
27+
28+
const getReleaseLine = async (changeset, versionType) => {
29+
const indentedSummary = changeset.summary
30+
.split('\n')
31+
.map(l => ` ${l}`.trimRight())
32+
.join('\n');
33+
34+
return `- [${versionType}] ${changeset.commit}:\n\n${indentedSummary}`;
35+
};
36+
37+
// This function takes information about what dependencies we are updating in the package.
38+
// It provides an array of related changesets, as well as the dependencies updated.
39+
40+
/*
41+
- Updated dependencies: [ABCDEFG]:
42+
- Updated dependencies: [HIJKLMN]:
43+
44+
45+
*/
46+
const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => {
47+
if (dependenciesUpdated.length === 0) return '';
48+
49+
const changesetLinks = changesets.map(
50+
changeset => `- Updated dependencies [${changeset.commit}]:`,
51+
);
52+
53+
const updatedDepenenciesList = dependenciesUpdated.map(
54+
dependency => ` - ${dependency.name}@${dependency.version}`,
55+
);
56+
57+
return [...changesetLinks, ...updatedDepenenciesList].join('\n');
58+
};
59+
60+
const versionOptions = {
61+
// If true, we will automatically commit the version updating when the command is run
62+
commit: false,
63+
// Adds a skipCI flag to the commit - only valid if `commit` is also true.
64+
skipCI: false,
65+
// Do not modify the `changelog.md` files for packages that are updated
66+
noChangelog: false,
67+
// A function that returns a string. It takes in options about a change. This allows you to customise your changelog entries
68+
getReleaseLine,
69+
// A function that returns a string. It takes in options about when a pacakge is updated because
70+
getDependencyReleaseLine,
71+
};
72+
73+
const publishOptions = {
74+
// This sets whether unpublished packages are public by default. We err on the side of caution here.
75+
public: false,
76+
};
77+
78+
module.exports = {
79+
versionOptions,
80+
changesetOptions,
81+
publishOptions,
82+
};

.flowconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[ignore]
2+
.*/packages/kind2string/.*
23

34
[include]
45

@@ -7,3 +8,4 @@
78
[lints]
89

910
[options]
11+
emoji=true

.gitignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
node_modules
2+
3+
**/dist
4+
5+
# ignore all logs
26
*.log
3-
.vscode
7+
8+
# ignore editor generated files
9+
.vscode
10+
.idea
11+
.iml
12+
13+
14+
# ignore yarn.locks generated in packages
15+
packages/**/**/yarn.lock

flow-typed/babel-errors.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @flow
2+
declare module 'babel-errors' {
3+
declare module.exports: {
4+
wrapErrorWithCodeFrame: (any, any) => any,
5+
};
6+
}

flow-typed/kind2string.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @flow
2+
declare module 'kind2string' {
3+
declare module.exports: any;
4+
}

package.json

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
{
2-
"name": "extract-react-types",
3-
"version": "0.15.1",
4-
"main": "index.js",
5-
"repository": "atlassian/extract-react-types",
6-
"author": "James Kyle <[email protected]>",
7-
"license": "Apache-2.0",
2+
"name": "extract-react-types-mono-repo",
3+
"version": "0.0.0",
84
"scripts": {
9-
"test": "jest"
5+
"changeset": "bolt build-releases changeset"
6+
},
7+
"bolt": {
8+
"workspaces": [
9+
"packages/*"
10+
]
1011
},
11-
"keywords": [
12-
"react",
13-
"flow",
14-
"typescript",
15-
"prop-types",
16-
"documentation"
17-
],
1812
"dependencies": {
13+
"@atlaskit/build-releases": "^3.0.3",
1914
"@babel/core": "7.0.0-beta.56",
2015
"@babel/types": "^7.0.0-beta.56",
2116
"ast-pretty-print": "^2.0.1",
@@ -31,11 +26,29 @@
3126
"babel-type-scopes": "^1.1.0",
3227
"babylon": "^7.0.0-beta.22",
3328
"babylon-options": "^2.0.1",
29+
"emotion": "^9.1.1",
30+
"react-markings": "^1.2.0",
3431
"strip-indent": "^2.0.0"
3532
},
3633
"devDependencies": {
37-
"flow-bin": "0.61.0",
38-
"jest": "^21.2.1",
39-
"prettier": "^1.13.7"
34+
"babel-cli": "^6.26.0",
35+
"babel-plugin-emotion": "^9.1.0",
36+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
37+
"babel-plugin-transform-class-properties": "^6.24.1",
38+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
39+
"babel-plugin-transform-runtime": "^6.23.0",
40+
"babel-preset-env": "^1.6.1",
41+
"babel-preset-flow": "^6.23.0",
42+
"babel-preset-react": "^6.24.1",
43+
"babel-register": "^6.26.0",
44+
"enzyme": "^3.3.0",
45+
"enzyme-adapter-react-16": "^1.1.1",
46+
"flow-bin": "^0.69.0",
47+
"jest": "^23.6.0",
48+
"jsdom": "^11.7.0",
49+
"prettier": "^1.13.7",
50+
"react": "^16.3.1",
51+
"react-addons-test-utils": "^15.6.2",
52+
"react-dom": "^16.3.1"
4053
}
4154
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# extract-react-types-loader
2+
3+
## 0.3.0
4+
- [minor] [882a85c](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/882a85c):
5+
6+
- Use version 0.15.0 of extract-react-types - the breaking change cannot be absorbed by changes in this package.
7+
8+
## 0.2.2
9+
- [patch] Upgrade extract-react-types to add TypeScript support. [c742e5a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c742e5a)
10+
11+
## 0.2.1
12+
- [patch] Remove console log [e16d2b6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e16d2b6)
13+
14+
## 0.2.0
15+
- [minor] Add pathFilter function to resolve atlaskit:src paths within atlaskit [c5214a3](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c5214a3)
16+
17+
## 0.1.3
18+
- [patch] Sanity test release, no actual change [481c086](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/481c086)
19+
20+
## 0.1.2
21+
- [patch] Upgrade extract-react-types version [f78d035](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/f78d035)
22+
23+
## 0.1.1
24+
- [patch] Makes packages Flow types compatible with version 0.67 [25daac0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/25daac0)
25+
26+
## 0.1.0
27+
- [minor] Npm fell behind code [9684be0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9684be0)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// @flow
2+
3+
const path = require('path');
4+
const extractReactTypes = require('extract-react-types');
5+
6+
const devProps = {
7+
classes: [
8+
{
9+
value: {
10+
kind: 'object',
11+
members: [
12+
{
13+
kind: 'property',
14+
key: { kind: 'id', name: 'Warning' },
15+
value: { kind: 'any' },
16+
optional: false,
17+
leadingComments: [
18+
{
19+
type: 'commentBlock',
20+
value: `extract-react-types is not being run in dev mode for speed reasons. If you need to
21+
see prop types add the environment variable \`FORCE_EXTRACT_REACT_TYPES\`
22+
eg:
23+
- \`FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>\`
24+
- \`FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>\``,
25+
raw: '**',
26+
},
27+
],
28+
default: {
29+
kind: 'string',
30+
value: 'Prop types are not shown in dev mode',
31+
},
32+
},
33+
],
34+
referenceIdName: 'AvatarPropTypes',
35+
},
36+
},
37+
],
38+
};
39+
40+
module.exports = function extractReactTypesLoader(content /* : string */) {
41+
if (
42+
!['staging', 'production'].includes(process.env.WEBSITE_ENV) &&
43+
!process.env.FORCE_EXTRACT_REACT_TYPES
44+
) {
45+
return `module.exports = ${JSON.stringify(devProps)}`;
46+
}
47+
48+
const filename = this.resource;
49+
const ext = path.extname(filename);
50+
const typeSystem = ext === '.ts' || ext === '.tsx' ? 'typescript' : 'flow';
51+
52+
const resolveOpts = {
53+
pathFilter: (pkg, location, dist) => {
54+
if (
55+
pkg['atlaskit:src'] &&
56+
location.includes('node_modules') &&
57+
location.includes(pkg.main)
58+
) {
59+
return location.replace(dist, pkg['atlaskit:src']);
60+
}
61+
return null;
62+
},
63+
};
64+
65+
const types = extractReactTypes(content, typeSystem, filename, resolveOpts);
66+
return `module.exports = ${JSON.stringify(types)}`;
67+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "extract-react-types-loader",
3+
"version": "0.3.0",
4+
"main": "index.js",
5+
"dependencies": {
6+
"extract-react-types": "^0.15.1"
7+
}
8+
}

0 commit comments

Comments
 (0)