@bscotch/project
Advanced tools
Comparing version 0.2.2 to 0.3.0
export * from './lib/project.js'; | ||
//# sourceMappingURL=index.d.ts.map |
export * from './lib/project.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -0,0 +0,0 @@ import { Pathy } from '@bscotch/pathy'; |
@@ -73,3 +73,3 @@ import { PackageJson } from '@bscotch/config'; | ||
if (projectInfo?.extendsTsconfigPath) { | ||
const relativePath = dir.relativePathTo(projectInfo.extendsTsconfigPath); | ||
const relativePath = dir.relativeTo(projectInfo.extendsTsconfigPath); | ||
entryTsconfig.extends = relativePath; | ||
@@ -76,0 +76,0 @@ } |
@@ -138,2 +138,9 @@ import { PackageJson, TsConfig, type DependencyVersion, type PackageJsonDependencyType, type PackageJsonFindOptions, type PackageName, type PackageNameConstructable } from '@bscotch/config'; | ||
allowUnusedLabels?: boolean | undefined; | ||
/** | ||
* Remove built files that don't have a corresponding | ||
* source file. Useful to ensure that tests | ||
* are only running against content from the source, | ||
* and that old files won't be accidentally | ||
* deployed. | ||
*/ | ||
noImplicitReturns?: boolean | undefined; | ||
@@ -163,8 +170,3 @@ noUncheckedIndexedAccess?: boolean | undefined; | ||
importHelpers?: boolean | undefined; | ||
importsNotUsedAsValues?: import("type-fest").TsConfigJson.CompilerOptions.ImportsNotUsedAsValues | undefined; /** | ||
* Move (rename) source files, with automatic | ||
* updates to import statements across the project. | ||
* | ||
* See {@link moveProjectFiles} | ||
*/ | ||
importsNotUsedAsValues?: import("type-fest").TsConfigJson.CompilerOptions.ImportsNotUsedAsValues | undefined; | ||
alwaysStrict?: boolean | undefined; | ||
@@ -171,0 +173,0 @@ strict?: boolean | undefined; |
@@ -0,0 +0,0 @@ import type { PackageJsonDependencyType, PackageNameConstructable } from '@bscotch/config'; |
@@ -27,3 +27,3 @@ import { PackageName } from '@bscotch/config'; | ||
if (usingImportHelpers) { | ||
project.updateDependencyListing('tslib', 'dependencies', options); | ||
await project.updateDependencyListing('tslib', 'dependencies', options); | ||
} | ||
@@ -133,3 +133,3 @@ await project.packageJson.pruneDependencies({ | ||
} | ||
const depType = depName.match(/^[./]/) | ||
const depType = depName.match(/^([./]|[$@~#]\/)/) | ||
? 'internal' | ||
@@ -191,4 +191,4 @@ : isNodeNativeModule(depName) | ||
normalized.srcFile = srcDir | ||
.join(outDir.relativePathTo(importer)) | ||
.relativePathFrom(project.dir); | ||
.join(outDir.relativeTo(importer)) | ||
.relativeFrom(project.dir); | ||
} | ||
@@ -198,4 +198,4 @@ else { | ||
normalized.outFile = outDir | ||
.join(srcDir.relativePathTo(importer)) | ||
.relativePathFrom(project.dir); | ||
.join(srcDir.relativeTo(importer)) | ||
.relativeFrom(project.dir); | ||
} | ||
@@ -202,0 +202,0 @@ return normalized; |
@@ -0,0 +0,0 @@ import { Pathy } from '@bscotch/pathy'; |
@@ -170,3 +170,3 @@ import { Pathy } from '@bscotch/pathy'; | ||
cwd: newProjectDir, | ||
}).relativePathFrom(newProjectSrcDir); | ||
}).relativeFrom(newProjectSrcDir); | ||
return `export * from './${normalizeExtension(relativePath, 'js')}';`; | ||
@@ -173,0 +173,0 @@ }) |
@@ -0,0 +0,0 @@ import type { Project, ProjectFixOptions } from './project.js'; |
@@ -11,3 +11,3 @@ import { Pathy } from '@bscotch/pathy'; | ||
export async function fixProjectSourceFiles(project, options) { | ||
const pkgJsonFixWait = options.populatePackageJson && project.updateDependencyListings(); | ||
const pkgJsonFixWait = options.packageJson && project.updateDependencyListings(); | ||
const morpher = await project.codeMorpher(); | ||
@@ -24,3 +24,3 @@ for (let sourceFile of morpher.getSourceFiles()) { | ||
} | ||
if (options.resolvePartialImportPaths) { | ||
if (options.importPaths) { | ||
// Identify all internal imports -- | ||
@@ -27,0 +27,0 @@ // are their paths fully resolved, with |
@@ -0,0 +0,0 @@ import { DepGraph } from 'dependency-graph'; |
@@ -0,0 +0,0 @@ import { DepGraph } from 'dependency-graph'; |
@@ -110,3 +110,3 @@ var Project_1; | ||
onInclude(path) { | ||
const normalized = normalizeExtension(path.relativePathFrom(srcDir), 'js'); | ||
const normalized = normalizeExtension(path.relativeFrom(srcDir), 'js'); | ||
srcFiles.add(normalized); | ||
@@ -117,3 +117,3 @@ }, | ||
async onInclude(path) { | ||
const normalized = normalizeExtension(path.relativePathFrom(outDir), 'js'); | ||
const normalized = normalizeExtension(path.relativeFrom(outDir), 'js'); | ||
if (!srcFiles.has(normalized)) { | ||
@@ -217,14 +217,11 @@ await path.delete(); | ||
async clean() { | ||
const deleteWaits = []; | ||
const outDir = await this.outDir(); | ||
const deletedMiscellany = this.dir.listChildrenRecursively({ | ||
includePatterns: [/\.tsbuildinfo$/], | ||
transform(path) { | ||
return path.delete(); | ||
onInclude(path) { | ||
deleteWaits.push(path.delete()); | ||
}, | ||
}); | ||
const deleteWaits = [ | ||
deletedMiscellany, | ||
outDir.delete({ recursive: true }), | ||
this.dir.join('.turbo').delete({ recursive: true }), | ||
]; | ||
deleteWaits.push(deletedMiscellany, outDir.delete({ recursive: true }), this.dir.join('.turbo').delete({ recursive: true })); | ||
await Promise.all(deleteWaits); | ||
@@ -231,0 +228,0 @@ } |
@@ -0,0 +0,0 @@ import type { Project } from './project.js'; |
@@ -0,0 +0,0 @@ import { ok } from 'assert'; |
@@ -0,0 +0,0 @@ import { JsonSchema } from '@bscotch/validation'; |
@@ -78,3 +78,3 @@ import { merge } from '@bscotch/utility'; | ||
}, | ||
resolvePartialImportPaths: { | ||
importPaths: { | ||
type: 'boolean', | ||
@@ -85,3 +85,3 @@ }, | ||
}, | ||
populatePackageJson: { | ||
packageJson: { | ||
type: 'boolean', | ||
@@ -88,0 +88,0 @@ }, |
@@ -0,0 +0,0 @@ import { MochaOptions } from 'mocha'; |
@@ -0,0 +0,0 @@ import { Pathy } from '@bscotch/pathy'; |
@@ -130,3 +130,3 @@ import type { PackageJson, PackageJsonData } from '@bscotch/config'; | ||
addMissingImports?: boolean; | ||
resolvePartialImportPaths?: boolean; | ||
importPaths?: boolean; | ||
organizeImports?: boolean; | ||
@@ -138,3 +138,3 @@ /** | ||
*/ | ||
populatePackageJson?: boolean; | ||
packageJson?: boolean; | ||
/** | ||
@@ -141,0 +141,0 @@ * If true, files with infixes (e.g. `file.infix.ts`) are only allowed to be imported by files with the same pre-infix basename (e.g. `file.test.ts` can import `file.ts` or `file.infix.ts`, and `otherfile.ts` can import from `file.ts` but not `file.infix.ts`). This helps to keep clean APIs while allowing automation of file management. |
export {}; | ||
//# sourceMappingURL=project.types.js.map |
@@ -0,0 +0,0 @@ import { default as Mocha, Runner } from 'mocha'; |
@@ -0,0 +0,0 @@ import { gray, red } from '@bscotch/validation'; |
{ | ||
"name": "@bscotch/project", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"type": "module", | ||
@@ -19,4 +19,4 @@ "exports": { | ||
"dependencies": { | ||
"@bscotch/config": "^0.3.1", | ||
"@bscotch/pathy": "^0.3.0", | ||
"@bscotch/config": "^0.3.2", | ||
"@bscotch/pathy": "^0.3.1", | ||
"@bscotch/utility": "^5.0.0", | ||
@@ -37,4 +37,4 @@ "@bscotch/validation": "^0.2.0", | ||
"publishConfig": { | ||
"access": "restricted" | ||
"access": "public" | ||
} | ||
} |
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
134303
2200
Updated@bscotch/config@^0.3.2
Updated@bscotch/pathy@^0.3.1