Registry / devops / mrm-task-typescript

mrm-task-typescript

JSON →
library4.1.22jsnpmunverified

mrm-task-typescript is an Mrm task designed to automate the initial setup and configuration of TypeScript within a JavaScript project. It currently stands at version 4.1.22. As part of the Mrm monorepo, its releases are often coordinated with other Mrm tasks, typically seeing version bumps (sometimes 'bump only') to ensure compatibility across the Mrm ecosystem. This task distinguishes itself by providing a declarative and automated way to standardize TypeScript configuration across multiple projects or within an organization, reducing manual setup errors and ensuring best practices are applied consistently. It handles the creation of `tsconfig.json`, integrates a type-checking script into `package.json`, and installs necessary TypeScript-related dependencies, streamlining the developer workflow for adopting TypeScript.

npm install mrm-task-typescript
INSTALL
IMPORT
SIG · MRM-TASK-TYPESCRIP
M
mrm-task-typescript
devopsjavascriptv4.1.22
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mrm-task-typescript
npx mrm typescript
import { typescript } from 'mrm-task-typescript';
This package is an Mrm task, designed for command-line execution, not for direct programmatic import as a module.
mrm-task-typescript
npx mrm typescript
const typescript = require('mrm-task-typescript');
CommonJS `require` is not applicable as this package is a CLI task and does not expose a module API.
mrm-task-typescript
npx mrm typescript
import typescript from 'mrm-task-typescript';
There is no default export; the task's functionality is accessed exclusively through the Mrm CLI.

Demonstrates how to create a new project, initialize npm, and apply the `mrm typescript` task to configure TypeScript, including `tsconfig.json` and a type-checking script.

import * as path from 'path'; import * as fs from 'fs'; import { execSync } from 'child_process'; const projectName = 'my-ts-project'; const projectPath = path.join(process.cwd(), projectName); console.log(`Creating project directory: ${projectPath}`); fs.mkdirSync(projectPath, { recursive: true }); process.chdir(projectPath); console.log('Initializing npm...'); execSync('npm init -y', { stdio: 'inherit' }); console.log('Running mrm typescript task...'); execSync('npx mrm typescript', { stdio: 'inherit' }); console.log('\nVerifying setup:'); console.log('Content of tsconfig.json:'); console.log(fs.readFileSync('tsconfig.json', 'utf8')); console.log('\nContent of package.json scripts:'); const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); console.log(packageJson.scripts); // Create a sample TypeScript file to demonstrate compilation fs.mkdirSync('src', { recursive: true }); fs.writeFileSync('src/index.ts', ` function greet(name: string): string { return \`Hello, \${name}!\`; } console.log(greet("TypeScript User")); `); console.log('\nAttempting to run type check script...'); execSync('npm run typecheck', { stdio: 'inherit' }); console.log('\nTypeScript setup complete! To clean up, run:'); console.log(`rm -rf ${projectName}`);
mrm --version
Debug
Known issues
gotchaEnsure your Node.js environment meets the minimum requirement (>=10.13) as specified in the package's `engines` field. Using older Node.js versions may lead to unexpected errors.
fix
Upgrade Node.js to a compatible version (e.g., using `nvm install 18` or `nvm use 18`).
affects: <=4.1.22
gotchaMrm tasks can overwrite existing configuration files. If you have an existing `tsconfig.json` or related npm scripts, review the changes made by the task to ensure they align with your project's needs.
fix
Back up critical configuration files before running Mrm. After the task, manually merge or adjust configurations as necessary.
affects: >=1.0.0
gotchaThe Mrm task runner (`mrm`) must be accessible in your PATH. While `npx` handles this for global installs, ensure `mrm` itself is installed or resolvable if you're not using `npx`.
fix
Use `npx mrm typescript` or ensure `mrm` is installed globally (`npm install -g mrm`) and its bin directory is in your system's PATH.
affects: >=1.0.0
gotchaMrm tasks are designed to be run in the root directory of your project where `package.json` resides. Running them from subdirectories can lead to incorrect file placements or configuration.
fix
Always navigate to your project's root directory before executing `npx mrm typescript`.
affects: >=1.0.0
gotchaThe specific versions of TypeScript and `@types` packages installed by this task are managed by the task's internal logic. These might conflict with pre-existing versions in your `package.json` or require specific TypeScript versions for compilation.
fix
After running the task, check `package.json` for installed TypeScript dependencies and resolve any version conflicts manually if needed. You may need to run `npm install` again.
affects: >=1.0.0
Errors
Common errors & fixes
command not found: mrm
The Mrm command-line interface tool is not installed globally or accessible via npx.
fix
Use `npx mrm typescript` or install Mrm globally with `npm install -g mrm`.
Error: EPERM: operation not permitted, mkdir 'src'
Permission issues prevent Mrm from creating necessary directories or files in the project path.
fix
Ensure you have write permissions in the project directory. On some systems, you might need to run your terminal with elevated privileges (e.g., `sudo npx mrm typescript` on Linux/macOS or 'Run as Administrator' on Windows).
Cannot find module 'typescript'
The TypeScript package, which is a dependency managed by the task, was not successfully installed in your project's `node_modules`.
fix
After running `npx mrm typescript`, ensure you run `npm install` (or `yarn install`) to install all project dependencies, including TypeScript.
Missing script: 'typecheck'
The `typecheck` npm script was not correctly added to your `package.json` by the Mrm task.
fix
Verify your `package.json` for the presence of a `scripts.typecheck` entry. If missing, re-run `npx mrm typescript` or manually add `"typecheck": "tsc --noEmit"` to your `scripts`.
Upgrade
Version history
4.1.22latest on npm
Audit
Dependencies
mrmrequiredThis package is an Mrm task and requires the Mrm CLI runner to function.
Agent activity
2 hits · last 30 days
node
2
Resources