@settlemint/sdk-utils
Advanced tools
Comparing version 0.5.36 to 0.5.37-pr72454cd
@@ -32,2 +32,3 @@ import { z } from 'zod'; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
SETTLEMINT_NEW_PROJECT_NAME: z.ZodOptional<z.ZodString>; | ||
NEXTAUTH_URL: z.ZodString; | ||
@@ -65,2 +66,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY: z.ZodLiteral<"0x5e771e1417100000000000000000000000000001">; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
}, { | ||
@@ -95,2 +97,3 @@ SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
}>; | ||
@@ -124,2 +127,3 @@ type DotEnv = z.infer<typeof DotEnvSchema>; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_NEW_PROJECT_NAME: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
NEXTAUTH_URL: z.ZodOptional<z.ZodString>; | ||
@@ -154,2 +158,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY: z.ZodOptional<z.ZodLiteral<"0x5e771e1417100000000000000000000000000001">>; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
NEXTAUTH_URL?: string | undefined; | ||
@@ -184,2 +189,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY?: "0x5e771e1417100000000000000000000000000001" | undefined; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
NEXTAUTH_URL?: string | undefined; | ||
@@ -186,0 +192,0 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY?: "0x5e771e1417100000000000000000000000000001" | undefined; |
@@ -38,2 +38,3 @@ import { ZodString, z, ZodSchema } from 'zod'; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
SETTLEMINT_NEW_PROJECT_NAME: z.ZodOptional<z.ZodString>; | ||
NEXTAUTH_URL: z.ZodString; | ||
@@ -71,2 +72,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY: z.ZodLiteral<"0x5e771e1417100000000000000000000000000001">; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
}, { | ||
@@ -101,2 +103,3 @@ SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
}>; | ||
@@ -130,2 +133,3 @@ type DotEnv = z.infer<typeof DotEnvSchema>; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_NEW_PROJECT_NAME: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
NEXTAUTH_URL: z.ZodOptional<z.ZodString>; | ||
@@ -160,2 +164,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY: z.ZodOptional<z.ZodLiteral<"0x5e771e1417100000000000000000000000000001">>; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
NEXTAUTH_URL?: string | undefined; | ||
@@ -190,2 +195,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY?: "0x5e771e1417100000000000000000000000000001" | undefined; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
NEXTAUTH_URL?: string | undefined; | ||
@@ -257,2 +263,88 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY?: "0x5e771e1417100000000000000000000000000001" | undefined; | ||
/** | ||
* Array of available templates for project creation. | ||
*/ | ||
type Template = { | ||
value: string; | ||
label: string; | ||
}; | ||
declare const templates: Template[]; | ||
/** | ||
* Checks if the given project name is a valid package name. | ||
* | ||
* @param projectName - The project name to validate | ||
* @returns True if the project name is valid, false otherwise | ||
* | ||
* @example | ||
* ```typescript | ||
* const isValid = isValidPackageName("my-project"); | ||
* console.log(isValid); // true | ||
* ``` | ||
*/ | ||
declare function isValidPackageName(projectName: string): boolean; | ||
/** | ||
* Converts a project name to a valid package name. | ||
* | ||
* @param projectName - The project name to convert | ||
* @returns A valid package name | ||
* | ||
* @example | ||
* ```typescript | ||
* const validName = toValidPackageName("My Project Name"); | ||
* console.log(validName); // "my-project-name" | ||
* ``` | ||
*/ | ||
declare function toValidPackageName(projectName: string): string; | ||
/** | ||
* Formats the target directory string by trimming and removing trailing slashes. | ||
* | ||
* @param targetDir - The target directory path to format | ||
* @returns The formatted target directory path | ||
* | ||
* @example | ||
* ```typescript | ||
* const formattedDir = formatTargetDir("/path/to/directory/"); | ||
* console.log(formattedDir); // "/path/to/directory" | ||
* ``` | ||
*/ | ||
declare function formatTargetDir(targetDir: string): string; | ||
/** | ||
* Checks if a directory is empty (contains no files or only a .git directory). | ||
* | ||
* @param path - The path to check | ||
* @returns True if the directory is empty, false otherwise | ||
* | ||
* @example | ||
* ```typescript | ||
* const dirIsEmpty = isEmpty("/path/to/directory"); | ||
* console.log(dirIsEmpty); | ||
* ``` | ||
*/ | ||
declare function isEmpty(path: string): boolean; | ||
/** | ||
* Empties a directory by removing all its contents except for the .git directory. | ||
* | ||
* @param dir - The directory to empty | ||
* | ||
* @example | ||
* ```typescript | ||
* emptyDir("/path/to/directory"); | ||
* ``` | ||
*/ | ||
declare function emptyDir(dir: string): void; | ||
/** | ||
* Downloads and extracts an npm package template to the specified target directory. | ||
* | ||
* @param template - The template to download | ||
* @param targetDir - The directory to extract the template to | ||
* @returns A Promise that resolves when the download and extraction are complete | ||
* @throws Will throw an error if the download or extraction fails | ||
* | ||
* @example | ||
* ```typescript | ||
* await downloadAndExtractNpmPackage("asset-tokenization", "/path/to/project"); | ||
* ``` | ||
*/ | ||
declare function downloadAndExtractNpmPackage(template: Template["value"], targetDir: string): Promise<void>; | ||
declare function getPackageManager(targetDir: string): Promise<"yarn" | "pnpm" | "bun" | "npm">; | ||
@@ -262,4 +354,17 @@ | ||
/** | ||
* Sets the name field in the package.json file. | ||
* @param name - The new name to set in the package.json file. | ||
* @param path - Optional path to the project root. If not provided, it will be determined automatically. | ||
* @throws {Error} If there's an issue reading, updating, or saving the package.json file. | ||
* | ||
* @example | ||
* ```typescript | ||
* await setName("my-new-project-name"); | ||
* ``` | ||
*/ | ||
declare function setName(name: string, path?: string): Promise<void>; | ||
declare function ensureServer(): void; | ||
export { type AccessToken, AccessTokenSchema, type DotEnv, type DotEnvPartial, DotEnvSchema, DotEnvSchemaPartial, type Id, IdSchema, type Url, type UrlOrPath, UrlOrPathSchema, type UrlPath, UrlPathSchema, UrlSchema, ensureFolder, ensureServer, getPackageManager, installDependencies, loadEnv, projectRoot, validate, writeEnv }; | ||
export { type AccessToken, AccessTokenSchema, type DotEnv, type DotEnvPartial, DotEnvSchema, DotEnvSchemaPartial, type Id, IdSchema, type Template, type Url, type UrlOrPath, UrlOrPathSchema, type UrlPath, UrlPathSchema, UrlSchema, downloadAndExtractNpmPackage, emptyDir, ensureFolder, ensureServer, formatTargetDir, getPackageManager, installDependencies, isEmpty, isValidPackageName, loadEnv, projectRoot, setName, templates, toValidPackageName, validate, writeEnv }; |
@@ -0,1 +1,87 @@ | ||
/** | ||
* Array of available templates for project creation. | ||
*/ | ||
type Template = { | ||
value: string; | ||
label: string; | ||
}; | ||
declare const templates: Template[]; | ||
/** | ||
* Checks if the given project name is a valid package name. | ||
* | ||
* @param projectName - The project name to validate | ||
* @returns True if the project name is valid, false otherwise | ||
* | ||
* @example | ||
* ```typescript | ||
* const isValid = isValidPackageName("my-project"); | ||
* console.log(isValid); // true | ||
* ``` | ||
*/ | ||
declare function isValidPackageName(projectName: string): boolean; | ||
/** | ||
* Converts a project name to a valid package name. | ||
* | ||
* @param projectName - The project name to convert | ||
* @returns A valid package name | ||
* | ||
* @example | ||
* ```typescript | ||
* const validName = toValidPackageName("My Project Name"); | ||
* console.log(validName); // "my-project-name" | ||
* ``` | ||
*/ | ||
declare function toValidPackageName(projectName: string): string; | ||
/** | ||
* Formats the target directory string by trimming and removing trailing slashes. | ||
* | ||
* @param targetDir - The target directory path to format | ||
* @returns The formatted target directory path | ||
* | ||
* @example | ||
* ```typescript | ||
* const formattedDir = formatTargetDir("/path/to/directory/"); | ||
* console.log(formattedDir); // "/path/to/directory" | ||
* ``` | ||
*/ | ||
declare function formatTargetDir(targetDir: string): string; | ||
/** | ||
* Checks if a directory is empty (contains no files or only a .git directory). | ||
* | ||
* @param path - The path to check | ||
* @returns True if the directory is empty, false otherwise | ||
* | ||
* @example | ||
* ```typescript | ||
* const dirIsEmpty = isEmpty("/path/to/directory"); | ||
* console.log(dirIsEmpty); | ||
* ``` | ||
*/ | ||
declare function isEmpty(path: string): boolean; | ||
/** | ||
* Empties a directory by removing all its contents except for the .git directory. | ||
* | ||
* @param dir - The directory to empty | ||
* | ||
* @example | ||
* ```typescript | ||
* emptyDir("/path/to/directory"); | ||
* ``` | ||
*/ | ||
declare function emptyDir(dir: string): void; | ||
/** | ||
* Downloads and extracts an npm package template to the specified target directory. | ||
* | ||
* @param template - The template to download | ||
* @param targetDir - The directory to extract the template to | ||
* @returns A Promise that resolves when the download and extraction are complete | ||
* @throws Will throw an error if the download or extraction fails | ||
* | ||
* @example | ||
* ```typescript | ||
* await downloadAndExtractNpmPackage("asset-tokenization", "/path/to/project"); | ||
* ``` | ||
*/ | ||
declare function downloadAndExtractNpmPackage(template: Template["value"], targetDir: string): Promise<void>; | ||
declare function getPackageManager(targetDir: string): Promise<"yarn" | "pnpm" | "bun" | "npm">; | ||
@@ -5,2 +91,15 @@ | ||
export { getPackageManager, installDependencies }; | ||
/** | ||
* Sets the name field in the package.json file. | ||
* @param name - The new name to set in the package.json file. | ||
* @param path - Optional path to the project root. If not provided, it will be determined automatically. | ||
* @throws {Error} If there's an issue reading, updating, or saving the package.json file. | ||
* | ||
* @example | ||
* ```typescript | ||
* await setName("my-new-project-name"); | ||
* ``` | ||
*/ | ||
declare function setName(name: string, path?: string): Promise<void>; | ||
export { type Template, downloadAndExtractNpmPackage, emptyDir, formatTargetDir, getPackageManager, installDependencies, isEmpty, isValidPackageName, setName, templates, toValidPackageName }; |
@@ -38,2 +38,3 @@ import { ZodString, z, ZodSchema } from 'zod'; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
SETTLEMINT_NEW_PROJECT_NAME: z.ZodOptional<z.ZodString>; | ||
NEXTAUTH_URL: z.ZodString; | ||
@@ -71,2 +72,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY: z.ZodLiteral<"0x5e771e1417100000000000000000000000000001">; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
}, { | ||
@@ -101,2 +103,3 @@ SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
}>; | ||
@@ -130,2 +133,3 @@ type DotEnv = z.infer<typeof DotEnvSchema>; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_NEW_PROJECT_NAME: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
NEXTAUTH_URL: z.ZodOptional<z.ZodString>; | ||
@@ -160,2 +164,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY: z.ZodOptional<z.ZodLiteral<"0x5e771e1417100000000000000000000000000001">>; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
NEXTAUTH_URL?: string | undefined; | ||
@@ -190,2 +195,3 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY?: "0x5e771e1417100000000000000000000000000001" | undefined; | ||
SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT?: string | undefined; | ||
SETTLEMINT_NEW_PROJECT_NAME?: string | undefined; | ||
NEXTAUTH_URL?: string | undefined; | ||
@@ -192,0 +198,0 @@ SETTLEMINT_PREDEPLOYED_CONTRACT_ERC20_REGISTRY?: "0x5e771e1417100000000000000000000000000001" | undefined; |
{ | ||
"name": "@settlemint/sdk-utils", | ||
"description": "SettleMint SDK, integrate SettleMint into your application with ease.", | ||
"version": "0.5.36", | ||
"version": "0.5.37-pr72454cd", | ||
"type": "module", | ||
@@ -59,9 +59,13 @@ "private": false, | ||
}, | ||
"devDependencies": {}, | ||
"devDependencies": { | ||
"@types/npmcli__package-json": "^4" | ||
}, | ||
"dependencies": { | ||
"@antfu/install-pkg": "^0.4", | ||
"@dotenvx/dotenvx": "^1", | ||
"@npmcli/package-json": "^6", | ||
"deepmerge-ts": "^7", | ||
"environment": "^1", | ||
"find-up": "^7", | ||
"giget": "^1", | ||
"nano-spawn": "^0.1", | ||
@@ -68,0 +72,0 @@ "package-manager-detector": "^0.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
282179
2567
11
1
19
4
+ Added@npmcli/package-json@^6
+ Addedgiget@^1
+ Added@isaacs/cliui@8.0.2(transitive)
+ Added@npmcli/git@6.0.1(transitive)
+ Added@npmcli/package-json@6.1.0(transitive)
+ Added@npmcli/promise-spawn@8.0.2(transitive)
+ Added@pkgjs/parseargs@0.11.0(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedansi-regex@5.0.16.1.0(transitive)
+ Addedansi-styles@4.3.06.2.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedchownr@2.0.0(transitive)
+ Addedcitty@0.1.6(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedconfbox@0.1.8(transitive)
+ Addedconsola@3.4.0(transitive)
+ Addeddefu@6.1.4(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@8.0.09.2.2(transitive)
+ Addederr-code@2.0.3(transitive)
+ Addedexeca@8.0.1(transitive)
+ Addedforeground-child@3.3.0(transitive)
+ Addedfs-minipass@2.1.0(transitive)
+ Addedget-stream@8.0.1(transitive)
+ Addedgiget@1.2.3(transitive)
+ Addedglob@10.4.5(transitive)
+ Addedhosted-git-info@8.0.2(transitive)
+ Addedhuman-signals@5.0.0(transitive)
+ Addedini@5.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-stream@3.0.0(transitive)
+ Addedjackspeak@3.4.3(transitive)
+ Addedjson-parse-even-better-errors@4.0.0(transitive)
+ Addedlru-cache@10.4.3(transitive)
+ Addedmimic-fn@4.0.0(transitive)
+ Addedminimatch@9.0.5(transitive)
+ Addedminipass@3.3.65.0.07.1.2(transitive)
+ Addedminizlib@2.1.2(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedmlly@1.7.4(transitive)
+ Addednode-fetch-native@1.6.4(transitive)
+ Addednormalize-package-data@7.0.0(transitive)
+ Addednpm-install-checks@7.1.1(transitive)
+ Addednpm-normalize-package-bin@4.0.0(transitive)
+ Addednpm-package-arg@12.0.1(transitive)
+ Addednpm-pick-manifest@10.0.0(transitive)
+ Addednpm-run-path@5.3.0(transitive)
+ Addednypm@0.3.12(transitive)
+ Addedohash@1.1.4(transitive)
+ Addedonetime@6.0.0(transitive)
+ Addedpackage-json-from-dist@1.0.1(transitive)
+ Addedpath-key@4.0.0(transitive)
+ Addedpath-scurry@1.11.1(transitive)
+ Addedpathe@1.1.22.0.2(transitive)
+ Addedpkg-types@1.3.1(transitive)
+ Addedproc-log@5.0.0(transitive)
+ Addedpromise-inflight@1.0.1(transitive)
+ Addedpromise-retry@2.0.1(transitive)
+ Addedretry@0.12.0(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.21(transitive)
+ Addedstring-width@4.2.35.1.2(transitive)
+ Addedstrip-ansi@6.0.17.1.0(transitive)
+ Addedstrip-final-newline@3.0.0(transitive)
+ Addedtar@6.2.1(transitive)
+ Addedufo@1.5.4(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedvalidate-npm-package-name@6.0.0(transitive)
+ Addedwhich@5.0.0(transitive)
+ Addedwrap-ansi@7.0.08.1.0(transitive)
+ Addedyallist@4.0.0(transitive)