@bscotch/config
Advanced tools
Comparing version 0.5.1 to 1.0.0
@@ -58,3 +58,3 @@ import { Pathy } from '@bscotch/pathy'; | ||
static inferType(version) { | ||
if (version.startsWith('file:')) { | ||
if (version.match(/^(file|workspace):/)) { | ||
return 'local'; | ||
@@ -61,0 +61,0 @@ } |
import { Pathy, PathyOrString } from '@bscotch/pathy'; | ||
import { ReleaseType } from 'semver'; | ||
import type { PackageJson as PackageJsonData } from 'type-fest'; | ||
import type { PackageJson as _PackageJsonData } from 'type-fest'; | ||
import { ConfigFile } from './configFile.js'; | ||
import { DependencyVersion } from './dependencyVersion.js'; | ||
import type { PackageJsonAddDependencyOptions, PackageJsonDependency, PackageJsonDependencyType, PackageJsonFindOptions, PackageJsonPruneDependencyOptions } from './packageJson.types.js'; | ||
import type { PackageJsonAddDependencyOptions, PackageJsonDependency, PackageJsonDependencyType, PackageJsonFindOptions, PackageJsonPruneDependencyOptions, PackageManager } from './packageJson.types.js'; | ||
import type { PackageNameConstructable } from './packageName.js'; | ||
import { PackageName } from './packageName.js'; | ||
export type { PackageJson as PackageJsonData } from 'type-fest'; | ||
export { PackageJsonAddDependencyOptions, PackageJsonDependency, PackageJsonDependencyType, PackageJsonFindOptions, PackageJsonPruneDependencyOptions, } from './packageJson.types.js'; | ||
export { PackageJsonAddDependencyOptions, PackageJsonDependency, PackageJsonDependencyType, PackageJsonFindOptions, PackageJsonPruneDependencyOptions, PackageManager, } from './packageJson.types.js'; | ||
export declare type PackageJsonData = _PackageJsonData & { | ||
packageManager?: `${PackageManager}@${string}`; | ||
}; | ||
export declare type PackageJsonExtended<Extension = undefined> = Extension extends undefined ? PackageJsonData : { | ||
@@ -52,2 +54,7 @@ [Key in keyof PackageJsonData | keyof Extension]?: Key extends keyof PackageJsonData ? PackageJsonData[Key] : Key extends keyof Extension ? Extension[Key] : never; | ||
}); | ||
/** | ||
* The name of the packageManager listed in | ||
* that field, if any. Defaults to 'pnpm'. | ||
*/ | ||
get packageManager(): PackageManager; | ||
get type(): 'module' | 'commonjs' | undefined; | ||
@@ -126,3 +133,2 @@ set type(moduleType: 'module' | 'commonjs' | undefined); | ||
get files(): string[]; | ||
build(args?: string[]): Promise<void>; | ||
test(args?: string[]): Promise<void>; | ||
@@ -230,4 +236,4 @@ publish(options?: { | ||
}; | ||
contributors: PackageJsonData.Person[]; | ||
maintainers: PackageJsonData.Person[]; | ||
contributors: _PackageJsonData.Person[]; | ||
maintainers: _PackageJsonData.Person[]; | ||
files: string[]; | ||
@@ -237,19 +243,19 @@ type: "module" | "commonjs"; | ||
exports: string | string[] | { | ||
[x: string & Record<never, never>]: PackageJsonData.Exports; | ||
browser: PackageJsonData.Exports; | ||
import: PackageJsonData.Exports; | ||
require: PackageJsonData.Exports; | ||
node: PackageJsonData.Exports; | ||
"node-addons": PackageJsonData.Exports; | ||
deno: PackageJsonData.Exports; | ||
electron: PackageJsonData.Exports; | ||
"react-native": PackageJsonData.Exports; | ||
default: PackageJsonData.Exports; | ||
[x: string & Record<never, never>]: _PackageJsonData.Exports; | ||
browser: _PackageJsonData.Exports; | ||
import: _PackageJsonData.Exports; | ||
require: _PackageJsonData.Exports; | ||
node: _PackageJsonData.Exports; | ||
"node-addons": _PackageJsonData.Exports; | ||
deno: _PackageJsonData.Exports; | ||
electron: _PackageJsonData.Exports; | ||
"react-native": _PackageJsonData.Exports; | ||
default: _PackageJsonData.Exports; | ||
} | { | ||
[key: string]: PackageJsonData.Exports; | ||
[key: string]: _PackageJsonData.Exports; | ||
} | null; | ||
imports: PackageJsonData.Imports; | ||
imports: _PackageJsonData.Imports; | ||
bin: string | Partial<Record<string, string>>; | ||
man: string | string[]; | ||
directories: PackageJsonData.DirectoryLocations; | ||
directories: _PackageJsonData.DirectoryLocations; | ||
repository: string | { | ||
@@ -260,3 +266,3 @@ type: string; | ||
}; | ||
scripts: PackageJsonData.Scripts; | ||
scripts: _PackageJsonData.Scripts; | ||
config: Record<string, unknown>; | ||
@@ -280,3 +286,3 @@ dependencies: Partial<Record<string, string>>; | ||
private: boolean; | ||
publishConfig: PackageJsonData.PublishConfig; | ||
publishConfig: _PackageJsonData.PublishConfig; | ||
funding: string | { | ||
@@ -297,6 +303,7 @@ type?: import("type-fest").LiteralUnion<"github" | "opencollective" | "patreon" | "individual" | "foundation" | "corporation", string> | undefined; | ||
typings: string; | ||
workspaces: string[] | PackageJsonData.WorkspaceConfig; | ||
workspaces: string[] | _PackageJsonData.WorkspaceConfig; | ||
flat: boolean; | ||
resolutions: Partial<Record<string, string>>; | ||
jspm: PackageJsonData; | ||
jspm: _PackageJsonData; | ||
packageManager: `npm@${string}` | `yarn@${string}` | `pnpm@${string}`; | ||
}>>; | ||
@@ -303,0 +310,0 @@ /** |
@@ -35,2 +35,10 @@ import { __decorate, __metadata } from "tslib"; | ||
} | ||
/** | ||
* The name of the packageManager listed in | ||
* that field, if any. Defaults to 'pnpm'. | ||
*/ | ||
get packageManager() { | ||
const pm = this.data.packageManager?.match(/^(p?npm|yarn)/)?.[1]; | ||
return pm || 'pnpm'; | ||
} | ||
get type() { | ||
@@ -129,10 +137,4 @@ return this.data.type; | ||
} | ||
async build(args = []) { | ||
await exec('npm', ['run', 'build', '--', ...args], { | ||
cwd: this.dir.absolute, | ||
shell: true, | ||
}); | ||
} | ||
async test(args = []) { | ||
await exec('npm', ['run', 'test', '--', ...args], { | ||
await exec(this.packageManager, ['run', 'test', ...args], { | ||
cwd: this.dir.absolute, | ||
@@ -152,3 +154,6 @@ shell: true, | ||
} | ||
await exec('npm', publishOptions, { cwd: this.dir.absolute, shell: true }); | ||
await exec(this.packageManager, publishOptions, { | ||
cwd: this.dir.absolute, | ||
shell: true, | ||
}); | ||
} | ||
@@ -307,4 +312,4 @@ /** | ||
const opts = { cwd: this.dir.absolute }; | ||
this.trace(`running %o: npm ${args.join(' ')}`, opts); | ||
await exec('npm', args, opts); | ||
this.trace(`running %o: ${this.packageManager} ${args.join(' ')}`, opts); | ||
await exec(this.packageManager, args, opts); | ||
} | ||
@@ -311,0 +316,0 @@ /** |
@@ -7,2 +7,3 @@ import type { Promisable } from 'type-fest'; | ||
export declare type PackageJsonDependencies = Pick<PackageJsonData, PackageJsonDependencyType>; | ||
export declare type PackageManager = 'npm' | 'yarn' | 'pnpm'; | ||
/** | ||
@@ -9,0 +10,0 @@ * Search options for finding a `package.json` |
{ | ||
"name": "@bscotch/config", | ||
"version": "0.5.1", | ||
"version": "1.0.0", | ||
"type": "module", | ||
@@ -19,5 +19,5 @@ "exports": { | ||
"dependencies": { | ||
"@bscotch/pathy": "^2.1.0", | ||
"@bscotch/utility": "^6.1.1", | ||
"@bscotch/validation": "^0.2.0", | ||
"@bscotch/pathy": "workspace:^", | ||
"@bscotch/utility": "workspace:^", | ||
"@bscotch/validation": "workspace:^", | ||
"chai": "^4.3.6", | ||
@@ -33,2 +33,4 @@ "globby": "^13.1.2", | ||
"devDependencies": { | ||
"@types/npm-packlist": "^3.0.0", | ||
"@types/semver": "^7.3.10", | ||
"typescript": "^4.8.0-beta" | ||
@@ -35,0 +37,0 @@ }, |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
149145
2359
1
3
+ Added@types/node@22.10.1(transitive)
+ Addedundici-types@6.20.0(transitive)
- Removed@bscotch/emitter@0.2.0(transitive)
- Removed@bscotch/pathy@2.12.1(transitive)
- Removed@bscotch/utility@6.8.47.2.0(transitive)
- Removed@bscotch/validation@0.2.5(transitive)
- Removed@types/node@22.9.3(transitive)
- Removedajv@8.12.0(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcamel-case@4.1.2(transitive)
- Removedcapital-case@1.0.4(transitive)
- Removedchalk@5.2.0(transitive)
- Removedchange-case@4.1.2(transitive)
- Removedconstant-case@3.0.4(transitive)
- Removeddebug@4.3.4(transitive)
- Removeddot-case@3.0.4(transitive)
- Removedeventemitter2@6.4.9(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfs-extra@11.1.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedheader-case@2.0.4(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removedlower-case@2.0.2(transitive)
- Removedms@2.1.2(transitive)
- Removedno-case@3.0.4(transitive)
- Removedparam-case@3.0.4(transitive)
- Removedpascal-case@3.1.2(transitive)
- Removedpath-case@3.0.4(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedsentence-case@3.0.4(transitive)
- Removedsnake-case@3.0.4(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedundici-types@6.19.8(transitive)
- Removeduniversalify@2.0.1(transitive)
- Removedupper-case@2.0.2(transitive)
- Removedupper-case-first@2.0.2(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedyaml@2.3.2(transitive)
Updated@bscotch/pathy@workspace:^
Updated@bscotch/utility@workspace:^