create-email
Advanced tools
Comparing version
# create-email | ||
## 1.2.0-canary.0 | ||
### Minor Changes | ||
- 237d115: Fetch react-email package versions at runtime from `--tag` option | ||
## 1.1.0 | ||
@@ -9,2 +15,4 @@ | ||
## 1.0.8-canary.0 | ||
## 1.0.7 | ||
@@ -11,0 +19,0 @@ |
{ | ||
"name": "create-email", | ||
"version": "1.1.0", | ||
"version": "1.2.0-canary.0", | ||
"description": "The easiest way to get started with React Email", | ||
@@ -9,6 +9,6 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"commander": "9.4.1", | ||
"fs-extra": "11.1.1", | ||
"log-symbols": "5.1.0", | ||
"ora": "6.1.2" | ||
"commander": "^9.4.1", | ||
"fs-extra": "^11.1.1", | ||
"log-symbols": "^5.1.0", | ||
"ora": "^6.1.2" | ||
}, | ||
@@ -31,5 +31,3 @@ "repository": { | ||
"devDependencies": { | ||
"@react-email/components": "0.0.36", | ||
"react": "19.0.0", | ||
"react-email": "4.0.7", | ||
"typescript": "5.8.2", | ||
@@ -36,0 +34,0 @@ "tsconfig": "0.0.0" |
@@ -11,3 +11,23 @@ #!/usr/bin/env node | ||
const init = async (name) => { | ||
const getLatestVersionOfTag = async (packageName, tag) => { | ||
const response = await fetch( | ||
`https://registry.npmjs.org/${packageName}/${tag}`, | ||
); | ||
const data = await response.json(); | ||
if (typeof data === 'string' && data.startsWith('version not found')) { | ||
console.error(`Tag ${tag} does not exist for ${packageName}.`); | ||
process.exit(1); | ||
} | ||
const { version } = data; | ||
if (!/^\d+\.\d+\.\d+.*$/.test(version)) { | ||
console.error('Invalid version received, something has gone very wrong.'); | ||
} | ||
return version; | ||
}; | ||
const init = async (name, { tag }) => { | ||
let projectPath = name; | ||
@@ -43,21 +63,14 @@ | ||
); | ||
const templatePackageJson = JSON.parse( | ||
fse.readFileSync(templatePackageJsonPath, 'utf8'), | ||
); | ||
for (const key in templatePackageJson.dependencies) { | ||
// We remove any workspace prefix that might have been added for the purposes | ||
// of being used locally | ||
templatePackageJson.dependencies[key] = templatePackageJson.dependencies[ | ||
key | ||
].replace('workspace:', ''); | ||
} | ||
for (const key in templatePackageJson.devDependencies) { | ||
// We remove any workspace prefix that might have been added for the purposes | ||
// of being used locally | ||
templatePackageJson.devDependencies[key] = | ||
templatePackageJson.devDependencies[key].replace('workspace:', ''); | ||
} | ||
const templatePackageJson = fse.readFileSync(templatePackageJsonPath, 'utf8'); | ||
fse.writeFileSync( | ||
templatePackageJsonPath, | ||
JSON.stringify(templatePackageJson, null, 2), | ||
templatePackageJson | ||
.replace( | ||
'INSERT_COMPONENTS_VERSION', | ||
await getLatestVersionOfTag('@react-email/components', tag), | ||
) | ||
.replace( | ||
'INSERT_REACT_EMAIL_VERSION', | ||
await getLatestVersionOfTag('react-email', tag), | ||
), | ||
'utf8', | ||
@@ -85,4 +98,5 @@ ); | ||
.description('The easiest way to get started with React Email') | ||
.arguments('[dir]', 'path to initialize the project') | ||
.arguments('[dir]', 'Path to initialize the project') | ||
.option('-t, --tag <tag>', 'Tag of React Email versions to use', 'latest') | ||
.action(init) | ||
.parse(process.argv); |
@@ -29,2 +29,16 @@ import { spawnSync } from 'node:child_process'; | ||
test.sequential('install', { timeout: 40_000 }, () => { | ||
const installProcess = spawnSync('npm', ['install'], { | ||
shell: true, | ||
cwd: path.resolve(starterPath), | ||
stdio: 'pipe', | ||
}); | ||
if (installProcess.stderr) { | ||
console.log(installProcess.stderr.toString()); | ||
} | ||
expect(installProcess.status, 'starter npm install should return 0').toBe( | ||
0, | ||
); | ||
}); | ||
test.sequential('export', () => { | ||
@@ -42,3 +56,3 @@ const exportProcess = spawnSync('npm', ['run export'], { | ||
test.sequential('type checking', () => { | ||
test.sequential('type checking', { timeout: 10_000 }, () => { | ||
const typecheckingProcess = spawnSync('npx', ['tsc'], { | ||
@@ -45,0 +59,0 @@ shell: true, |
@@ -11,11 +11,11 @@ { | ||
"dependencies": { | ||
"@react-email/components": "workspace:^0.0.36", | ||
"react-dom": "19.0.0", | ||
"react": "19.0.0" | ||
"@react-email/components": "INSERT_COMPONENTS_VERSION", | ||
"react-dom": "^19.0.0", | ||
"react": "^19.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "19.0.1", | ||
"@types/react-dom": "19.0.1", | ||
"react-email": "workspace:^4.0.7" | ||
"@types/react": "^19.0.1", | ||
"@types/react-dom": "^19.0.1", | ||
"react-email": "INSERT_REACT_EMAIL_VERSION" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3
-40%1797
9.77%811
2.79%18
5.88%101321
-3.21%24
-4%2
100%1
Infinity%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated