jsrepo 1.4.0 → 1.4.1

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/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // src/index.ts
2
2
  import fs12 from "node:fs";
3
- import path12 from "node:path";
4
3
  import { fileURLToPath } from "node:url";
5
4
  import { program as program6 } from "commander";
5
+ import path12 from "pathe";
6
6
 
7
7
  // src/commands/add.ts
8
8
  import fs6 from "node:fs";
9
- import path6 from "node:path";
10
9
  import { cancel, confirm, isCancel, multiselect, outro, spinner as spinner2 } from "@clack/prompts";
11
10
  import color7 from "chalk";
12
11
  import { Command, program as program2 } from "commander";
13
12
  import { resolveCommand as resolveCommand2 } from "package-manager-detector/commands";
14
13
  import { detect } from "package-manager-detector/detect";
14
+ import path6 from "pathe";
15
15
  import * as v5 from "valibot";
16
16
 
17
17
  // src/utils/ascii.ts
@@ -28,8 +28,8 @@ var INFO = color.bgBlueBright.white("INFO");
28
28
 
29
29
  // src/utils/blocks.ts
30
30
  import fs4 from "node:fs";
31
- import path4 from "node:path";
32
31
  import color4 from "chalk";
32
+ import path4 from "pathe";
33
33
 
34
34
  // src/utils/blocks/types/result.ts
35
35
  var Result = class {
@@ -684,25 +684,25 @@ import * as v3 from "valibot";
684
684
 
685
685
  // src/utils/build.ts
686
686
  import fs3 from "node:fs";
687
- import path3 from "node:path";
688
687
  import color3 from "chalk";
689
688
  import { program } from "commander";
689
+ import path3 from "pathe";
690
690
  import * as v2 from "valibot";
691
691
 
692
692
  // src/utils/language-support.ts
693
693
  import fs2 from "node:fs";
694
694
  import { builtinModules } from "node:module";
695
- import path2 from "node:path";
696
695
  import * as v from "@vue/compiler-sfc";
697
696
  import color2 from "chalk";
698
697
  import { walk } from "estree-walker";
698
+ import path2 from "pathe";
699
699
  import * as sv from "svelte/compiler";
700
700
  import { Project } from "ts-morph";
701
701
  import validatePackageName from "validate-npm-package-name";
702
702
 
703
703
  // src/utils/package.ts
704
704
  import fs from "node:fs";
705
- import path from "node:path";
705
+ import path from "pathe";
706
706
  var findNearestPackageJson = (startDir, until) => {
707
707
  const packagePath = path.join(startDir, "package.json");
708
708
  if (fs.existsSync(packagePath)) return packagePath;
@@ -1200,7 +1200,7 @@ var getInstalled = (blocks, config, cwd) => {
1200
1200
 
1201
1201
  // src/utils/config.ts
1202
1202
  import fs5 from "node:fs";
1203
- import path5 from "node:path";
1203
+ import path5 from "pathe";
1204
1204
  import * as v4 from "valibot";
1205
1205
  var CONFIG_NAME = "jsrepo.json";
1206
1206
  var schema = v4.object({
@@ -1622,10 +1622,10 @@ ${content}`;
1622
1622
 
1623
1623
  // src/commands/build.ts
1624
1624
  import fs7 from "node:fs";
1625
- import path7 from "node:path";
1626
1625
  import { outro as outro2, spinner as spinner3 } from "@clack/prompts";
1627
1626
  import color8 from "chalk";
1628
1627
  import { Command as Command2 } from "commander";
1628
+ import path7 from "pathe";
1629
1629
  import * as v6 from "valibot";
1630
1630
  var schema3 = v6.object({
1631
1631
  dirs: v6.array(v6.string()),
@@ -1672,11 +1672,11 @@ var _build = async (options) => {
1672
1672
 
1673
1673
  // src/commands/diff.ts
1674
1674
  import fs8 from "node:fs";
1675
- import path8 from "node:path";
1676
1675
  import { cancel as cancel2, confirm as confirm2, isCancel as isCancel2, outro as outro3, spinner as spinner4 } from "@clack/prompts";
1677
1676
  import color10 from "chalk";
1678
1677
  import { Command as Command3, program as program3 } from "commander";
1679
1678
  import { diffLines } from "diff";
1679
+ import path8 from "pathe";
1680
1680
  import * as v7 from "valibot";
1681
1681
 
1682
1682
  // src/utils/diff.ts
@@ -1966,11 +1966,10 @@ ${remoteContent}`;
1966
1966
  const from = path8.join(
1967
1967
  `${providerInfo.name}/${providerInfo.owner}/${providerInfo.repoName}`,
1968
1968
  sourcePath
1969
- ).replaceAll("\\", "/");
1970
- const to = prettyLocalPath.replaceAll("\\", "/");
1969
+ );
1971
1970
  const formattedDiff = formatDiff({
1972
1971
  from,
1973
- to,
1972
+ to: prettyLocalPath,
1974
1973
  changes,
1975
1974
  expand: options.expand,
1976
1975
  maxUnchanged: options.maxUnchanged,
@@ -1979,11 +1978,11 @@ ${remoteContent}`;
1979
1978
  colorCharsAdded: color10.bgGreenBright,
1980
1979
  colorCharsRemoved: color10.bgRedBright,
1981
1980
  prefix: () => `${VERTICAL_LINE} `,
1982
- onUnchanged: ({ from: from2, to: to2, prefix }) => `${prefix?.() ?? ""}${color10.cyan(from2)} \u2192 ${color10.gray(to2)} ${color10.gray("(unchanged)")}
1981
+ onUnchanged: ({ from: from2, to, prefix }) => `${prefix?.() ?? ""}${color10.cyan(from2)} \u2192 ${color10.gray(to)} ${color10.gray("(unchanged)")}
1983
1982
  `,
1984
- intro: ({ from: from2, to: to2, changes: changes2, prefix }) => {
1983
+ intro: ({ from: from2, to, changes: changes2, prefix }) => {
1985
1984
  const totalChanges = changes2.filter((a) => a.added).length;
1986
- return `${prefix?.() ?? ""}${color10.cyan(from2)} \u2192 ${color10.gray(to2)} (${totalChanges} change${totalChanges === 1 ? "" : "s"})
1985
+ return `${prefix?.() ?? ""}${color10.cyan(from2)} \u2192 ${color10.gray(to)} (${totalChanges} change${totalChanges === 1 ? "" : "s"})
1987
1986
  ${prefix?.() ?? ""}
1988
1987
  `;
1989
1988
  }
@@ -2002,10 +2001,10 @@ ${prefix?.() ?? ""}
2002
2001
 
2003
2002
  // src/commands/init.ts
2004
2003
  import fs9 from "node:fs";
2005
- import path9 from "node:path";
2006
2004
  import { cancel as cancel3, confirm as confirm3, isCancel as isCancel3, outro as outro4, spinner as spinner5, text } from "@clack/prompts";
2007
2005
  import color11 from "chalk";
2008
2006
  import { Command as Command4 } from "commander";
2007
+ import path9 from "pathe";
2009
2008
  import * as v8 from "valibot";
2010
2009
  var schema5 = v8.object({
2011
2010
  path: v8.optional(v8.string()),
@@ -2088,13 +2087,13 @@ var _init = async (options) => {
2088
2087
 
2089
2088
  // src/commands/test.ts
2090
2089
  import fs10 from "node:fs";
2091
- import path10 from "node:path";
2092
2090
  import { cancel as cancel4, confirm as confirm4, isCancel as isCancel4, outro as outro5, spinner as spinner6 } from "@clack/prompts";
2093
2091
  import color12 from "chalk";
2094
2092
  import { Argument, Command as Command5, program as program4 } from "commander";
2095
2093
  import { execa as execa2 } from "execa";
2096
2094
  import { resolveCommand as resolveCommand3 } from "package-manager-detector/commands";
2097
2095
  import { detect as detect2 } from "package-manager-detector/detect";
2096
+ import path10 from "pathe";
2098
2097
  import { Project as Project2 } from "ts-morph";
2099
2098
  import * as v9 from "valibot";
2100
2099
  var schema6 = v9.object({
@@ -2344,13 +2343,13 @@ var _test = async (blockNames, options) => {
2344
2343
 
2345
2344
  // src/commands/update.ts
2346
2345
  import fs11 from "node:fs";
2347
- import path11 from "node:path";
2348
2346
  import { cancel as cancel5, confirm as confirm5, isCancel as isCancel5, multiselect as multiselect2, outro as outro6, spinner as spinner7 } from "@clack/prompts";
2349
2347
  import color13 from "chalk";
2350
2348
  import { Command as Command6, program as program5 } from "commander";
2351
2349
  import { diffLines as diffLines2 } from "diff";
2352
2350
  import { resolveCommand as resolveCommand4 } from "package-manager-detector/commands";
2353
2351
  import { detect as detect3 } from "package-manager-detector/detect";
2352
+ import path11 from "pathe";
2354
2353
  import * as v10 from "valibot";
2355
2354
  var schema7 = v10.object({
2356
2355
  all: v10.boolean(),
@@ -2507,8 +2506,8 @@ ${remoteContent}`;
2507
2506
  const from = path11.join(
2508
2507
  `${providerInfo.name}/${providerInfo.owner}/${providerInfo.repoName}`,
2509
2508
  file.fileName
2510
- ).replaceAll("\\", "/");
2511
- const to = path11.relative(options.cwd, file.destPath).replaceAll("\\", "/");
2509
+ );
2510
+ const to = path11.relative(options.cwd, file.destPath);
2512
2511
  const formattedDiff = formatDiff({
2513
2512
  from,
2514
2513
  to,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jsrepo",
3
3
  "description": "A CLI to add shared code from remote repositories.",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ieedan/jsrepo"
@@ -48,6 +48,7 @@
48
48
  "execa": "^9.5.1",
49
49
  "octokit": "^4.0.2",
50
50
  "package-manager-detector": "^0.2.4",
51
+ "pathe": "^1.1.2",
51
52
  "svelte": "^5.2.3",
52
53
  "ts-morph": "^24.0.0",
53
54
  "valibot": "^0.42.1",
@@ -1,10 +1,10 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { cancel, confirm, isCancel, multiselect, outro, spinner } from '@clack/prompts';
4
3
  import color from 'chalk';
5
4
  import { Command, program } from 'commander';
6
5
  import { resolveCommand } from 'package-manager-detector/commands';
7
6
  import { detect } from 'package-manager-detector/detect';
7
+ import path from 'pathe';
8
8
  import * as v from 'valibot';
9
9
  import { context } from '..';
10
10
  import * as ascii from '../utils/ascii';
@@ -1,8 +1,8 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { outro, spinner } from '@clack/prompts';
4
3
  import color from 'chalk';
5
4
  import { Command } from 'commander';
5
+ import path from 'pathe';
6
6
  import * as v from 'valibot';
7
7
  import { context } from '..';
8
8
  import { type Category, buildBlocksDirectory } from '../utils/build';
@@ -1,9 +1,9 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { cancel, confirm, isCancel, outro, spinner } from '@clack/prompts';
4
3
  import color from 'chalk';
5
4
  import { Command, program } from 'commander';
6
5
  import { diffLines } from 'diff';
6
+ import path from 'pathe';
7
7
  import * as v from 'valibot';
8
8
  import { context } from '..';
9
9
  import * as ascii from '../utils/ascii';
@@ -156,18 +156,14 @@ const _diff = async (options: Options) => {
156
156
 
157
157
  const changes = diffLines(fileContent, remoteContent);
158
158
 
159
- const from = path
160
- .join(
161
- `${providerInfo.name}/${providerInfo.owner}/${providerInfo.repoName}`,
162
- sourcePath
163
- )
164
- .replaceAll('\\', '/');
165
-
166
- const to = prettyLocalPath.replaceAll('\\', '/');
159
+ const from = path.join(
160
+ `${providerInfo.name}/${providerInfo.owner}/${providerInfo.repoName}`,
161
+ sourcePath
162
+ );
167
163
 
168
164
  const formattedDiff = formatDiff({
169
165
  from,
170
- to,
166
+ to: prettyLocalPath,
171
167
  changes,
172
168
  expand: options.expand,
173
169
  maxUnchanged: options.maxUnchanged,
@@ -1,8 +1,8 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { cancel, confirm, isCancel, outro, spinner, text } from '@clack/prompts';
4
3
  import color from 'chalk';
5
4
  import { Command } from 'commander';
5
+ import path from 'pathe';
6
6
  import * as v from 'valibot';
7
7
  import { context } from '..';
8
8
  import { CONFIG_NAME, type Config, getConfig } from '../utils/config';
@@ -1,11 +1,11 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { cancel, confirm, isCancel, outro, spinner } from '@clack/prompts';
4
3
  import color from 'chalk';
5
4
  import { Argument, Command, program } from 'commander';
6
5
  import { execa } from 'execa';
7
6
  import { resolveCommand } from 'package-manager-detector/commands';
8
7
  import { detect } from 'package-manager-detector/detect';
8
+ import path from 'pathe';
9
9
  import { Project } from 'ts-morph';
10
10
  import * as v from 'valibot';
11
11
  import { context } from '..';
@@ -1,11 +1,11 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { cancel, confirm, isCancel, multiselect, outro, spinner } from '@clack/prompts';
4
3
  import color from 'chalk';
5
4
  import { Command, program } from 'commander';
6
5
  import { diffLines } from 'diff';
7
6
  import { resolveCommand } from 'package-manager-detector/commands';
8
7
  import { detect } from 'package-manager-detector/detect';
8
+ import path from 'pathe';
9
9
  import * as v from 'valibot';
10
10
  import { context } from '..';
11
11
  import * as ascii from '../utils/ascii';
@@ -239,14 +239,12 @@ const _update = async (blockNames: string[], options: Options) => {
239
239
 
240
240
  const changes = diffLines(localContent, remoteContent);
241
241
 
242
- const from = path
243
- .join(
244
- `${providerInfo.name}/${providerInfo.owner}/${providerInfo.repoName}`,
245
- file.fileName
246
- )
247
- .replaceAll('\\', '/');
242
+ const from = path.join(
243
+ `${providerInfo.name}/${providerInfo.owner}/${providerInfo.repoName}`,
244
+ file.fileName
245
+ );
248
246
 
249
- const to = path.relative(options.cwd, file.destPath).replaceAll('\\', '/');
247
+ const to = path.relative(options.cwd, file.destPath);
250
248
 
251
249
  const formattedDiff = formatDiff({
252
250
  from,
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import { fileURLToPath } from 'node:url';
4
3
  import { program } from 'commander';
4
+ import path from 'pathe';
5
5
  import * as commands from './commands';
6
6
  import type { CLIContext } from './utils/context';
7
7
 
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import color from 'chalk';
3
+ import path from 'pathe';
4
4
  import { Err, Ok, type Result } from './blocks/types/result';
5
5
  import { mapToArray } from './blocks/utils/map-to-array';
6
6
  import type { Block } from './build';
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
  import color from 'chalk';
4
3
  import { program } from 'commander';
4
+ import path from 'pathe';
5
5
  import * as v from 'valibot';
6
6
  import * as ascii from './ascii';
7
7
  import { languages } from './language-support';
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
2
+ import path from 'pathe';
3
3
  import * as v from 'valibot';
4
4
  import { Err, Ok, type Result } from './blocks/types/result';
5
5
 
@@ -1,9 +1,9 @@
1
1
  import fs from 'node:fs';
2
2
  import { builtinModules } from 'node:module';
3
- import path from 'node:path';
4
3
  import * as v from '@vue/compiler-sfc';
5
4
  import color from 'chalk';
6
5
  import { walk } from 'estree-walker';
6
+ import path from 'pathe';
7
7
  import * as sv from 'svelte/compiler';
8
8
  import { Project } from 'ts-morph';
9
9
  import validatePackageName from 'validate-npm-package-name';
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
2
+ import path from 'pathe';
3
3
 
4
4
  const findNearestPackageJson = (startDir: string, until: string): string | undefined => {
5
5
  const packagePath = path.join(startDir, 'package.json');