{"record":{"id":"d32f6838d0b4ae16","repo":"unionlabs/union","slug":"usage-node-site-scripts-import-contentful-export","errorCode":null,"errorMessage":"Usage: node site/scripts/import-contentful-export.mjs <preview-export> <delivery-export>","messagePattern":"Usage: node site/scripts/import-contentful-export\\.mjs <preview-export> <delivery-export>","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"site/scripts/import-contentful-export.mjs","lineNumber":13,"sourceCode":"// @ts-nocheck\nimport { copyFile, mkdir, readFile, stat, writeFile } from \"node:fs/promises\"\nimport { basename, extname, join, relative } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nconst LOCALE = \"en-US\"\nconst SITE_DIRECTORY = fileURLToPath(new URL(\"..\", import.meta.url))\nconst REPOSITORY_ROOT = fileURLToPath(new URL(\"../..\", import.meta.url))\n\nconst [previewDirectory, deliveryDirectory] = process.argv.slice(2)\n\nif (!previewDirectory || !deliveryDirectory) {\n  throw new Error(\n    \"Usage: node site/scripts/import-contentful-export.mjs <preview-export> <delivery-export>\",\n  )\n}\n\nconst archiveDirectory = join(\n  SITE_DIRECTORY,\n  \"content\",\n  \"archive\",\n  \"contentful\",\n)\nconst assetDirectory = join(SITE_DIRECTORY, \"public\", \"content\", \"assets\")\nconst dataDirectory = join(SITE_DIRECTORY, \"src\", \"content-data\")\nconst blogDirectory = join(SITE_DIRECTORY, \"src\", \"content\", \"blog\")\nconst legalDirectory = join(SITE_DIRECTORY, \"src\", \"content\", \"legal\")\n\nfor (\n  const directory of [\n    archiveDirectory,","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/unionlabs/union/blob/031785bb6dc6b957c624e62bc64c184409c97d7b/site/scripts/import-contentful-export.mjs#L1-L31","documentation":"Usage guard in site/scripts/import-contentful-export.mjs: the script expects exactly two positional CLI arguments — the directory of the Contentful preview export and the directory of the delivery export — and throws this usage line as an Error when either is missing.","triggerScenarios":"Running node site/scripts/import-contentful-export.mjs with zero or one argument; quoting mistakes that collapse the two paths into one; running from a script runner that drops positional args.","commonSituations":"New contributor running the docs-import script for the first time; CI job or npm script not forwarding arguments; shell aliases that swallow the second path.","solutions":["Invoke with both export directories: node site/scripts/import-contentful-export.mjs <preview-export> <delivery-export>","If wrapped in an npm script, pass args through with \"--\": npm run import:contentful -- ./tmp/preview ./tmp/delivery","Confirm both directories exist and contain the Contentful export JSON before running"],"exampleFix":"# before\nnode site/scripts/import-contentful-export.mjs\n\n# after\nnode site/scripts/import-contentful-export.mjs ./tmp/contentful-preview ./tmp/contentful-delivery","handlingStrategy":"validation","validationCode":"const [previewDirectory, deliveryDirectory] = process.argv.slice(2)\nif (!previewDirectory || !deliveryDirectory) {\n  console.error(\"Usage: node site/scripts/import-contentful-export.mjs <preview-export> <delivery-export>\")\n  process.exit(1)\n}\n// plus: assert both directories exist via stat() before doing work","typeGuard":null,"tryCatchPattern":"try {\n  execFileSync(\"node\", [script, previewDir, deliveryDir], { stdio: \"inherit\" })\n} catch (error) {\n  // non-zero exit with the usage line means arguments were not forwarded; check wrapper quoting\n}","preventionTips":["Invoke the script with both export directory paths every time","Forward arguments through npm scripts with --","Validate that the directories exist before running the import"],"tags":["cli","contentful","scripts","usage"],"backgroundTag":null,"analyzedSha":"031785bb6dc6b957c624e62bc64c184409c97d7b","analyzedAt":"2026-08-16T06:24:09.996Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}