-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into massoudmaboudi/iammassoud-add-showcase
- Loading branch information
Showing
484 changed files
with
2,964 additions
and
2,682 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
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
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
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
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
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
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
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,70 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import fs from 'fs-extra'; | ||
import {Globby} from '@docusaurus/utils'; | ||
import {Joi} from '@docusaurus/utils-validation'; | ||
|
||
type TsconfigFile = { | ||
file: string; | ||
content: { | ||
extends?: string; | ||
compilerOptions: { | ||
[key: string]: unknown; | ||
}; | ||
}; | ||
}; | ||
|
||
async function getTsconfigFiles(): Promise<TsconfigFile[]> { | ||
const files = await Globby('packages/*/tsconfig.*'); | ||
return Promise.all( | ||
files.map((file) => | ||
fs | ||
.readJSON(file) | ||
.then((content: TsconfigFile['content']) => ({file, content})), | ||
), | ||
); | ||
} | ||
|
||
const tsconfigSchema = Joi.object({ | ||
extends: '../../tsconfig.json', | ||
compilerOptions: Joi.alternatives().conditional( | ||
Joi.object({noEmit: true}).unknown(), | ||
{ | ||
then: Joi.object({ | ||
noEmit: Joi.valid(true).required(), | ||
incremental: Joi.forbidden(), | ||
tsBuildInfoFile: Joi.forbidden(), | ||
outDir: Joi.forbidden(), | ||
module: Joi.valid('commonjs', 'es2020', 'esnext').required(), | ||
}).unknown(), | ||
otherwise: Joi.object({ | ||
noEmit: Joi.valid(false).required(), | ||
incremental: Joi.valid(true).required(), | ||
rootDir: Joi.valid('src').required(), | ||
outDir: Joi.valid('lib').required(), | ||
module: Joi.valid('commonjs', 'es2020', 'esnext').required(), | ||
}).unknown(), | ||
}, | ||
), | ||
}).unknown(); | ||
|
||
describe('tsconfig files', () => { | ||
it('contain all required fields', async () => { | ||
const tsconfigFiles = await getTsconfigFiles(); | ||
tsconfigFiles.forEach((file) => { | ||
try { | ||
Joi.attempt(file.content, tsconfigSchema); | ||
} catch (e) { | ||
( | ||
e as Error | ||
).message += `\n${file.file} does not match the required schema.`; | ||
throw e; | ||
} | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.