-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This pull request includes several updates to the `README.md` and `TODO.md` files, as well as changes to various template files to add support for the Nest.js framework and adjust the scope of several templates. The most important changes include the addition of the `nestjs` template, updates to the scope of existing templates, and the introduction of a new utility function to empty directories. ### Documentation Updates: * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R71): Added `nestjs` to the list of templates and updated the scope of several templates to "workspace". [[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R71) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L453-R457) [[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L475-R476) [[4]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R506-R524) * [`TODO.md`](diffhunk://#diff-5c6a1301c6b59b30a040d747d065e861d3dd98bde0e5a4356d92d594e9835986L4-R12): Added TODOs for `nestjs` and other templates indicating that repo support is not available at the moment. ### Template Changes: * [`packages/core/src/template.ts`](diffhunk://#diff-a00384074c972ef1fcbba57b53e443249ba635b63484b1eb1f7c4916e4339cc8R27): Added `nestjs` to the core templates list. * [`packages/templates/src/index.ts`](diffhunk://#diff-e808eba3cb0d1f11d939ad3e832c543551d82e87ff0fd48759d89afcff94771fR8): Exported `nestjs` from the templates index. * [`packages/templates/src/nestjs.ts`](diffhunk://#diff-194e877e0e7ac2f869e0aa51d8b15c8005f3931802a297c74a98e3001aa2095bR1-R37): Added a new template for `nestjs` with a function to scaffold a Nest.js server app. ### Utility Functions: * [`packages/core/src/directory.ts`](diffhunk://#diff-e48f537ea43df65f2f733b68e321624fd34237257fab618884ade5c6a77ef438R17-R24): Added a new function `emptyDirectory` to remove all files from a directory and recreate it. ### Scope Adjustments: * [`packages/templates/src/angular.ts`](diffhunk://#diff-628da3ea0ff520d22fe287969fa70433369e80a5c5cca0f56155b5b3897c81b8R41-R43): Changed the scope of the `angular` template to "workspace" and added a TODO comment. * [`packages/templates/src/cra.ts`](diffhunk://#diff-07e537610a9f89af168891b69382d6a2ec4c627c83b6cb21f38edb707fb5ddb2R43-R45): Changed the scope of the `cra` template to "workspace" and added a TODO comment. * [`packages/templates/src/next.ts`](diffhunk://#diff-7b8c2ff5e3fec4265f94f6fadba1066c1a83370bef545fe260a5fc1f71331974R23-R30): Changed the scope of the `next` template to "workspace", added `--turbopack` and `--yes` options, and added a TODO comment. [[1]](diffhunk://#diff-7b8c2ff5e3fec4265f94f6fadba1066c1a83370bef545fe260a5fc1f71331974R23-R30) [[2]](diffhunk://#diff-7b8c2ff5e3fec4265f94f6fadba1066c1a83370bef545fe260a5fc1f71331974R40-R42) * [`packages/templates/src/sanity.ts`](diffhunk://#diff-16b5865fb81eb3b101433586384690b1108e06837f7c278eed18f01c9328ceb0R43-R45): Changed the scope of the `sanity` template to "workspace" and added a TODO comment.
- Loading branch information
Showing
10 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
### TODOs | ||
|
||
| Filename | line # | TODO | | ||
| :------------------------------------------------------------------------- | :----: | :--------------------------------------------------------------- | | ||
| [packages/cli/test/add.test.ts](packages/cli/test/add.test.ts#L52) | 52 | remove when https://github.com/nodejs/node/issues/47614 resolves | | ||
| [packages/core/src/license.ts](packages/core/src/license.ts#L43) | 43 | Contents is not perfect yet, e.g.: | | ||
| [packages/core/src/yarnrc.ts](packages/core/src/yarnrc.ts#L23) | 23 | etc, fix later | | ||
| [packages/plugins/src/jest/jest.ts](packages/plugins/src/jest/jest.ts#L31) | 31 | install jest without ts-jest | | ||
| [packages/plugins/src/xv/xv.ts](packages/plugins/src/xv/xv.ts#L16) | 16 | install xv without ts-node | | ||
| Filename | line # | TODO | | ||
| :------------------------------------------------------------------------- | :----: | :---------------------------------------------------------------------- | | ||
| [packages/cli/test/add.test.ts](packages/cli/test/add.test.ts#L52) | 52 | remove when https://github.com/nodejs/node/issues/47614 resolves | | ||
| [packages/core/src/license.ts](packages/core/src/license.ts#L43) | 43 | Contents is not perfect yet, e.g.: | | ||
| [packages/core/src/yarnrc.ts](packages/core/src/yarnrc.ts#L23) | 23 | etc, fix later | | ||
| [packages/templates/src/angular.ts](packages/templates/src/angular.ts#L41) | 41 | repo not supported atm, because we'd need to restore yarn and git state | | ||
| [packages/templates/src/cra.ts](packages/templates/src/cra.ts#L43) | 43 | repo not supported atm, because we'd need to restore yarn and git state | | ||
| [packages/templates/src/nestjs.ts](packages/templates/src/nestjs.ts#L33) | 33 | repo not supported atm, because we'd need to restore yarn and git state | | ||
| [packages/templates/src/next.ts](packages/templates/src/next.ts#L40) | 40 | repo not supported atm, because we'd need to restore yarn and git state | | ||
| [packages/templates/src/sanity.ts](packages/templates/src/sanity.ts#L43) | 43 | repo not supported atm, because we'd need to restore yarn and git state | | ||
| [packages/plugins/src/jest/jest.ts](packages/plugins/src/jest/jest.ts#L31) | 31 | install jest without ts-jest | | ||
| [packages/plugins/src/xv/xv.ts](packages/plugins/src/xv/xv.ts#L16) | 16 | install xv without ts-node | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ const CORE_TEMPLATES = [ | |
"express", | ||
"github-action", | ||
"lib", | ||
"nestjs", | ||
"next", | ||
"sanity", | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
PluginType, | ||
emptyDirectory, | ||
exec, | ||
readPackage, | ||
removeFile, | ||
writePackage, | ||
type TemplateArgs, | ||
} from "@mokr/core"; | ||
import { join } from "path"; | ||
|
||
async function apply({ directory }: TemplateArgs) { | ||
const oldPackage = await readPackage({ directory }); | ||
|
||
await emptyDirectory({ directory }); | ||
|
||
await exec( | ||
"yarn", | ||
["dlx", "degit", "https://github.com/nestjs/typescript-starter"], | ||
{ | ||
cwd: directory, | ||
}, | ||
); | ||
|
||
await removeFile({ path: join(directory, "package-lock.json") }); | ||
|
||
delete oldPackage.scripts?.["build"]; | ||
delete oldPackage.scripts?.["test"]; | ||
|
||
await writePackage({ directory, data: oldPackage }); | ||
} | ||
|
||
// @todo repo not supported atm, because we'd need to restore yarn and git state | ||
export const nestjs = { | ||
type: PluginType.Workspace, | ||
apply, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters