Skip to content

Commit

Permalink
chore(CRWA): convert to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuoushub committed Dec 12, 2023
1 parent f5d0b80 commit 10a2600
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/create-redwood-app/build.mjs
Expand Up @@ -9,6 +9,7 @@ const result = await esbuild.build({
bundle: true,
minify: true,

format: 'esm',
platform: 'node',
target: ['node18'],
packages: 'external',
Expand Down
1 change: 1 addition & 0 deletions packages/create-redwood-app/package.json
@@ -1,6 +1,7 @@
{
"name": "create-redwood-app",
"version": "6.0.7",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/redwoodjs/redwood.git",
Expand Down
7 changes: 4 additions & 3 deletions packages/create-redwood-app/src/create-redwood-app.js
Expand Up @@ -14,15 +14,16 @@ import yargs from 'yargs/yargs'

import { RedwoodTUI, ReactiveTUIContent, RedwoodStyling } from '@redwoodjs/tui'


// In ESM, for relative paths, the extension is important.
// See https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#mandatory-file-extensions.
import {
UID,
startTelemetry,
shutdownTelemetry,
recordErrorViaTelemetry,
packageName,
packageVersion,
} from './telemetry'
} from './telemetry.js'

const INITIAL_COMMIT_MESSAGE = 'Initial commit'

Expand Down Expand Up @@ -223,7 +224,7 @@ async function executeCompatibilityCheck(templateDir) {
*/
function checkNodeAndYarnVersion(templateDir) {
return new Promise((resolve) => {
const { engines } = require(path.join(templateDir, 'package.json'))
const { engines } = fs.readJSONSync(path.join(templateDir, 'package.json'))

checkNodeVersionCb(engines, (_error, result) => {
return resolve([result.isSatisfied, result.versions])
Expand Down

0 comments on commit 10a2600

Please sign in to comment.