nx/nx-dev/tutorial/compile-js-module.mjs
Isaac Mann 0e16f98c27
feat(nx-dev): tutorial landing page and improvements (#30757)
Updates the online tutorial experience

- Adds a landing page at
[/tutorials](https://nx-dev-git-docs-tutorial-landing-page-nrwl.vercel.app/tutorials)
- Terminal code blocks get a "run in terminal" button
- Code blocks get an "Apply file changes" button
- The apply file changes button currently only works for code blocks
that are showing the new file results (not showing the old file with
lines marked for deletion). There is nothing technical blocking this,
just time.
- Previous and next buttons do not go between tutorials
- The preview panel can be completely minimized
- Git is stubbed out
2025-04-23 15:08:51 -04:00

22 lines
540 B
JavaScript

import * as esbuild from 'esbuild';
import { writeFileSync, readFileSync } from 'fs';
const output = esbuild
.transformSync(readFileSync('./src/code-block-button/js-module.ts'), {
loader: 'ts',
minify: true,
})
.code.replaceAll('\n', '\\n');
writeFileSync(
'./src/code-block-button/js-module.min.ts',
`/**
* GENERATED FILE - DO NOT EDIT
* This JS module code was built from the source file "js-module.ts".
* To change it, modify the source file and then re-run the build script.
*/
export default '${output}';
`
);