Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
chore: updated the @intuita-inc/filemod to v. 2.0.0. (#558)
Browse files Browse the repository at this point in the history
* chore: updated the @intuita-inc/filemod to v. 2.0.0.

* chore: replace ts-node with tsx for the builder package
  • Loading branch information
grzpab authored Jan 17, 2024
1 parent 897011b commit 9a5a965
Show file tree
Hide file tree
Showing 33 changed files with 499 additions and 428 deletions.
6 changes: 3 additions & 3 deletions builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"@codemod-registry/tsconfig": "workspace:*",
"@types/node": "^20.9.2",
"@types/tar": "^6.1.9",
"ts-node": "^10.9.1",
"tsx": "^4.7.0",
"typescript": "^5.2.2"
},
"scripts": {
"build": "ts-node --esm ./index.ts",
"build:homedir": "ts-node --esm ./index.ts --homedir"
"build": "tsx ./index.ts",
"build:homedir": "tsx --esm ./index.ts --homedir"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
27 changes: 9 additions & 18 deletions codemods/cal.com/app-directory-boilerplate-calcom/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
import { deepStrictEqual, ok } from 'node:assert';
import { describe, it } from 'vitest';
import { DirectoryJSON, Volume, createFsFromVolume } from 'memfs';
import {
FileSystemManager,
UnifiedFileSystem,
buildApi,
executeFilemod,
} from '@intuita-inc/filemod';
import { buildApi, executeFilemod } from '@intuita-inc/filemod';
import { repomod } from '../src/index.js';
import tsmorph from 'ts-morph';
import {
buildUnifiedFileSystem,
buildPathAPI,
} from '@codemod-registry/utilities';

const transform = async (json: DirectoryJSON) => {
const volume = Volume.fromJSON(json);
const fs = createFsFromVolume(volume);

const fileSystemManager = new FileSystemManager(
// @ts-expect-error type convergence
volume.promises.readdir,
volume.promises.readFile,
volume.promises.stat,
);
const unifiedFileSystem = new UnifiedFileSystem(
// @ts-expect-error type convergence
createFsFromVolume(volume),
fileSystemManager,
);
const unifiedFileSystem = buildUnifiedFileSystem(fs);
const pathApi = buildPathAPI('/');

const api = buildApi<{
tsmorph: typeof tsmorph;
Expand All @@ -32,7 +23,7 @@ const transform = async (json: DirectoryJSON) => {
() => ({
tsmorph,
}),
'/',
pathApi,
);

return executeFilemod(api, repomod, '/', {}, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
27 changes: 9 additions & 18 deletions codemods/cal.com/generate-metadata-tests-calcom/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
import { deepStrictEqual } from 'node:assert';
import { describe, it } from 'vitest';
import { DirectoryJSON, Volume, createFsFromVolume } from 'memfs';
import {
FileSystemManager,
UnifiedFileSystem,
buildApi,
executeFilemod,
} from '@intuita-inc/filemod';
import { buildApi, executeFilemod } from '@intuita-inc/filemod';
import { buildData, repomod } from '../src/index.js';
import {
buildUnifiedFileSystem,
buildPathAPI,
} from '@codemod-registry/utilities';

const transform = async (json: DirectoryJSON) => {
const volume = Volume.fromJSON(json);
const fs = createFsFromVolume(volume);

const fileSystemManager = new FileSystemManager(
// @ts-expect-error type convergence
volume.promises.readdir,
volume.promises.readFile,
volume.promises.stat,
);
const unifiedFileSystem = new UnifiedFileSystem(
// @ts-expect-error type convergence
createFsFromVolume(volume),
fileSystemManager,
);
const unifiedFileSystem = buildUnifiedFileSystem(fs);
const pathApi = buildPathAPI('/');

const api = buildApi<Record<string, never>>(
unifiedFileSystem,
() => ({}),
'/',
pathApi,
);

return executeFilemod(api, repomod, '/', { testPath: '/opt/tests' }, {});
Expand Down
2 changes: 1 addition & 1 deletion codemods/cal.com/generate-url-patterns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
27 changes: 9 additions & 18 deletions codemods/cal.com/generate-url-patterns/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { deepStrictEqual } from 'node:assert';
import { describe, it } from 'vitest';
import { DirectoryJSON, Volume, createFsFromVolume } from 'memfs';
import {
FileSystemManager,
UnifiedFileSystem,
buildApi,
executeFilemod,
} from '@intuita-inc/filemod';
import { buildApi, executeFilemod } from '@intuita-inc/filemod';
import { repomod } from '../src/index.js';
import jscodeshift from 'jscodeshift';
import {
buildUnifiedFileSystem,
buildPathAPI,
} from '@codemod-registry/utilities';

const transform = async (
json: DirectoryJSON,
Expand All @@ -21,25 +20,17 @@ const transform = async (
) => {
const volume = Volume.fromJSON(json);

const fileSystemManager = new FileSystemManager(
// @ts-expect-error type convergence
volume.promises.readdir,
volume.promises.readFile,
volume.promises.stat,
);
const fs = createFsFromVolume(volume);

const unifiedFileSystem = new UnifiedFileSystem(
// @ts-expect-error type convergence
createFsFromVolume(volume),
fileSystemManager,
);
const unifiedFileSystem = buildUnifiedFileSystem(fs);
const pathApi = buildPathAPI('/');

const api = buildApi<{ jscodeshift: typeof jscodeshift }>(
unifiedFileSystem,
() => ({
jscodeshift,
}),
'/',
pathApi,
);

return executeFilemod(api, repomod, '/', options, {});
Expand Down
2 changes: 1 addition & 1 deletion codemods/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
22 changes: 8 additions & 14 deletions codemods/i18n/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
import { DirectoryJSON, Volume, createFsFromVolume } from 'memfs';
import { describe, it } from 'vitest';
import {
FileSystemManager,
UnifiedFileSystem,
buildApi,
executeFilemod,
} from '@intuita-inc/filemod';
import { repomod } from '../src/index.js';
import tsmorph from 'ts-morph';
import { deepStrictEqual } from 'node:assert';
import {
buildUnifiedFileSystem,
buildPathAPI,
} from '@codemod-registry/utilities';

const transform = async (json: DirectoryJSON) => {
const volume = Volume.fromJSON(json);
const fs = createFsFromVolume(volume);

const fileSystemManager = new FileSystemManager(
volume.promises.readdir as any,
volume.promises.readFile as any,
volume.promises.stat as any,
);

const fileSystem = createFsFromVolume(volume) as any;

const unifiedFileSystem = new UnifiedFileSystem(
fileSystem,
fileSystemManager,
);
const unifiedFileSystem = buildUnifiedFileSystem(fs);
const pathApi = buildPathAPI('/');

const api = buildApi<{
tsmorph: typeof tsmorph;
Expand All @@ -35,7 +29,7 @@ const transform = async (json: DirectoryJSON) => {
tsmorph,
unifiedFileSystem,
}),
'/',
pathApi,
);

return executeFilemod(api, repomod, '/', {}, {});
Expand Down
2 changes: 1 addition & 1 deletion codemods/intuita/migrate-codemod-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
2 changes: 1 addition & 1 deletion codemods/mocha/vitest/migrate-configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@codemod-registry/cjs-builder": "workspace:*",
"@codemod-registry/tsconfig": "workspace:*",
"@codemod-registry/utilities": "workspace:*",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"@types/jscodeshift": "^0.11.10",
"esbuild": "0.19.5",
"jscodeshift": "^0.15.1",
Expand Down
30 changes: 11 additions & 19 deletions codemods/mocha/vitest/migrate-configuration/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
import {
FileSystemManager,
UnifiedFileSystem,
buildApi,
executeFilemod,
} from '@intuita-inc/filemod';
import { buildApi, executeFilemod } from '@intuita-inc/filemod';
import { describe, it } from 'vitest';
import { DirectoryJSON, Volume, createFsFromVolume } from 'memfs';
import { deepEqual, equal, ok } from 'node:assert';
import { repomod } from '../src/index.js';
import {
buildUnifiedFileSystem,
buildPathAPI,
} from '@codemod-registry/utilities';

const transform = async (json: DirectoryJSON) => {
const volume = Volume.fromJSON(json);

const fileSystemManager = new FileSystemManager(
// @ts-expect-error type convergence
volume.promises.readdir,
volume.promises.readFile,
volume.promises.stat,
);
const unifiedFileSystem = new UnifiedFileSystem(
// @ts-expect-error type convergence
createFsFromVolume(volume),
fileSystemManager,
);

const api = buildApi(unifiedFileSystem, () => ({}), '/');
const fs = createFsFromVolume(volume);

const unifiedFileSystem = buildUnifiedFileSystem(fs);
const pathApi = buildPathAPI('/');

const api = buildApi(unifiedFileSystem, () => ({}), pathApi);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
2 changes: 1 addition & 1 deletion codemods/next-i18next/copy-keys/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
27 changes: 9 additions & 18 deletions codemods/next-i18next/copy-keys/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
import { DirectoryJSON, Volume, createFsFromVolume } from 'memfs';
import { describe, it } from 'vitest';
import {
FileSystemManager,
UnifiedFileSystem,
buildApi,
executeFilemod,
} from '@intuita-inc/filemod';
import { buildApi, executeFilemod } from '@intuita-inc/filemod';
import { repomod } from '../src/index.js';
import { deepStrictEqual } from 'node:assert';
import {
buildUnifiedFileSystem,
buildPathAPI,
} from '@codemod-registry/utilities';

type Options = Readonly<Record<string, string | number | boolean | undefined>>;

const transform = async (json: DirectoryJSON, options: Options) => {
const volume = Volume.fromJSON(json);

const fileSystemManager = new FileSystemManager(
volume.promises.readdir as any,
volume.promises.readFile as any,
volume.promises.stat as any,
);
const fs = createFsFromVolume(volume);

const fileSystem = createFsFromVolume(volume) as any;

const unifiedFileSystem = new UnifiedFileSystem(
fileSystem,
fileSystemManager,
);
const unifiedFileSystem = buildUnifiedFileSystem(fs);
const pathApi = buildPathAPI('/');

const api = buildApi<Record<string, never>>(
unifiedFileSystem,
() => ({}),
'/',
pathApi,
);

return executeFilemod(api, repomod, '/', options, {});
Expand Down
2 changes: 1 addition & 1 deletion codemods/next/13/ab-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typescript": "^5.2.2",
"esbuild": "0.19.5",
"ts-node": "^10.9.1",
"@intuita-inc/filemod": "1.1.0",
"@intuita-inc/filemod": "2.0.0",
"memfs": "^4.6.0",
"ts-morph": "^19.0.0",
"jscodeshift": "^0.15.1",
Expand Down
Loading

0 comments on commit 9a5a965

Please sign in to comment.