jsrepo 1.13.0 → 1.13.2
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/README.md +37 -1
- package/dist/index.js +13 -16
- package/package.json +22 -17
- package/bin.mjs +0 -2
- package/src/commands/add.ts +0 -546
- package/src/commands/auth.ts +0 -113
- package/src/commands/build.ts +0 -167
- package/src/commands/diff.ts +0 -198
- package/src/commands/index.ts +0 -9
- package/src/commands/init.ts +0 -431
- package/src/commands/test.ts +0 -361
- package/src/commands/update.ts +0 -459
- package/src/index.ts +0 -42
- package/src/utils/ascii.ts +0 -14
- package/src/utils/blocks/types/result.ts +0 -736
- package/src/utils/blocks/utils/array-sum.ts +0 -31
- package/src/utils/blocks/utils/lines.ts +0 -73
- package/src/utils/blocks/utils/map-to-array.ts +0 -32
- package/src/utils/blocks/utils/pad.ts +0 -85
- package/src/utils/blocks/utils/strip-ansi.ts +0 -25
- package/src/utils/blocks.ts +0 -128
- package/src/utils/build.ts +0 -273
- package/src/utils/config.ts +0 -40
- package/src/utils/context.ts +0 -19
- package/src/utils/dependencies.ts +0 -49
- package/src/utils/diff.ts +0 -249
- package/src/utils/format.ts +0 -35
- package/src/utils/get-watermark.ts +0 -7
- package/src/utils/git-providers.ts +0 -445
- package/src/utils/language-support.ts +0 -365
- package/src/utils/package.ts +0 -84
- package/src/utils/parse-package-name.ts +0 -33
- package/src/utils/persisted.ts +0 -7
- package/src/utils/prompts.ts +0 -76
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
[](https://jsrepo.dev)
|
|
2
|
+
|
|
1
3
|
# jsrepo
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
```bash
|
|
6
|
+
npx jsrepo init
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
CLI for [jsrepo](https://jsrepo.dev). Used to build and download code from registries that **YOU** own.
|
|
10
|
+
|
|
11
|
+
Kinda like [shadcn-ui](https://ui.shadcn.com/) but bring-your-own registry!
|
|
12
|
+
|
|
13
|
+
1. [Build your own registry](https://jsrepo.dev/docs/setup/registry)
|
|
14
|
+
2. [Download your blocks](https://jsrepo.dev/docs/setup/project)
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Usage: jsrepo [options] [command]
|
|
18
|
+
|
|
19
|
+
A CLI to add shared code from remote repositories.
|
|
20
|
+
|
|
21
|
+
Options:
|
|
22
|
+
-V, --version output the version number
|
|
23
|
+
-h, --help display help for command
|
|
24
|
+
|
|
25
|
+
Commands:
|
|
26
|
+
add [options] [blocks...]
|
|
27
|
+
auth [options] Provide a token for access to private repositories.
|
|
28
|
+
init [options] Initializes your project with a configuration file.
|
|
29
|
+
test [options] [blocks...] Tests local blocks against most recent remote tests.
|
|
30
|
+
build [options] Builds the provided --dirs in the project root into a `jsrepo-manifest.json` file.
|
|
31
|
+
update [options] [blocks...]
|
|
32
|
+
diff [options] Compares local blocks to the blocks in the provided repository.
|
|
33
|
+
help [command] display help for command
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Example registries
|
|
37
|
+
- [github/ieedan/std](https://github.com/ieedan/std)
|
|
38
|
+
- [gitlab/ieedan/std](https://gitlab.com/ieedan/std)
|
|
39
|
+
- [bitbucket/ieedan/std](https://bitbucket.org/ieedan/std)
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
1
3
|
// src/index.ts
|
|
2
4
|
import fs13 from "node:fs";
|
|
3
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -1245,13 +1247,9 @@ var github = {
|
|
|
1245
1247
|
const response = await fetch(url, { headers });
|
|
1246
1248
|
verbose?.(`Got a response from ${url} ${response.status} ${response.statusText}`);
|
|
1247
1249
|
if (!response.ok) {
|
|
1248
|
-
verbose?.("response not ok");
|
|
1249
1250
|
return rawErrorMessage(info, resourcePath, github.defaultBranch());
|
|
1250
1251
|
}
|
|
1251
|
-
|
|
1252
|
-
const text3 = await response.text();
|
|
1253
|
-
verbose?.("response.text() done.");
|
|
1254
|
-
return Ok(text3);
|
|
1252
|
+
return Ok(await response.text());
|
|
1255
1253
|
} catch (err) {
|
|
1256
1254
|
verbose?.(`erroring in response ${err} `);
|
|
1257
1255
|
return rawErrorMessage(info, resourcePath, github.defaultBranch());
|
|
@@ -1497,8 +1495,8 @@ var resolveTree = async (blockSpecifiers, blocksMap, repoPaths) => {
|
|
|
1497
1495
|
if (!block) {
|
|
1498
1496
|
return Err(`Invalid block! ${color5.bold(blockSpecifier)} does not exist!`);
|
|
1499
1497
|
}
|
|
1500
|
-
const
|
|
1501
|
-
blocks.set(
|
|
1498
|
+
const specifier = `${block.category}/${block.name}`;
|
|
1499
|
+
blocks.set(specifier, { name: block.name, subDependency: false, block });
|
|
1502
1500
|
if (block.localDependencies && block.localDependencies.length > 0) {
|
|
1503
1501
|
const subDeps = await resolveTree(
|
|
1504
1502
|
block.localDependencies.filter((dep) => !blocks.has(dep)),
|
|
@@ -1869,6 +1867,7 @@ var _add = async (blockNames, options) => {
|
|
|
1869
1867
|
});
|
|
1870
1868
|
for (const { block } of installingBlocks) {
|
|
1871
1869
|
const fullSpecifier = `${block.sourceRepo.url}/${block.category}/${block.name}`;
|
|
1870
|
+
const shortSpecifier = `${block.category}/${block.name}`;
|
|
1872
1871
|
const watermark = getWatermark(context.package.version, block.sourceRepo.url);
|
|
1873
1872
|
const providerInfo = block.sourceRepo;
|
|
1874
1873
|
verbose(`Setting up ${fullSpecifier}`);
|
|
@@ -1876,7 +1875,7 @@ var _add = async (blockNames, options) => {
|
|
|
1876
1875
|
const blockExists = !block.subdirectory && fs7.existsSync(path7.join(directory, block.files[0])) || block.subdirectory && fs7.existsSync(path7.join(directory, block.name));
|
|
1877
1876
|
if (blockExists && !options.yes) {
|
|
1878
1877
|
const result = await confirm({
|
|
1879
|
-
message: `${color8.
|
|
1878
|
+
message: `${color8.cyan(shortSpecifier)} already exists in your project would you like to overwrite it?`,
|
|
1880
1879
|
initialValue: false
|
|
1881
1880
|
});
|
|
1882
1881
|
if (isCancel(result) || !result) {
|
|
@@ -1896,14 +1895,12 @@ var _add = async (blockNames, options) => {
|
|
|
1896
1895
|
const content = await providerInfo.provider.fetchRaw(providerInfo, filePath, {
|
|
1897
1896
|
verbose
|
|
1898
1897
|
});
|
|
1899
|
-
verbose(`Came back with response content for ${color8.cyan(filePath)}`);
|
|
1900
1898
|
if (content.isErr()) {
|
|
1901
1899
|
loading.stop(color8.red(`Error fetching ${color8.bold(filePath)}`));
|
|
1902
1900
|
program2.error(
|
|
1903
1901
|
color8.red(`There was an error trying to get ${fullSpecifier}`)
|
|
1904
1902
|
);
|
|
1905
1903
|
}
|
|
1906
|
-
verbose(`Came back with success response content for ${color8.cyan(filePath)}`);
|
|
1907
1904
|
return content.unwrap();
|
|
1908
1905
|
};
|
|
1909
1906
|
for (const sourceFile of block.files) {
|
|
@@ -1917,10 +1914,9 @@ var _add = async (blockNames, options) => {
|
|
|
1917
1914
|
}
|
|
1918
1915
|
verbose(`Adding ${color8.bold(sourcePath)}`);
|
|
1919
1916
|
const content = await getSourceFile(sourcePath);
|
|
1920
|
-
verbose(`Setting up pathFolder for ${destPath}`);
|
|
1921
1917
|
const pathFolder = destPath.slice(0, destPath.length - sourceFile.length);
|
|
1922
1918
|
verbose(`Creating directory ${color8.bold(pathFolder)}`);
|
|
1923
|
-
fs7.mkdirSync(
|
|
1919
|
+
fs7.mkdirSync(pathFolder, {
|
|
1924
1920
|
recursive: true
|
|
1925
1921
|
});
|
|
1926
1922
|
verbose(`Created directory ${color8.bold(pathFolder)}`);
|
|
@@ -1948,12 +1944,12 @@ ${content}`;
|
|
|
1948
1944
|
verbose(`Writing to ${color8.bold(file.destPath)}`);
|
|
1949
1945
|
fs7.writeFileSync(file.destPath, content);
|
|
1950
1946
|
}
|
|
1951
|
-
if (config.includeTests) {
|
|
1947
|
+
if (config.includeTests && block.tests) {
|
|
1952
1948
|
verbose("Trying to include tests");
|
|
1953
1949
|
const { devDependencies } = JSON.parse(
|
|
1954
1950
|
fs7.readFileSync(path7.join(options.cwd, "package.json")).toString()
|
|
1955
1951
|
);
|
|
1956
|
-
if (devDependencies.vitest === void 0) {
|
|
1952
|
+
if (devDependencies === void 0 || devDependencies.vitest === void 0) {
|
|
1957
1953
|
devDeps.add("vitest");
|
|
1958
1954
|
}
|
|
1959
1955
|
}
|
|
@@ -3355,12 +3351,12 @@ ${prefix?.() ?? ""}
|
|
|
3355
3351
|
);
|
|
3356
3352
|
}
|
|
3357
3353
|
}
|
|
3358
|
-
if (config.includeTests) {
|
|
3354
|
+
if (config.includeTests && block.tests) {
|
|
3359
3355
|
verbose("Trying to include tests");
|
|
3360
3356
|
const { devDependencies } = JSON.parse(
|
|
3361
3357
|
fs12.readFileSync(path12.join(options.cwd, "package.json")).toString()
|
|
3362
3358
|
);
|
|
3363
|
-
if (devDependencies.vitest === void 0) {
|
|
3359
|
+
if (devDependencies === void 0 || devDependencies.vitest === void 0) {
|
|
3364
3360
|
devDeps.add("vitest");
|
|
3365
3361
|
}
|
|
3366
3362
|
}
|
|
@@ -3471,6 +3467,7 @@ var context = {
|
|
|
3471
3467
|
},
|
|
3472
3468
|
resolveRelativeToRoot
|
|
3473
3469
|
};
|
|
3470
|
+
console.clear();
|
|
3474
3471
|
program8.name(name).description(description).version(version).addCommand(add).addCommand(auth).addCommand(init).addCommand(test).addCommand(build).addCommand(update).addCommand(diff);
|
|
3475
3472
|
program8.parse();
|
|
3476
3473
|
export {
|
package/package.json
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsrepo",
|
|
3
3
|
"description": "A CLI to add shared code from remote repositories.",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://jsrepo.dev",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Aidan Bleser",
|
|
9
|
+
"url": "https://github.com/ieedan"
|
|
10
|
+
},
|
|
5
11
|
"repository": {
|
|
6
12
|
"type": "git",
|
|
7
13
|
"url": "git+https://github.com/ieedan/jsrepo"
|
|
8
14
|
},
|
|
9
|
-
"keywords": [
|
|
10
|
-
"repo",
|
|
11
|
-
"cli"
|
|
12
|
-
],
|
|
13
|
-
"author": "Aidan Bleser",
|
|
14
|
-
"license": "MIT",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/ieedan/jsrepo/issues"
|
|
17
17
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
"keywords": [
|
|
19
|
+
"repo",
|
|
20
|
+
"cli",
|
|
21
|
+
"svelte",
|
|
22
|
+
"vue",
|
|
23
|
+
"typescript",
|
|
24
|
+
"javascript",
|
|
25
|
+
"shadcn",
|
|
26
|
+
"registry"
|
|
27
|
+
],
|
|
21
28
|
"type": "module",
|
|
29
|
+
"exports": "./dist/index.js",
|
|
30
|
+
"bin": "./dist/index.js",
|
|
31
|
+
"main": "./dist/index.js",
|
|
22
32
|
"files": [
|
|
23
|
-
"bin.mjs",
|
|
24
|
-
"package.json",
|
|
25
|
-
"pnpm-lock.yaml",
|
|
26
|
-
"README.md",
|
|
27
33
|
"schema.json",
|
|
28
|
-
"dist
|
|
29
|
-
"src/**/*"
|
|
34
|
+
"dist"
|
|
30
35
|
],
|
|
31
36
|
"devDependencies": {
|
|
32
37
|
"@biomejs/biome": "1.9.4",
|
|
@@ -60,7 +65,7 @@
|
|
|
60
65
|
"validate-npm-package-name": "^6.0.0"
|
|
61
66
|
},
|
|
62
67
|
"scripts": {
|
|
63
|
-
"start": "tsup --silent && node
|
|
68
|
+
"start": "tsup --silent && node ./dist/index.js",
|
|
64
69
|
"build": "tsup",
|
|
65
70
|
"format": "biome format --write",
|
|
66
71
|
"lint": "biome lint --write",
|
package/bin.mjs
DELETED