To run:
npx jscodeshift ./src -t ./shifter.ts --extensions=tsx --parser=tsx -p
Not covered cases:
import capitalize from '@mui/utils/capitalize’;
// https://raw.githubusercontent.com/phoboslab/qoi/master/qoi.h | |
class QoiRGBA { | |
constructor(r = 0, g = 0, b = 0, a = 255) { | |
this.r = r; | |
this.g = g; | |
this.b = b; | |
this.a = a; | |
} | |
} |
const ts = require('typescript'); | |
const fs = require('fs'); | |
const path = require('path'); | |
function getFileInfo(file, start) { | |
const { fileName } = file; | |
const { line, character } = file.getLineAndCharacterOfPosition(start); | |
return { fileName, line: line + 1, character: character + 1 }; | |
} |
type JsonData = { | |
meta: Meta; | |
parameters: Parameter[]; | |
}[]; | |
interface Meta { | |
type: string; // The dictionary is a Polygon. | |
classId: number; // Class ID (one of the class IDs in “classes.json”). If the instance has an undefined class, the value should be -1 (classId": -1) | |
className?: string; // Class name. If the instance has an undefined class, the key should not be in the JSON. | |
createdBy?: User; // Information about the user who created the Polygon. |
// ref https://twitter.com/underoot/status/1633430089802084352?s=52&t=0yc3BUdFiWnN-uQfrkt3xw | |
(async () = { | |
const port = 12345; // N port | |
const browser = await chromium. connectOverCDP(`http://localhost:${port}`); | |
const defaultContext = browser. contexts()[0]; | |
const page await defaultContext.newPage(); | |
// Do something with page | |
}); |
To run:
npx jscodeshift ./src -t ./shifter.ts --extensions=tsx --parser=tsx -p
Not covered cases:
import capitalize from '@mui/utils/capitalize’;
// @ts-check | |
const fs = require('fs'); | |
const path = require('path'); | |
const os = require('os'); | |
var { spawn } = require('child_process'); | |
const systemCpuCores = os.cpus(); | |
const pathToArtifacts = path.join(__dirname, '..', 'build', 'assets'); | |
const processes = systemCpuCores.length > 1 ? systemCpuCores.length - 1 : 1; |
import path from 'path'; | |
import os from 'os'; | |
import fs from 'fs-extra'; | |
// https://github.com/embroider-build/embroider/blob/main/PORTING-ADDONS-TO-V2.md | |
async function migrate(entry) { | |
const { default: walkSync } = await import('walk-sync'); | |
const files = () => walkSync(entry, { | |
ignore: [ | |
'.git', |
// A launch configuration that compiles the extension and then opens it inside a new window | |
{ | |
"version": "0.1.0", | |
"configurations": [ | |
{ | |
"name": "Attach by Process ID", | |
"processId": "${command:PickProcess}", | |
"request": "attach", | |
"resolveSourceMapLocations": null, | |
"sourceMaps": true, |
import Controller from '@ember/controller'; | |
import { htmlSafe } from '@ember/template'; | |
export default class ApplicationController extends Controller { | |
appName = htmlSafe('Ember <br> Twiddle'); | |
} |
'use strict'; | |
// eslint-disable-next-line node/no-extraneous-require | |
const { MergeTrees } = require('broccoli-merge-trees'); | |
// eslint-disable-next-line node/no-extraneous-require | |
const Plugin = require('broccoli-plugin'); | |
const fs = require('fs'); | |
const path = require('path'); | |
class ChunksWriter extends Plugin { |