nscale-compiler
raw JSON → 0.17.0 verified Fri May 01 auth: no javascript maintenance
nscale-compiler is a deployment compiler for nearForm's nscale system, used to compile system definitions into deployable artifacts. Version 0.17.0 is the latest stable release. The package has no active release cadence, appearing to be in maintenance mode. It converts nscale container/service definitions into a normalized format for deployment. Key differentiator: part of the nscale toolchain, not widely used outside that ecosystem. Minimal dependencies; primarily uses async and lodash.
Common errors
error TypeError: compiler.compile is not a function ↓
cause Incorrect require path or import method; using ES modules with this CJS-only package.
fix
Use require('nscale-compiler').compile or const compiler = require('nscale-compiler'); compiler.compile(...)
error Error: Invalid system definition: missing 'containers' property ↓
cause The system definition object lacks required fields.
fix
Ensure the system definition includes a 'containers' object (and optionally 'services').
error Callback must be a function ↓
cause compile() called without a callback function as second argument.
fix
Pass a function as the second argument: compile(def, (err, result) => {...})
error Cannot find module 'nscale-compiler' ↓
cause Package not installed or not in node_modules.
fix
Run 'npm install nscale-compiler' in your project directory.
Warnings
deprecated The nscale project is no longer actively developed; this package is in maintenance mode. ↓
fix Consider migrating to a more modern deployment tool like Docker Compose or Kubernetes.
gotcha The compiler expects system definitions in a specific format; malformed input may cause cryptic errors. ↓
fix Validate your system definition against the nscale schema before compilation.
breaking Version 0.14.0 changed the output format of compiled artifacts, breaking consumers expecting the old shape. ↓
fix Update your code to handle the new output structure; see changelog.
gotcha Asynchronous callbacks are used; forgetting to handle the error argument can lead to silent failures. ↓
fix Always check the error parameter in the callback; consider wrapping with try-catch or using promisify.
deprecated lodash methods used internally may be deprecated in newer versions of lodash. ↓
fix Pin lodash to a compatible version (e.g., 4.17.x) if you experience issues.
Install
npm install nscale-compiler yarn add nscale-compiler pnpm add nscale-compiler Imports
- compile wrong
import { compile } from 'nscale-compiler';correctconst compile = require('nscale-compiler').compile; - default wrong
import compiler from 'nscale-compiler';correctconst compiler = require('nscale-compiler'); - compileSystem wrong
const { compileSystem } = require('nscale-compiler');correctconst compileSystem = require('nscale-compiler').compileSystem;
Quickstart
const compiler = require('nscale-compiler');
const systemDefinition = {
containers: {
web: {
image: 'node:14',
ports: ['80:80']
}
},
services: {}
};
compiler.compile(systemDefinition, function(err, result) {
if (err) {
console.error('Compilation failed:', err);
} else {
console.log('Compiled result:', JSON.stringify(result, null, 2));
}
});