Skip to main content

@jotsr/fcnc@0.2.1

The simple and flexible FreeCAD name convention checker

Works with
This package works with Deno
JSR Score
100%
Published
2 months ago (0.2.1)
logo

📋FCNC✔️

The simple and flexible FreeCAD name convention checker

JSR JSR GitHub License GitHub Downloads (all assets, all releases) GitHub Actions Workflow Status

fcnc tool allows you to check your custom name convention of your FreeCAD models (based on fcinfo output).

Basic usage

Requirements

  • fcinfo for extracting informations from FreeCAD files.
  • python3 for running fcinfo.
  • deno only for contributing or for installation-less use.

CLI

  • Get help:

    fcnc --help
    
  • Get command help:

    fcnc <command> --help
    
  • Check constraints:

    # Run fcinfo
    ./fcinfo my_freecad_model.FCStd > any_file.fcinfo
    
    # Check name convention
    fcnc check my_constraints.ts any_file.fcinfo or*globs?.fcinfo
    

API

Available on jsr:@jotsr/fcnc.

import { type Constraint } from 'jsr:@jotsr/fcnc'

const snakeCaseLabel = /[a-z][a-z0-9_]*[a-z0-9]/

const fileLabel: Constraint = {
	//Type of constraint
	kind: 'file:label',
	//Pattern to match ($fields refers to custom regexp)
	pattern: '$label.$type',
	//All "$" fields need to be defined
	fields: {
		//Array of regexp to match against (order matter)
		label: [snakeCaseLabel],
		type: [/part/, /assembly/],
	},
}

//name convention file should export array of constraints as default export
export default [fileLabel]

Documentation

Installation

From deno

Without install

deno run --allow-read=your-dir jsr:@jotsr/fcnc

With install

deno install --allow-read --allow-net=api.github.com -rf jsr:@jotsr/fcnc

Deno permissions explanations

  • --allow-read to read input files.
  • --allow-net=api.github.com to upgrade the cli.

From binaries

# Linux
curl -fsSLo fcnc https://github.com/JOTSR/release/download/$VERSION/fcnc-x86_64-unknown-linux-gnu.gz
curl -fsSLo fcnc https://github.com/JOTSR/release/download/$VERSION/fcnc-aarch64-unknown-linux-gnu.gz

# macOS
curl -fsSLo fcnc https://github.com/JOTSR/release/download/$VERSION/fcnc-x86_64-apple-darwin.gz
curl -fsSLo fcnc https://github.com/JOTSR/release/download/$VERSION/fcnc-aarch64-apple-darwin.gz

# Windows
curl -fsSLo fcnc.exe https://github.com/JOTSR/release/download/$VERSION/fcnc-x86_64-pc-windows-msvc.exe.gz

Doc

CLI

API

Available on jsr:@jotsr/fcnc.

Contributing

Any kind of contribution is welcomed. Please read contributing guidelines before and respect contributor covenant.

For local development:

Required dependencies:

  • deno To run project (code, ci, ...).

Before first commit or after editing ./deno.json:

  • Run deno task hooks:install.

Using VSCode:

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @jotsr/fcnc

Import symbol

import * as mod from "@jotsr/fcnc";