vercel-builder icon indicating copy to clipboard operation
vercel-builder copied to clipboard

ServerFiles Metadata

Open pablomuro opened this issue 3 years ago • 3 comments

Hi, I think that in the building process of the serverFiles, the metadata of the files are being lost or Vercel create new files on the server.

I'm using nuxt/content module an the "createdAt" property from my .MD files in "blog-posts/**" are returning 1970-01-01T00:00:00.000Z

my vercel.json

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.ts",
      "use": "@nuxtjs/[email protected]",
      "config": {
        "serverFiles": [
          "lang/**",
          "utils/**",
          "myData.json",
          "nuxt.default.config.js",
          "node.tsconfig.json",
          "assets/images/**",
          "blog-posts/**"
        ],
        "tscOptions": {
          "skipLibCheck": true
        }
      }
    }
  ]
}

pablomuro avatar Mar 29 '21 01:03 pablomuro

I've got the same issue, did you manage to fix this @pablomuro?

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": [
          "package.json",
          "utils/getRoutes.js",
          "utils/getSiteMeta.js",
          ".nuxt/content/**",
          "content/**",
          "api/**/*.js"
        ],
        "generateStaticRoutes": true
      }
    },
    {
      "src": "api/**/*.js",
      "use": "@vercel/node"
    }
  ],
  "routes" : [
...
}

gilesbutler avatar Sep 08 '21 21:09 gilesbutler

@gilesbutler I did some "hack", I now have a new field in my .MD files to read the createdAt, and for updateAt I created a GitHub Action (https://github.com/pablomuro/pablomuro-blog/blob/main/.github/workflows/posts-update.yml), so when I update a .MD file, the action change the updateAt field and commit the file

Cause I didn't find any configuration or anything like on vercel to fix this

pablomuro avatar Sep 10 '21 11:09 pablomuro

Thanks @pablomuro 👍 I'll take a look

gilesbutler avatar Sep 15 '21 01:09 gilesbutler