@good-fences/api
Advanced tools
Comparing version 0.17.0 to 0.18.0
{ | ||
"recommendations": [ | ||
"rust-lang.rust-analyzer", | ||
"vadimcn.vscode-lldb", | ||
"ms-vscode-remote.remote-containers", | ||
"tamasfe.even-better-toml", | ||
"ms-vscode.cpptools" | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} |
{ | ||
"rust-analyzer.checkOnSave": true, | ||
"terminal.integrated.defaultProfile.linux": "fish", | ||
"terminal.integrated.allowChords": false, | ||
"terminal.integrated.shellIntegration.decorationsEnabled": "never", | ||
"terminal.integrated.shellIntegration.enabled": false, | ||
"editor.formatOnSave": true, | ||
"files.autoSaveWorkspaceFilesOnly": true, | ||
"rust-analyzer.cargo.targetDir": "./rust-analyzer-target", | ||
// only for using on codespaces, not for use in devcontainer | ||
// "rust-analyzer.server.path": "/home/vscode/.cargo/bin/rust-analyzer", | ||
// "rust-analyzer.runnables.command": "/home/vscode/.cargo/bin/cargo", | ||
// "lldb.cargo": "/home/vscode/.cargo/bin/cargo", | ||
"lldb.launch.initCommands": [ | ||
// Load custom formatters | ||
"command source '${workspaceFolder}/lldb/custom-formatters.lldb'", | ||
// disable ASLR | ||
"settings set target.disable-aslr true", | ||
], | ||
"rust-analyzer.check.command": "clippy", | ||
// runs rust-analyzer against a separate target directory than the normal rust compiler. | ||
// this is a workaround for the following issue: https://github.com/rust-lang/rust-analyzer/issues/17482 | ||
"rust-analyzer.cargo.targetDir": "./rust-analyzer-target", | ||
// prefer using GDB over lldb because lldb's debug visualizations are worse. | ||
// See https://github.com/rust-lang/rust/issues/111868 | ||
"rust-analyzer.debug.engine": "ms-vscode.cpptools", | ||
"rust-analyzer.debug.engineSettings": { | ||
"cppdbg": { | ||
"miDebuggerPath": "${env:HOME}/.cargo/bin/rust-gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": false | ||
} | ||
], | ||
"lldb": { | ||
"launch": { | ||
"terminal": "external", | ||
"initCommands": [ | ||
// Load custom formatters | ||
"command source '${workspaceFolder}/lldb/custom-formatters.lldb'", | ||
// disable ASLR | ||
"settings set target.disable-aslr true", | ||
] | ||
}, | ||
} | ||
}, | ||
"editor.formatOnSave": true, | ||
"files.autoSaveWorkspaceFilesOnly": true, | ||
"lldb.cargo": "/home/ubuntu/.cargo/bin/cargo", | ||
"terminal.integrated.shellIntegration.decorationsEnabled": "never", | ||
// Disabled because napi's macro design requires aggregating macro state | ||
// over multiple invocations, but rust-analyzer lazily expands macros as-needed. | ||
// | ||
// This is a bug in napi which they won't fix. (It looks like the original author | ||
// of napi didn't even write the derive macro?) | ||
// | ||
// See: https://github.com/napi-rs/napi-rs/issues/2322 | ||
"rust-analyzer.procMacro.ignored": { | ||
"napi-derive": [ | ||
"napi" | ||
] | ||
} | ||
} |
@@ -5,6 +5,67 @@ { | ||
{ | ||
"date": "Wed, 02 Oct 2024 18:13:38 GMT", | ||
"date": "Thu, 14 Nov 2024 16:54:38 GMT", | ||
"version": "0.18.0", | ||
"tag": "@good-fences/api_v0.18.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "9b19dd7721cf74f69ed05d080c278b3001cf6d0a", | ||
"comment": "Add support for usage from test files" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "f2ee1e7123d1895a7370eed524c507253687f981", | ||
"comment": "unused_finder: return tagged symbols" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "6bddb68fff2115ac17e9beb797a28313be85ba65", | ||
"comment": "Expose a jsonschema file for the unused finder config" | ||
} | ||
], | ||
"none": [ | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "a0f4bdcad9e242364f603aebaf3a649599d38d25", | ||
"comment": "Add mergiraf as default merge driver, difft as default diff visualizer" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "6bddb68fff2115ac17e9beb797a28313be85ba65", | ||
"comment": "enforce jsonschema for unused-config.json" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 07 Nov 2024 18:37:07 GMT", | ||
"version": "0.17.0", | ||
"tag": "@good-fences/api_v0.17.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "68997073fcc7bb63d4bdf2c10b6754e70fd41ed8", | ||
"comment": "unused_finder: permit type-only exports" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "49048a64ec7ca5c2e1aa0a610fde1e8de5227cd2", | ||
"comment": "Rebuild graph traversal for better maintainability, recursive ignore tracking" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "4e61efede5b51f6e2dc43de9662244794aca3bc5", | ||
"comment": "Setup devcontainer, add 'exports' aware cacing resolver" | ||
} | ||
], | ||
"patch": [ | ||
@@ -14,2 +75,8 @@ { | ||
"package": "@good-fences/api", | ||
"commit": "719690f504a2e0c7cc9cd80993a89a9090efaf62", | ||
"comment": "unittest.yml: remove redundant repo clone in health checks" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "da4a089e6b6f33da5d04845c4f609b00bc3bfbc7", | ||
@@ -19,14 +86,60 @@ "comment": "partial refactor of unused_finder to move parsing-related utilities to a submodule" | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "77b740daf52e23cda2cd8077534ca64d0e2fcab7", | ||
"comment": "add CODEOWNERS file" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "b6e99886620d2431fe7245c7ab72cbcc33a30679", | ||
"comment": "run npm pkg fix" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "9145d9795d57655d46b28a7a8fbb5136460d414c", | ||
"comment": "remove unused armv7-unknown-linux-gnueabihf from publish pipeline" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "d561e55cb8bc1abd86addabf85a55ddeda534a65", | ||
"comment": "extract packagejson from import_resolver" | ||
} | ||
], | ||
"minor": [ | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "b327d6ecbfd996464ebd4a6399748c07505b95f8", | ||
"comment": "update scripts/pre-pr.sh to run beachball" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "922ddcdc319f87776fc493fc55017e8e4cdb1500", | ||
"comment": "ahashmap+test_tmpdir: add amap2 for creating AHashMap with non-String keys" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "4e61efede5b51f6e2dc43de9662244794aca3bc5", | ||
"comment": "Setup devcontainer, add 'exports' aware cacing resolver" | ||
"commit": "a6214443df271840bc69672035c27f6f5c3e5cc6", | ||
"comment": "reduce compilation times by breaking up swc_utils" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "9be2200d76d66691f40c06af5f3567807c2cf7b0", | ||
"comment": "cancel old CI jobs when new PR revisions are pushed" | ||
}, | ||
{ | ||
"author": "mhuan13@gmail.com", | ||
"package": "@good-fences/api", | ||
"commit": "a8fbf511a6c28eeb6d99753dc36b5e7af40794d1", | ||
"comment": "support heterogenous export maps in packagejson files" | ||
}, | ||
{ | ||
"author": "Maxwell.HuangHobbs@microsoft.com", | ||
"package": "@good-fences/api", | ||
"commit": "692ef269162ad58d5600ea604f793731d7b7bea3", | ||
"comment": "Add internal utility to check if a file is exported from a package" | ||
} | ||
@@ -33,0 +146,0 @@ ] |
# Change Log - @good-fences/api | ||
This log was last generated on Wed, 02 Oct 2024 18:13:38 GMT and should not be manually modified. | ||
This log was last generated on Thu, 14 Nov 2024 16:54:38 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.18.0 | ||
Thu, 14 Nov 2024 16:54:38 GMT | ||
### Minor changes | ||
- Add support for usage from test files (mhuan13@gmail.com) | ||
- unused_finder: return tagged symbols (mhuan13@gmail.com) | ||
- Expose a jsonschema file for the unused finder config (mhuan13@gmail.com) | ||
## 0.17.0 | ||
Wed, 02 Oct 2024 18:13:38 GMT | ||
Thu, 07 Nov 2024 18:37:07 GMT | ||
### Minor changes | ||
- unused_finder: permit type-only exports (Maxwell.HuangHobbs@microsoft.com) | ||
- Rebuild graph traversal for better maintainability, recursive ignore tracking (mhuan13@gmail.com) | ||
- Setup devcontainer, add 'exports' aware cacing resolver (mhuan13@gmail.com) | ||
@@ -17,4 +29,14 @@ | ||
- unittest.yml: remove redundant repo clone in health checks (Maxwell.HuangHobbs@microsoft.com) | ||
- partial refactor of unused_finder to move parsing-related utilities to a submodule (Maxwell.HuangHobbs@microsoft.com) | ||
- add CODEOWNERS file (mhuan13@gmail.com) | ||
- run npm pkg fix (Maxwell.HuangHobbs@microsoft.com) | ||
- remove unused armv7-unknown-linux-gnueabihf from publish pipeline (mhuan13@gmail.com) | ||
- extract packagejson from import_resolver (Maxwell.HuangHobbs@microsoft.com) | ||
- update scripts/pre-pr.sh to run beachball (Maxwell.HuangHobbs@microsoft.com) | ||
- ahashmap+test_tmpdir: add amap2 for creating AHashMap with non-String keys (Maxwell.HuangHobbs@microsoft.com) | ||
- reduce compilation times by breaking up swc_utils (mhuan13@gmail.com) | ||
- cancel old CI jobs when new PR revisions are pushed (Maxwell.HuangHobbs@microsoft.com) | ||
- support heterogenous export maps in packagejson files (mhuan13@gmail.com) | ||
- Add internal utility to check if a file is exported from a package (Maxwell.HuangHobbs@microsoft.com) | ||
@@ -21,0 +43,0 @@ ## 0.16.0 |
#! /usr/bin/env node | ||
// @ts-check | ||
@@ -10,10 +11,10 @@ /** | ||
program | ||
.option('-p, --project <string> ', 'tsconfig.json file path, defaults to `./tsconfig.json`', './tsconfig.paths.json') | ||
.option('-o, --output <string>', 'path to write found violations') | ||
.option('--baseUrl <string>', "Overrides `compilerOptions.baseUrl` property read from '--project' argument", '.') | ||
.option('--ignoreExternalFences', 'Ignore external fences (e.g. those in `node_modules`)', false) | ||
.option('--ignoredDirs [pathRegexs...]', 'Directories matching given regular expressions are excluded from fence evaluation (e.g. `--ignoreDirs lib` will not evaluate source files in all dirs named `lib`', []) | ||
.arguments('<path> [morePaths...]', 'Dirs to look for fence and source files') | ||
.option('-p, --project <string> ', 'tsconfig.json file path, defaults to `./tsconfig.json`', './tsconfig.paths.json') | ||
.option('-o, --output <string>', 'path to write found violations') | ||
.option('--baseUrl <string>', "Overrides `compilerOptions.baseUrl` property read from '--project' argument", '.') | ||
.option('--ignoreExternalFences', 'Ignore external fences (e.g. those in `node_modules`)', false) | ||
.option('--ignoredDirs [pathRegexs...]', 'Directories matching given regular expressions are excluded from fence evaluation (e.g. `--ignoreDirs lib` will not evaluate source files in all dirs named `lib`', []) | ||
.arguments('<path> [morePaths...]') | ||
program.parse(process.argv); | ||
@@ -20,0 +21,0 @@ |
123
index.d.ts
@@ -6,13 +6,64 @@ /* tslint:disable */ | ||
export interface FindUnusedItemsConfig { | ||
reportExportedItems: boolean | ||
/** | ||
* A JSON serializable proxy for the UnusedFinderConfig struct | ||
* | ||
* This struct is used to deserialize the UnusedFinderConfig struct | ||
* from a config file to with serde / over the debug bridge for napi | ||
*/ | ||
export interface UnusedFinderJsonConfig { | ||
/** Path to the root directory of the repository. */ | ||
repoRoot: string | ||
/** | ||
* Root paths to walk as source files | ||
* | ||
* These can be either absolute paths, or paths relative to the repo root | ||
*/ | ||
rootPaths: Array<string> | ||
tsConfigPath: string | ||
skippedDirs: Array<string> | ||
skippedItems: Array<string> | ||
filesIgnoredImports: Array<string> | ||
filesIgnoredExports: Array<string> | ||
/** | ||
* A List of globs. | ||
* Matching files and directories won't be scanned during the file walk | ||
* | ||
* Matches are made against the names of the individual directories, | ||
* NOT the full directory paths | ||
*/ | ||
skip: Array<string> | ||
/** If true, individual exported symbols are also tracked */ | ||
reportExportedSymbols: boolean | ||
allowUnusedTypes: boolean | ||
/** | ||
* List of packages that should be considered "entry" packages | ||
* All transitive imports from the exposed exports of these packages | ||
* will be considered used | ||
* | ||
* Items are parsed in one of three ways: | ||
* 1. If the item starts with "./", it is treated as a path glob, and evaluated against the paths of package folders, relative to the repo root. | ||
* 2. If the item contains any of "~)('!*", it is treated as a name-glob, and evaluated as a glob against the names of packages. | ||
* 3. Otherwise, the item is treated as the name of an individual package, and matched literally. | ||
*/ | ||
entryPackages: Array<string> | ||
/** | ||
* List of globs that will be matched against files in the repository | ||
* | ||
* Matches are made against the relative file paths from the repo root. | ||
* A matching file will be tagged as a "test" file, and will be excluded | ||
* from the list of unused files | ||
*/ | ||
testFilePatterns: Array<string> | ||
/** | ||
* List of glob patterns to mark as "tests". | ||
* These files will be marked as used, and all of their transitive | ||
* dependencies will also be marked as used | ||
* | ||
* glob patterns are matched against the relative file path from the | ||
* root of the repository | ||
*/ | ||
testFiles?: Array<string> | ||
} | ||
export interface ExportedItemReport { | ||
export const enum UsedTagEnum { | ||
Entry = 'Entry', | ||
Ignored = 'Ignored', | ||
TypeOnly = 'TypeOnly', | ||
Test = 'Test' | ||
} | ||
export interface SymbolReport { | ||
id: string | ||
@@ -22,11 +73,7 @@ start: number | ||
} | ||
export interface UnusedFinderReport { | ||
unusedFiles: Array<string> | ||
unusedFilesItems: Record<string, Array<ExportedItemReport>> | ||
export interface SymbolReportWithTags { | ||
symbol: SymbolReport | ||
tags: Array<UsedTagEnum> | ||
} | ||
export const enum ExternalFences { | ||
Include = 0, | ||
Ignore = 1 | ||
} | ||
export declare function goodFences(opts: GoodFencesOptions): Array<GoodFencesResult> | ||
export declare function findUnusedItems(console: object, config: UnusedFinderJsonConfig): UnusedFinderReport | ||
export interface GoodFencesOptions { | ||
@@ -40,29 +87,7 @@ paths: Array<string> | ||
} | ||
export const enum GoodFencesResultType { | ||
FileNotResolved = 0, | ||
Violation = 1 | ||
export const enum ExternalFences { | ||
Include = 0, | ||
Ignore = 1 | ||
} | ||
/** | ||
* Members of the node-facing API are kept in | ||
* this separate module so that the remainder of | ||
* the crate can be compiled into a test binary | ||
* | ||
* References to symbols from the node api require | ||
* linking to a real instance of node, which means that | ||
* `cargo test` can't link anything | ||
*/ | ||
export declare function findUnusedItems(config: FindUnusedItemsConfig): UnusedFinderReport | ||
export declare function findUnusedItemsForOpenFiles(config: FindUnusedItemsConfig, files: Array<string>): UnusedFinderReport | ||
export type JsUnusedFinder = UnusedFinder | ||
/** | ||
* Provides a napi wrapper for the UnusedFinder, which plumbs | ||
* the UnusedFinder's functionality to JavaScript. | ||
*/ | ||
export class UnusedFinder { | ||
constructor(config: FindUnusedItemsConfig) | ||
refreshFileList(): void | ||
findUnusedItems(filesToCheck: Array<string>): UnusedFinderReport | ||
findAllUnusedItems(): UnusedFinderReport | ||
} | ||
export class GoodFencesResult { | ||
export interface GoodFencesResult { | ||
resultType: GoodFencesResultType | ||
@@ -75,1 +100,15 @@ message: string | ||
} | ||
export const enum GoodFencesResultType { | ||
FileNotResolved = 0, | ||
Violation = 1 | ||
} | ||
export declare function goodFences(opts: GoodFencesOptions): Array<GoodFencesResult> | ||
export declare class UnusedFinderReport { | ||
unusedFiles: Array<string> | ||
unusedSymbols: Record<string, Array<SymbolReport>> | ||
extraFileTags: Record<string, Array<UsedTagEnum>> | ||
extraSymbolTags: Record<string, Array<SymbolReportWithTags>> | ||
} | ||
export declare class UnusedFinder { | ||
constructor(console: object, config: UnusedFinderJsonConfig) | ||
} |
74
index.js
@@ -227,10 +227,68 @@ /* tslint:disable */ | ||
case 'arm': | ||
if (isMusl()) { | ||
localFileExisted = existsSync( | ||
join(__dirname, '@good-fences.linux-arm-musleabihf.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./@good-fences.linux-arm-musleabihf.node') | ||
} else { | ||
nativeBinding = require('@good-fences/api-linux-arm-musleabihf') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} else { | ||
localFileExisted = existsSync( | ||
join(__dirname, '@good-fences.linux-arm-gnueabihf.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./@good-fences.linux-arm-gnueabihf.node') | ||
} else { | ||
nativeBinding = require('@good-fences/api-linux-arm-gnueabihf') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} | ||
break | ||
case 'riscv64': | ||
if (isMusl()) { | ||
localFileExisted = existsSync( | ||
join(__dirname, '@good-fences.linux-riscv64-musl.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./@good-fences.linux-riscv64-musl.node') | ||
} else { | ||
nativeBinding = require('@good-fences/api-linux-riscv64-musl') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} else { | ||
localFileExisted = existsSync( | ||
join(__dirname, '@good-fences.linux-riscv64-gnu.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./@good-fences.linux-riscv64-gnu.node') | ||
} else { | ||
nativeBinding = require('@good-fences/api-linux-riscv64-gnu') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} | ||
break | ||
case 's390x': | ||
localFileExisted = existsSync( | ||
join(__dirname, '@good-fences.linux-arm-gnueabihf.node') | ||
join(__dirname, '@good-fences.linux-s390x-gnu.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./@good-fences.linux-arm-gnueabihf.node') | ||
nativeBinding = require('./@good-fences.linux-s390x-gnu.node') | ||
} else { | ||
nativeBinding = require('@good-fences/api-linux-arm-gnueabihf') | ||
nativeBinding = require('@good-fences/api-linux-s390x-gnu') | ||
} | ||
@@ -256,10 +314,10 @@ } catch (e) { | ||
const { UnusedFinder, ExternalFences, goodFences, GoodFencesResultType, GoodFencesResult, findUnusedItems, findUnusedItemsForOpenFiles } = nativeBinding | ||
const { UsedTagEnum, UnusedFinderReport, UnusedFinder, findUnusedItems, ExternalFences, GoodFencesResultType, goodFences } = nativeBinding | ||
module.exports.UsedTagEnum = UsedTagEnum | ||
module.exports.UnusedFinderReport = UnusedFinderReport | ||
module.exports.UnusedFinder = UnusedFinder | ||
module.exports.findUnusedItems = findUnusedItems | ||
module.exports.ExternalFences = ExternalFences | ||
module.exports.GoodFencesResultType = GoodFencesResultType | ||
module.exports.goodFences = goodFences | ||
module.exports.GoodFencesResultType = GoodFencesResultType | ||
module.exports.GoodFencesResult = GoodFencesResult | ||
module.exports.findUnusedItems = findUnusedItems | ||
module.exports.findUnusedItemsForOpenFiles = findUnusedItemsForOpenFiles |
{ | ||
"name": "@good-fences/api", | ||
"version": "0.17.0", | ||
"version": "0.18.0", | ||
"main": "index.js", | ||
@@ -10,3 +10,9 @@ "types": "index.d.ts", | ||
"additional": [ | ||
"aarch64-apple-darwin" | ||
"aarch64-apple-darwin", | ||
"aarch64-pc-windows-msvc", | ||
"aarch64-unknown-linux-gnu", | ||
"armv7-unknown-linux-gnueabihf", | ||
"x86_64-apple-darwin", | ||
"x86_64-pc-windows-msvc", | ||
"x86_64-unknown-linux-gnu" | ||
] | ||
@@ -17,11 +23,11 @@ } | ||
"type": "git", | ||
"url": "https://github.com/Adjective-Object/good-fences-rs-core" | ||
"url": "git+https://github.com/Adjective-Object/good-fences-rs-core.git" | ||
}, | ||
"bin": { | ||
"good-fences": "./good-fences.js", | ||
"unused": "./unused.js" | ||
"good-fences": "good-fences.js", | ||
"unused": "unused.js" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@napi-rs/cli": "^2.12.0", | ||
"@napi-rs/cli": "^2.18.4", | ||
"ava": "^4.3.0", | ||
@@ -34,8 +40,8 @@ "beachball": "^2.36.0" | ||
"scripts": { | ||
"change": "beachball change -c .beachball.js", | ||
"check-changefile": "beachball check -c .beachball.js", | ||
"beachball-publish": "beachball publish -c .beachball.js -y", | ||
"change": "beachball change", | ||
"check-changefile": "beachball check", | ||
"beachball-publish": "beachball publish -y", | ||
"artifacts": "napi artifacts", | ||
"build": "napi build --cargo-name good_fences --platform --release", | ||
"build:debug": "napi build --cargo-name good_fences --platform", | ||
"build": "napi build --cargo-name napi_root --platform --release", | ||
"build:debug": "napi build --cargo-name napi_root --platform", | ||
"prepublishOnly": "napi prepublish -t npm", | ||
@@ -48,9 +54,3 @@ "test": "ava", | ||
}, | ||
"packageManager": "yarn@4.4.0", | ||
"optionalDependencies": { | ||
"@good-fences/api-win32-x64-msvc": "0.17.0", | ||
"@good-fences/api-darwin-x64": "0.17.0", | ||
"@good-fences/api-linux-x64-gnu": "0.17.0", | ||
"@good-fences/api-darwin-arm64": "0.17.0" | ||
} | ||
"packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb" | ||
} |
@@ -128,14 +128,41 @@ # good-fences-rs-core | ||
# Development | ||
## Dev-Containers on WSL | ||
Development from windows happens in a devcontainer | ||
1. Install WSL2 (and restart your computer) | ||
- `wsl --install` from any terminal window | ||
2. Install [Docker Engine](https://docs.docker.com/engine/install/) (and restart your computer) | ||
3. Install workspace recommended plugins (including the Dev Containers plugin) | ||
4. Build the container with `Ctrl+P > Dev Containers: Rebuild and Reopen in Container` | ||
## Setting up the Development Environment | ||
1. Install a container engine: | ||
The repo uses a devcontainer, which is like a lightweight virtual machine that contains a pre-configured development environment. | ||
It is intended to support both Docker and podman, which are two different container engines. This is kind of arbitrary, and I might choose to revert it in the future if it presents issues. | ||
On windows, install Docker-Desktop | ||
On linux, you can install either `docker` or podman (via `podman-docker`) | ||
2. Set up your local config | ||
The devcontainer mounts some local directories from your machine into the container. If you do not have these already, you will have to create them, or comment out the bind mounts in the devcontainer. | ||
- `$HOME/.ssh` -- This is mounted so the container can access your SSH keys to push/pull from the git remote. | ||
This should already exist if you have ever configured an SSH key via `ssh-keygen`, which is the normal way to clone a git repo. | ||
Note that if you are developing in WSL, you should create these files _in wsl_, not within your windows filesystem. | ||
3. Configure your local user identity | ||
From within the repo, configure your local git identity: | ||
``` | ||
❯ git config --local user.name "Your Name Here" | ||
❯ git config --local user.email "your@e.mail" | ||
``` | ||
Note that you have to do this from within the repo's folder so it will be persisted into the devcontainer when the repo's folder is mounted as a volume. | ||
If you are in WSL, you need to do this within the repo's out folder in WSL | ||
4. Install recommended extensions | ||
Install the recommended extensions from this repo. | ||
`Ctrl+Shift+P > Extensions: Show Recommended Extensions`, then install all recommended extensions from the left navbar that opens up. | ||
5. Build and open in the devcontainer | ||
`Ctrl+Shift+P > Rebuild and Reopen In Container` | ||
Select the development container based on your container engine (podman or docker) | ||
- If installation stalls on `docker inspect --type image ubuntu:24.10`, you may need to feth the base image manually | ||
- Run `docker inspect --type image ubuntu:24.10` | ||
- If it fails with `Error response from daemon: No such image: ubuntu`, then run `docker pull ubuntu:24.10` | ||
5. Develop in the container | ||
6. (optional) mount the workspace you are building against. | ||
6. (optional) mount additional projects into the dev container | ||
To test `unused-finder` against your repo during development, uncomment the commented-out "mount" in the checked-in `.devcontainer`: | ||
@@ -147,2 +174,30 @@ ```json5 | ||
``` | ||
The provided example mounts `client-web` as a target repo | ||
The provided example mounts `client-web` as a target repo | ||
## Flamegraphs and profiling | ||
For profiling, you can use [`samply`](https://github.com/mstange/samply) | ||
```sh | ||
# This isn't installed by default in the dev container because it has to be built from source, | ||
# which takes a long time | ||
# | ||
# Must be built with --locked dependencies | ||
# See: https://github.com/mstange/samply/issues/341 | ||
cargo install samply --locked | ||
``` | ||
To profile a test, first build the test binary | ||
```sh | ||
# This will print the path of the test binary | ||
cargo test -p unused_finder --no-run | ||
# Then, run samply on the test binary binary | ||
samply record target/debug/deps/unused_finder-3aa70b00191bd4df | ||
``` | ||
### Note: Working in WSL | ||
The devcontainer is configured to allow perf events, but the host system must also be configured to allow perf events. On windows, devcontainers will probably be running under wsl. This means opening up wsl, and running the following: | ||
```sh | ||
# from within WSL | ||
echo '1' | sudo tee /proc/sys/kernel/perf_event_paranoid | ||
``` | ||
Then, close and restart your devcontainers |
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
595740
1
177
1457
201