-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scripts-generators): incorporate base all generation to create-p…
…ackage and validate integrity on CI
- Loading branch information
Showing
5 changed files
with
61 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createPathAliasesConfig } from '@fluentui/scripts-storybook'; | ||
import { isEqual } from 'lodash'; | ||
import * as yargs from 'yargs'; | ||
|
||
const isExecutedFromCli = require.main === module; | ||
|
||
if (isExecutedFromCli) { | ||
const argv = yargs | ||
.option('verify', { | ||
describe: 'Run check if ts base all is up to date. Used mostly on CI', | ||
type: 'boolean', | ||
}) | ||
.help().argv; | ||
|
||
main(argv); | ||
} | ||
|
||
export function main(options?: yargs.Arguments<{ verify?: boolean }>) { | ||
const { verify = false } = options ?? {}; | ||
|
||
const { mergedTsConfig, existingTsConfig, tsConfigAllFileName } = createPathAliasesConfig({ | ||
relativeFolderPathFromRoot: '.', | ||
writeFileToDisk: verify === false, | ||
}); | ||
|
||
if (verify && !isEqual(existingTsConfig, mergedTsConfig)) { | ||
throw new Error(` | ||
🚨 ${tsConfigAllFileName} is out of date. | ||
Please update it by running 'yarn ts-node --swc scripts/generators/generate-ts-base-all-json.ts'. | ||
`); | ||
} | ||
} |
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