Hard code the Strapi administrator

Thanks for the code. Just a small tip: You can double check ROLE info :

// Check if admin user exists
  const hasAdmin = await strapi.service("admin::user").exists();
  if (hasAdmin) {
    return;
  }

  // Check is super admin role exists
  let superAdminRole = await strapi.service("admin::role").getSuperAdmin();
  if (!superAdminRole) {
    try {
      console.log("role does not exists, creating role");
      await strapi.service("admin::role").create({
        name: "Super Admin",
        code: "strapi-super-admin",
        description:
          "Super Admins can access and manage all features and settings.",
      });
    } catch (error) {
      console.log("Could not create admin role");
      console.error(error);
    }

    superAdminRole = await strapi.service("admin::role").getSuperAdmin();
    if (!superAdminRole) {
      console.log("can't create the role. Skiping user creation");
      return;
    }
  }

  try {
    // Create admin account
    console.log("Setting up admin user...");
    await strapi.service("admin::user").create({
      ...userData,
      registrationToken: null,
      roles: superAdminRole ? [superAdminRole.id] : [],
    });
    console.info("Admin Account created");
  } catch (error) {
    console.log("Could not create admin user");
    console.error(error);
  }

With your code the user was created withou role.