@trpc/upgrade 0.0.0-alpha.12 → 0.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +4 -9
- package/package.json +1 -1
- package/src/bin/cli.ts +5 -4
package/dist/cli.cjs
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var path = require('path');
|
|
3
2
|
var cli$1 = require('@effect/cli');
|
|
4
3
|
var platform = require('@effect/platform');
|
|
5
4
|
var platformNode = require('@effect/platform-node');
|
|
6
5
|
var effect = require('effect');
|
|
7
6
|
var typescript = require('typescript');
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
12
|
-
|
|
13
|
-
var version = "0.0.0-alpha.11";
|
|
8
|
+
var version = "0.0.0-alpha.14";
|
|
14
9
|
|
|
15
10
|
const MakeCommand = (command, ...args)=>{
|
|
16
|
-
return platform.Command.workingDirectory(process.cwd())
|
|
11
|
+
return platform.Command.make(command, ...args).pipe(platform.Command.workingDirectory(process.cwd()), platform.Command.runInShell(true));
|
|
17
12
|
};
|
|
18
13
|
const assertCleanGitTree = platform.Command.string(MakeCommand('git', 'status')).pipe().pipe(effect.Effect.filterOrFail(effect.String.includes('nothing to commit'), ()=>'Git tree is not clean, please commit your changes and try again, or run with `--force`'));
|
|
19
14
|
const getPackageManager = ()=>effect.Match.value(process.env.npm_config_user_agent ?? 'npm').pipe(effect.Match.when(effect.String.startsWith('pnpm'), ()=>'pnpm'), effect.Match.when(effect.String.startsWith('yarn'), ()=>'yarn'), effect.Match.when(effect.String.startsWith('bun'), ()=>'bun'), effect.Match.orElse(()=>'npm'));
|
|
@@ -27,11 +22,11 @@ const uninstallPackage = (packageName)=>{
|
|
|
27
22
|
return platform.Command.streamLines(MakeCommand(packageManager, uninstallCmd, packageName)).pipe(effect.Stream.mapEffect(effect.Console.log), effect.Stream.runDrain);
|
|
28
23
|
};
|
|
29
24
|
const filterIgnored = (files)=>effect.Effect.gen(function*() {
|
|
30
|
-
const ignores = yield* platform.Command.string(MakeCommand('git check-ignore **/*')).pipe(effect.Effect.tap((_)=>effect.Effect.logDebug('Ignored files output:', _)), effect.Effect.map((_)=>_.split('\n')));
|
|
25
|
+
const ignores = yield* platform.Command.string(MakeCommand('git', 'check-ignore', '**/*').pipe(platform.Command.runInShell(true))).pipe(effect.Effect.tap((_)=>effect.Effect.logDebug('Ignored files output:', _)), effect.Effect.map((_)=>_.split('\n')));
|
|
31
26
|
yield* effect.Effect.logDebug('All files in program:', files.map((_)=>_.fileName));
|
|
32
27
|
yield* effect.Effect.logDebug('Ignored files:', ignores);
|
|
33
28
|
// Ignore "common files"
|
|
34
|
-
const filteredSourcePaths = files.filter((source)=>source.fileName.startsWith(
|
|
29
|
+
const filteredSourcePaths = files.filter((source)=>source.fileName.startsWith(process.cwd()) && // only look ahead of current directory
|
|
35
30
|
!source.fileName.includes('/trpc/packages/') && // relative paths when running codemod locally
|
|
36
31
|
!ignores.includes(source.fileName)).map((source)=>source.fileName);
|
|
37
32
|
yield* effect.Effect.logDebug('Filtered files:', filteredSourcePaths);
|
package/package.json
CHANGED
package/src/bin/cli.ts
CHANGED
|
@@ -27,8 +27,9 @@ import {
|
|
|
27
27
|
import { version } from '../../package.json';
|
|
28
28
|
|
|
29
29
|
const MakeCommand = (command: string, ...args: string[]) => {
|
|
30
|
-
return Command.
|
|
31
|
-
Command.
|
|
30
|
+
return Command.make(command, ...args).pipe(
|
|
31
|
+
Command.workingDirectory(process.cwd()),
|
|
32
|
+
Command.runInShell(true),
|
|
32
33
|
);
|
|
33
34
|
};
|
|
34
35
|
|
|
@@ -67,7 +68,7 @@ const uninstallPackage = (packageName: string) => {
|
|
|
67
68
|
const filterIgnored = (files: readonly SourceFile[]) =>
|
|
68
69
|
Effect.gen(function* () {
|
|
69
70
|
const ignores = yield* Command.string(
|
|
70
|
-
MakeCommand('git check-ignore **/*'),
|
|
71
|
+
MakeCommand('git', 'check-ignore', '**/*').pipe(Command.runInShell(true)),
|
|
71
72
|
).pipe(
|
|
72
73
|
Effect.tap((_) => Effect.logDebug('Ignored files output:', _)),
|
|
73
74
|
Effect.map((_) => _.split('\n')),
|
|
@@ -83,7 +84,7 @@ const filterIgnored = (files: readonly SourceFile[]) =>
|
|
|
83
84
|
const filteredSourcePaths = files
|
|
84
85
|
.filter(
|
|
85
86
|
(source) =>
|
|
86
|
-
source.fileName.startsWith(
|
|
87
|
+
source.fileName.startsWith(process.cwd()) && // only look ahead of current directory
|
|
87
88
|
!source.fileName.includes('/trpc/packages/') && // relative paths when running codemod locally
|
|
88
89
|
!ignores.includes(source.fileName), // ignored files
|
|
89
90
|
)
|