Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A very simple precompiler written in typescript. With it you can make a dynamically generated blocks in your code.
A very simple precompiler (written in typescript). With it you can make a dynamically generated blocks in your code.
npm i inprint --save-dev
yarn i inprint --save-dev
pnpm i inprint --save-dev
npm i -g inprint
yarn i -g inprint
pnpm i -g inprint
console.log("any code can be here");
// @INPRINT_START {my:"own params", json5:'is supported here!'}
// Anything here will be overwritten by generated code!
// @INPRINT_END
console.log("any code can be here");
module.exports = {
files:['src/**/*.{ts,tsx,js,jsx}'],
embeddedFeatures: false, // Highly recommended if don't use them!
inprint: function inprint(paramsObject) {
return " // " + JSON.stringify(paramsObject);
}
}
Run inprint
The returned content will be inprinted between @INPRINT tags:
console.log("any code can be here");
// @INPRINT_START {my:"own params", json5:'is supported here!'}
// {my:"own params", json5:'is supported here!'}
// @INPRINT_END
console.log("any code can be here");
inprint function will receive the following additional paramaters:
absolutePath - absolute file path with inprint block
content - current content of the block
Options:
inprint - required, the function used to generate inprinted content
files - optional, globby input patterns, default is ['src/**/*.{ts,tsx,js,jsx}']
skipNodeModules- optional, if true will skip all path containing /node_modules/, default is true
embeddedFeatures - 'first' | 'last' | false - used to automatically run embedded generation functions (see the list below), 'first' - to run them before your inprint code, 'last' - to run only if your code returned undefined, false - don't run them ever, default is false.
prettierOpts - optional, options forwarded to prettier.
forceProcessTermination - if defined will call process.exit(0) after finished. Useful in case you include some files with timers to do your generation and don't want or can't get rid of them
Create inprintDebug.cjs with contents
require("inprint").run();
run it in your favorite IDE to debug the scripts.
require("inprint").run(options);
This package also contains some functions which I use for my own project automation.
If you want to disable them use:
embeddedFeatures: false,
If you want to use them add to options file:
embeddedFeatures: 'first'
You can also call them with:
require("inprint").callEmbeddedFeatures(params, options);
Using just one function is also possible, for example:
require("inprint").inprintIndexTs(params, options);
List of embedded features:
Generates reexports for each file in folder:
// @INPRINT_START {exclude:[""], merge:[{name:"embeddedFeatures:EmbeddedFeature[]", suffix:"EmbeddedFeature"}]}
export * from "./indexTs";
import {indexTsEmbeddedFeature} from "./indexTs";
export const embeddedFeatures:EmbeddedFeature[] = [indexTsEmbeddedFeature];
// @INPRINT_END
exclude - array of excluded filenames
merge - array of merged variables, defined as objects
suffix - name of a const exported from each file
name - name of result variable
FAQs
A very simple precompiler written in typescript. With it you can make a dynamically generated blocks in your code.
The npm package inprint receives a total of 1 weekly downloads. As such, inprint popularity was classified as not popular.
We found that inprint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.