Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3e0fde

Browse files
authored
[cli] Rename references to future main branch (#4348)
* write flow correctly and update references to master* add tests to write flow
1 parentbcd5cf9 commitb3e0fde

20 files changed

+226
-61
lines changed

‎CHANGELOG.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313
- Make use of flow-typed.config.js for ignored (#4288)
1414

1515
###Changed
16-
- Consistent list logging (#4287)
16+
- Consistent list logging (#4287)
1717
- Coerce cli version with semver to allow for prerelease tags (#4291)
1818
- Fix if dependency is resolved npm package (#4298)
1919
- Bump minimist from 1.2.0 to 1.2.6 in (#4293)
@@ -24,19 +24,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2424
##[3.7.0] 2022-02-21
2525

2626
###Added
27-
- New`outdated` command (#4171)
27+
- New`outdated` command (#4171)
2828

2929
###Changed
30-
- CLI tool now ships with flowtypes (#4233)
31-
- Install can match with alpha versions now (#4247)
30+
- CLI tool now ships with flowtypes (#4233)
31+
- Install can match with alpha versions now (#4247)
3232

3333
###Fixed
3434
- Fix create def with scopes (#4234)
3535
- Fix buffer deprecation error (#4270)
36-
- Temporarily turn off validate-def checks against npm (#4249)
37-
- Bump ajv from 6.11.0 to 6.12.6 in /cli (#4260)
38-
- Bump node-fetch from 2.6.6 to 2.6.7 in /cli (#4254)
39-
- Bump shelljs from 0.8.3 to 0.8.5 in /cli (#4237)
36+
- Temporarily turn off validate-def checks against npm (#4249)
37+
- Bump ajv from 6.11.0 to 6.12.6 in /cli (#4260)
38+
- Bump node-fetch from 2.6.6 to 2.6.7 in /cli (#4254)
39+
- Bump shelljs from 0.8.3 to 0.8.5 in /cli (#4237)
4040

4141
##[3.6.1] 2022-01-09
4242

@@ -249,7 +249,7 @@ A week after this release, all previous versions of `flow-typed` on npm will be
249249
###Added
250250
- Allow any file type (.md, .json) under`/definitions/npm/<library>_vx.x.x/` (#1962)
251251
-`describe` and`it` can now be importing from`'flow-typed-test'` in`_test` files (#1942)
252-
- See[CONTRIBUTING.md](https://github.com/flow-typed/flow-typed/blob/master/CONTRIBUTING.md)
252+
- See[CONTRIBUTING.md](https://github.com/flow-typed/flow-typed/blob/main/CONTRIBUTING.md)
253253
- Root directory option (-rootDir) to install command (#1835)
254254

255255
###Changed

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Contributing library definitions is as easy as sending a pull request!
3030
##Understanding the definitions structure
3131

3232
All definitions sit under the
33-
[/definitions](https://github.com/flowtype/flow-typed/tree/master/definitions)
33+
[/definitions](https://github.com/flowtype/flow-typed/tree/main/definitions)
3434
directory. They all must follow the following directory structure and naming
3535
format:
3636

@@ -151,11 +151,11 @@ reasonable degree. At minimum your tests should:
151151
1. Use the library definition in a couple of ways that are*expected* to produce
152152
a type error. Though type errors should fail your tests, you can add[error suppressions](https://flow.org/en/docs/errors/) to the line above just like you would in your own codebase.
153153

154-
[Here](https://github.com/flow-typed/flow-typed/blob/master/definitions/npm/highlight.js_v8.x.x/test_highlight.js-v8.js)
154+
[Here](https://github.com/flow-typed/flow-typed/blob/main/definitions/npm/highlight.js_v8.x.x/test_highlight.js-v8.js)
155155
is an example of a nice and thorough test file. You don't necessarily have to be
156156
this thorough, but the more thorough you are the better!
157157

158-
Sometimes you may want to break down your test suite instead of having one gigantic file. In that case you can actually write as many test files as you like as long as their names start with`test_`.[Redux](https://github.com/flow-typed/flow-typed/tree/master/definitions/npm/redux_v4.x.x/flow_v0.134.x-) followed this pattern.
158+
Sometimes you may want to break down your test suite instead of having one gigantic file. In that case you can actually write as many test files as you like as long as their names start with`test_`.[Redux](https://github.com/flow-typed/flow-typed/tree/main/definitions/npm/redux_v4.x.x/flow_v0.134.x-) followed this pattern.
159159

160160
Alternatively you can add test files in the**package version directory** which will be run by
161161
the test-runner for*all* versions of flow the package version supports. Though general best practice as outlined above is using the**flow version directory**.

‎PULL_REQUEST_TEMPLATE.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<!--- # Please remember to use `describe` and `it`in the tests! see https://github.com/flow-typed/flow-typed/blob/master/CONTRIBUTING.md for details. --->
1+
<!--- # Please remember to use `describe` and `it`in the tests! see https://github.com/flow-typed/flow-typed/blob/main/CONTRIBUTING.md for details. --->
22

3-
- Links to documentation:
4-
- Link to GitHub or NPM:
3+
- Links to documentation:
4+
- Link to GitHub or NPM:
55
- Type of contribution: new definition | addition | fix | refactor
66

77
Other notes:

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</p>
66

77
<palign="center">
8-
A <ahref="https://github.com/flow-typed/flow-typed/tree/master/definitions">repository</a> of
8+
A <ahref="https://github.com/flow-typed/flow-typed/tree/main/definitions">repository</a> of
99
high-quality, third-party <ahref="https://flow.org/en/docs/libdefs">library type definitions</a>
1010
for use with <ahref="http://flow.org">Flow</a>.
1111
</p>
@@ -64,7 +64,7 @@ Chances are your question has already been answered! If not, don't hesitate to
6464

6565
##How Do I Contribute Library Definitions?
6666

67-
Just send a pull request! The documentation highlighted in[CONTRIBUTING.md](https://github.com/flow-typed/flow-typed/blob/master/CONTRIBUTING.md) should give a detailed overview of how to raise a pull request following our best practices.
67+
Just send a pull request! The documentation highlighted in[CONTRIBUTING.md](https://github.com/flow-typed/flow-typed/blob/main/CONTRIBUTING.md) should give a detailed overview of how to raise a pull request following our best practices.
6868

6969
###Contributing to the CLI
7070

‎cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"eslint-plugin-fb-flow":"^0.0.4",
6060
"eslint-plugin-flowtype":"^8.0.3",
6161
"eslint-plugin-prettier":"^4.0.0",
62-
"flow-bin":"^0.165.1",
62+
"flow-bin":"^0.183.0",
6363
"flow-copy-source":"^2.0.9",
6464
"jest":"^27.3.1"
6565
},

‎cli/src/commands/__tests__/install-test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@flow
22

3-
(require('../../lib/git'):any).rebaseRepoMaster=jest.fn();
3+
(require('../../lib/git'):any).rebaseRepoMainline=jest.fn();
44

55
import{
66
_clearCustomCacheDirasclearCustomCacheDir,

‎cli/src/commands/__tests__/outdated-test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@flow
2-
(require('../../lib/git'):any).rebaseRepoMaster=jest.fn();
2+
(require('../../lib/git'):any).rebaseRepoMainline=jest.fn();
33

44
import{table}from'table';
55
import{

‎cli/src/commands/__tests__/runTests-test.js‎

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@flow
2-
import{run}from'../runTests';
2+
importfsfrom'fs';
3+
4+
import{run,writeFlowConfig,TEST_DIR}from'../runTests';
35
import{path}from'../../lib/node';
46

57
describe('run-tests (command)',()=>{
@@ -31,4 +33,167 @@ describe('run-tests (command)', () => {
3133
expect(lastErrorMsg).toContain(expectedError);
3234
});
3335
});
36+
37+
describe('writeFlowConfig',()=>{
38+
constfixtureBasePath=path.join(
39+
process.cwd(),
40+
'src/commands/__tests__/__runTests-fixtures__',
41+
);
42+
consttestDir=path.join(TEST_DIR,'unit-test');
43+
constflowConfigFile=path.join(testDir,'.flowconfig');
44+
45+
beforeAll(()=>{
46+
fs.mkdirSync(testDir,{recursive:true});
47+
});
48+
49+
afterAll(()=>{
50+
fs.rmdirSync(testDir,{recursive:true});
51+
});
52+
53+
it('writes the file correctly',async()=>{
54+
awaitwriteFlowConfig(
55+
fixtureBasePath,
56+
testDir,
57+
path.join(fixtureBasePath,'definitions/npm/def/'),
58+
'0.181.0',
59+
[],
60+
);
61+
62+
constflowConfigSplit=fs
63+
.readFileSync(flowConfigFile,'utf-8')
64+
.split('\n');
65+
66+
constmatches=[
67+
'[libs]',
68+
'def',
69+
/.*cli\/src\/commands\/__tests__\/__util__\/tdd_framework\.js$/,
70+
'',
71+
'[options]',
72+
'include_warnings=true',
73+
'server.max_workers=0',
74+
'sharedmemory.heap_size=3221225472',
75+
'',
76+
'',
77+
'[ignore]',
78+
/.*\/cli\/node_modules$/,
79+
'',
80+
'[lints]',
81+
'implicit-inexact-object=error',
82+
];
83+
84+
matches.forEach((match,i)=>{
85+
expect(flowConfigSplit[i]).toMatch(match);
86+
});
87+
});
88+
89+
it('writes flow suppression if flow version is less than 0.125.0',async()=>{
90+
awaitwriteFlowConfig(
91+
fixtureBasePath,
92+
testDir,
93+
path.join(fixtureBasePath,'definitions/npm/def/'),
94+
'0.124.0',
95+
[],
96+
);
97+
98+
constflowConfigSplit=fs
99+
.readFileSync(flowConfigFile,'utf-8')
100+
.split('\n');
101+
102+
constmatches=[
103+
'[libs]',
104+
'def',
105+
/.*cli\/src\/commands\/__tests__\/__util__\/tdd_framework\.js$/,
106+
'',
107+
'[options]',
108+
'include_warnings=true',
109+
'server.max_workers=0',
110+
'sharedmemory.heap_size=3221225472',
111+
'suppress_comment=\\\\(.\\\\|\\n\\\\)*\\\\$FlowExpectedError',
112+
'',
113+
'[ignore]',
114+
/.*\/cli\/node_modules$/,
115+
'',
116+
'[lints]',
117+
'implicit-inexact-object=error',
118+
];
119+
120+
matches.forEach((match,i)=>{
121+
expect(flowConfigSplit[i]).toMatch(match);
122+
});
123+
});
124+
125+
it('does not have inexplicit lint when less than flow version less than 0.104.0',async()=>{
126+
awaitwriteFlowConfig(
127+
fixtureBasePath,
128+
testDir,
129+
path.join(fixtureBasePath,'definitions/npm/def/'),
130+
'0.103.0',
131+
[],
132+
);
133+
134+
constflowConfigSplit=fs
135+
.readFileSync(flowConfigFile,'utf-8')
136+
.split('\n');
137+
138+
constmatches=[
139+
'[libs]',
140+
'def',
141+
/.*cli\/src\/commands\/__tests__\/__util__\/tdd_framework\.js$/,
142+
'',
143+
'[options]',
144+
'include_warnings=true',
145+
'server.max_workers=0',
146+
'sharedmemory.heap_size=3221225472',
147+
'suppress_comment=\\\\(.\\\\|\\n\\\\)*\\\\$FlowExpectedError',
148+
'',
149+
'[ignore]',
150+
/.*\/cli\/node_modules$/,
151+
'',
152+
'[lints]',
153+
'',
154+
];
155+
156+
matches.forEach((match,i)=>{
157+
expect(flowConfigSplit[i]).toMatch(match);
158+
});
159+
});
160+
161+
it('writes the dependency definitions correctly',async()=>{
162+
awaitwriteFlowConfig(
163+
fixtureBasePath,
164+
testDir,
165+
path.join(fixtureBasePath,'definitions/npm/def/'),
166+
'0.183.0',
167+
['dep-1','dep-2'],
168+
);
169+
170+
constflowConfigSplit=fs
171+
.readFileSync(flowConfigFile,'utf-8')
172+
.split('\n');
173+
174+
constmatches=[
175+
'[libs]',
176+
'dep-1',
177+
'dep-2',
178+
'def',
179+
/.*cli\/src\/commands\/__tests__\/__util__\/tdd_framework\.js$/,
180+
'',
181+
'[options]',
182+
'include_warnings=true',
183+
'server.max_workers=0',
184+
'sharedmemory.heap_size=3221225472',
185+
'',
186+
'',
187+
'[ignore]',
188+
/.*\/cli\/node_modules$/,
189+
'',
190+
'[lints]',
191+
'',
192+
];
193+
194+
matches.forEach((match,i)=>{
195+
expect(flowConfigSplit[i]).toMatch(match);
196+
});
197+
});
198+
});
34199
});

‎cli/src/commands/install.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ async function installEnvLibDefs(
287287
`${en} already exists and appears to have been manually written or changed!`,
288288
),
289289
colors.yellow(
290-
`Read more at https://github.com/flow-typed/flow-typed/blob/master/CONTRIBUTING.md`,
290+
`Read more at https://github.com/flow-typed/flow-typed/blob/main/CONTRIBUTING.md`,
291291
),
292292
colors.yellow(
293293
`Use --overwrite to overwrite the existing env defs.`,
@@ -712,7 +712,7 @@ async function installNpmLibDef(
712712
colors.green(
713713
`Consider contributing your changes back to flow-typed repository :)`,
714714
),
715-
`Read more at https://github.com/flow-typed/flow-typed/blob/master/CONTRIBUTING.md`,
715+
`Read more at https://github.com/flow-typed/flow-typed/blob/main/CONTRIBUTING.md`,
716716
'Use --overwrite to overwrite the existing libdef.',
717717
);
718718
returntrue;

‎cli/src/commands/runTests.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const BIN_PLATFORM = (_ => {
4343
}
4444
})();
4545
constPKG_ROOT_DIR=path.join(__dirname,'..','..');
46-
constTEST_DIR=path.join(PKG_ROOT_DIR,'.test-dir');
46+
exportconstTEST_DIR:string=path.join(PKG_ROOT_DIR,'.test-dir');
4747
constBIN_DIR=path.join(PKG_ROOT_DIR,'.flow-bins-cache');
4848
constP=Promise;
4949

@@ -331,11 +331,11 @@ async function getCachedFlowBinVersions(
331331
returnversions.map(version=>`v${version}`);
332332
}
333333

334-
asyncfunctionwriteFlowConfig(
335-
repoDirPath,
336-
testDirPath,
337-
libDefPath,
338-
version,
334+
exportasyncfunctionwriteFlowConfig(
335+
repoDirPath:string,
336+
testDirPath:string,
337+
libDefPath:string,
338+
version:string,
339339
depPaths:Array<string>,
340340
){
341341
// /!\---------------------------------------------------------------------/!\
@@ -346,7 +346,7 @@ async function writeFlowConfig(
346346

347347
constflowConfigData=[
348348
'[libs]',
349-
[...depPaths],
349+
...depPaths,
350350
path.basename(libDefPath),
351351
path.join(repoDirPath,'..','__util__','tdd_framework.js'),
352352
'',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp