now-tsx-docs
Advanced tools
Comparing version 0.0.2 to 0.0.3
18
index.js
@@ -41,16 +41,16 @@ "use strict"; | ||
const pkg = await readPackageJson(entryPath); | ||
let nextVersion; | ||
if (pkg.dependencies && pkg.dependencies.next) { | ||
nextVersion = pkg.dependencies.next; | ||
let tsxDocsVersion; | ||
if (pkg.dependencies && pkg.dependencies['tsx-docs']) { | ||
tsxDocsVersion = pkg.dependencies['tsx-docs']; | ||
} | ||
else if (pkg.devDependencies && pkg.devDependencies.next) { | ||
nextVersion = pkg.devDependencies.next; | ||
else if (pkg.devDependencies && pkg.devDependencies['tsx-docs']) { | ||
tsxDocsVersion = pkg.devDependencies['tsx-docs']; | ||
} | ||
if (!nextVersion) { | ||
throw new Error('No Next.js version could be detected in "package.json". Make sure `"next"` is installed in "dependencies" or "devDependencies"'); | ||
if (!tsxDocsVersion) { | ||
throw new Error('No tsx-docs version could be detected in "package.json". Make sure `"tsx-docs"` is installed in "dependencies" or "devDependencies"'); | ||
} | ||
console.log(`MODE: serverless`); | ||
if (!pkg.scripts || !pkg.scripts['now-build']) { | ||
console.warn('WARNING: "now-build" script not found. Adding \'"now-build": "next build"\' to "package.json" automatically'); | ||
pkg.scripts = Object.assign({ 'now-build': 'next build' }, (pkg.scripts || {})); | ||
console.warn('WARNING: "now-build" script not found. Adding \'"now-build": "tsx-docs build"\' to "package.json" automatically'); | ||
pkg.scripts = Object.assign({ 'now-build': 'tsx-docs build' }, (pkg.scripts || {})); | ||
console.log('normalized package.json result: ', pkg); | ||
@@ -57,0 +57,0 @@ await writePackageJson(entryPath, pkg); |
{ | ||
"name": "now-tsx-docs", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
9060