Updates the docs structure, navigation etc to be easier + better suited for showing Nx technology support beyond just TS. **Notes:** - API (`/nx-api`) tab is removed from the navigation (i.e. menu bar), but pages still remain for now until we update references in `*.md` files. - Redirects are set up `/nx-api` to go to their respect new location e.g. `/technologies` or `/reference/core-api` - Old URLs still exist in the sitemap for now, but majority of them will be redirected -- a follow-up PR can remove them. **Preview:** https://nx-dev-git-nx-dev-polyglot-docs-restructure-nrwl.vercel.app/docs --------- Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
40 lines
1.8 KiB
Markdown
40 lines
1.8 KiB
Markdown
# Function: generateFiles
|
|
|
|
▸ **generateFiles**(`tree`, `srcFolder`, `target`, `substitutions`, `options?`): `void`
|
|
|
|
Generates a folder of files based on provided templates.
|
|
|
|
While doing so it performs two substitutions:
|
|
|
|
- Substitutes segments of file names surrounded by \_\_
|
|
- Uses ejs to substitute values in templates
|
|
|
|
Examples:
|
|
|
|
```typescript
|
|
generateFiles(tree, path.join(__dirname, 'files'), './tools/scripts', {
|
|
tmpl: '',
|
|
name: 'myscript',
|
|
});
|
|
```
|
|
|
|
This command will take all the files from the `files` directory next to the place where the command is invoked from.
|
|
It will replace all `__tmpl__` with '' and all `__name__` with 'myscript' in the file names, and will replace all
|
|
`<%= name %>` with `myscript` in the files themselves.
|
|
`tmpl: ''` is a common pattern. With it you can name files like this: `index.ts__tmpl__`, so your editor
|
|
doesn't get confused about incorrect TypeScript files.
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| :-------------- | :-------------------------------------------------- | :-------------------------------------------- |
|
|
| `tree` | [`Tree`](/reference/core-api/devkit/documents/Tree) | the file system tree |
|
|
| `srcFolder` | `string` | the source folder of files (absolute path) |
|
|
| `target` | `string` | the target folder (relative to the tree root) |
|
|
| `substitutions` | `Object` | an object of key-value pairs |
|
|
| `options?` | `GenerateFilesOptions` | See GenerateFilesOptions |
|
|
|
|
#### Returns
|
|
|
|
`void`
|