{"id":26716,"library":"am-compiler","title":"am-compiler","description":"am-compiler is a CoffeeScript-based build tool that compiles multiple targets (electron, node, browser) from CoffeeScript source files. As of version 1.0.31, it appears to be a niche package with minimal documentation and no recent updates. It relies on fs-extra for reading JSON and child_process for executing commands. Key differentiators include a custom class extending a base compiler and targeted entry points for electron, node, and browser builds. However, it lacks comprehensive documentation and may be considered experimental or specific to certain workflows.","status":"active","version":"1.0.31","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install am-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add am-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add am-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for reading package.json via fse.readJsonSync","package":"fs-extra","optional":false}],"imports":[{"note":"This package is CommonJS only; ESM import will fail.","wrong":"import Compiler from 'am-compiler'","symbol":"Compiler","correct":"const Compiler = require('am-compiler')"},{"note":"Named import not supported; use default require.","wrong":"import { AmCompiler } from 'am-compiler'","symbol":"AmCompiler","correct":"const AmCompiler = require('am-compiler')"},{"note":"Direct extension of the required module works; .Compiler is unnecessary.","wrong":"class MyCompiler extends require('am-compiler').Compiler { ... }","symbol":"Class extension","correct":"class MyCompiler extends Compiler { ... }"}],"quickstart":{"code":"const fse = require('fs-extra');\nconst Compiler = require('am-compiler');\n\nclass AmCompiler extends Compiler {\n  constructor() {\n    super();\n    this.checkNum = 0;\n  }\n\n  electronStart() {\n    const cmd = fse.readJsonSync('package.json').scripts.electron;\n    require('child_process').exec(cmd);\n  }\n\n  callback(err, stats) {\n    super.callback(err, stats);\n    if (err) {\n      console.log(err);\n      return;\n    }\n    this.checkNum++;\n    if (this.checkNum === 3) {\n      this.electronStart();\n    }\n  }\n\n  start() {\n    this.electronOption.entry = {\n      'electron/.build/start': './electron/test/start.coffee',\n      'app/.build/preload': './app/test/preload.coffee',\n      'app/.build/electron': './app/test/electron.coffee'\n    };\n    this.nodeOption.entry = {\n      'app/.build/server': './app/test/server.coffee'\n    };\n    this.browserOption.entry = {\n      'web/.build/client': './web/test/client.coffee'\n    };\n    super.start();\n  }\n}\n\nconst compiler = new AmCompiler();\ncompiler.start();","lang":"javascript","description":"Shows how to extend the Compiler class, set entry points for electron, node, and browser, and override callback."},"warnings":[{"fix":"Create an instance and call .start() explicitly.","message":"The start method must be called after instantiation; it is not automatically called.","severity":"gotcha","affected_versions":"*"},{"fix":"Always call super.callback(err, stats) in overridden callback.","message":"callback expects super.callback(err, stats) to be called; failing to do so may break chain.","severity":"gotcha","affected_versions":"*"},{"fix":"Use const Compiler = require('am-compiler') for all versions >=1.0.25.","message":"In versions prior to 1.0.25, the class name was AmCompilerExport and the module exported differently.","severity":"breaking","affected_versions":"<1.0.25"},{"fix":"Consider migrating to a more modern build tool like Webpack or Rollup.","message":"The package is no longer actively maintained and may break with newer Node.js versions.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure you are using version >=1.0.25 and use const Compiler = require('am-compiler').","cause":"Importing the module incorrectly or using an older version where export was different.","error":"TypeError: Compiler is not a constructor"},{"fix":"Run npm install am-compiler --save","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'am-compiler'"},{"fix":"Install fs-extra: npm install fs-extra --save and require it: const fse = require('fs-extra');","cause":"fs-extra not installed or not required.","error":"fse.readJsonSync is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}