From bd970be0d0c9d51fec04aa4520e55efb67c09170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=A9sley=20Guimar=C3=A3es?= Date: Wed, 8 May 2024 10:03:31 -0300 Subject: [PATCH] fix(gen): isolate generator to `commonjs` (#8109) ### Description As described by #5657, the default `simple-*` templates creates a template that is broken for `"type": "module"` packages. When digging into this issue I found out that a simple `package.json` with `"type": "commonjs"` solves the problems by telling the runtime to treat the file diferently from the parent package. ### Testing Instructions - Initialize a new monorepo with `"type": "module"` in the `package.json` - on this branch it should now be possible to generate the sample generator (either `js` or `ts`) and not have any errors about the module type. - it should also be possible to run the generator and it should create the file in the project root normally. resolves #5657 --- packages/turbo-gen/src/templates/simple-js/package.json | 3 +++ packages/turbo-gen/src/templates/simple-ts/package.json | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 packages/turbo-gen/src/templates/simple-js/package.json create mode 100644 packages/turbo-gen/src/templates/simple-ts/package.json diff --git a/packages/turbo-gen/src/templates/simple-js/package.json b/packages/turbo-gen/src/templates/simple-js/package.json new file mode 100644 index 00000000000000..5bbefffbabee39 --- /dev/null +++ b/packages/turbo-gen/src/templates/simple-js/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/packages/turbo-gen/src/templates/simple-ts/package.json b/packages/turbo-gen/src/templates/simple-ts/package.json new file mode 100644 index 00000000000000..5bbefffbabee39 --- /dev/null +++ b/packages/turbo-gen/src/templates/simple-ts/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +}