Skip to content

Instantly share code, notes, and snippets.

View bacarybruno's full-sized avatar
💭
Think Simple

Bacary Bruno Bodian bacarybruno

💭
Think Simple
View GitHub Profile
@bacarybruno
bacarybruno / proptypes-to-typescript.ts
Created August 4, 2022 11:53
A React codemod that will transform proptypes to typescript type alias for component types
// Modified version of https://github.com/mskelton/ratchet
import type { NodePath } from 'ast-types/lib/node-path';
import type {
API,
Collection,
CommentBlock,
CommentLine,
FileInfo,
Identifier,
@bacarybruno
bacarybruno / checkIfAffected.js
Created December 12, 2022 10:24
[NX] Check if a module if affected by a change
const { execSync } = require('child_process')
const checkIfAffected = (modules) => {
const result = execSync('yarn nx print-affected --select=projects').toString()
const changedModules = result.split('\n')[2].split(', ')
return modules.some((module) => changedModules.includes(module))
}
if (require.main === module) {
const modules = process.argv.slice(2)