Skip to content

Commit 83f5fa3

Browse files
committed
fix(publish): reject duplicate versions and validate vix.json before publish
2 parents 31fc014 + fbd8d5c commit 83f5fa3

File tree

13 files changed

+1672
-596
lines changed

13 files changed

+1672
-596
lines changed

include/vix/cli/util/Lockfile.hpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
*
3+
* @file Lockfile.hpp
4+
* @author Gaspard Kirira
5+
*
6+
* Copyright 2025, Gaspard Kirira. All rights reserved.
7+
* https://github.com/vixcpp/vix
8+
* Use of this source code is governed by a MIT license
9+
* that can be found in the License file.
10+
*
11+
* Vix.cpp
12+
*/
13+
#ifndef VIX_CLI_UTIL_LOCKFILE_HPP
14+
#define VIX_CLI_UTIL_LOCKFILE_HPP
15+
16+
#include <filesystem>
17+
#include <string>
18+
#include <vector>
19+
20+
namespace vix::cli::util::lockfile
21+
{
22+
struct LockedDependency
23+
{
24+
std::string id;
25+
std::string requested;
26+
std::string version;
27+
std::string repo;
28+
std::string tag;
29+
std::string commit;
30+
std::string hash;
31+
};
32+
33+
void write_lockfile_replace_all_or_throw(
34+
const std::filesystem::path &lockPath,
35+
const std::vector<LockedDependency> &dependencies);
36+
}
37+
38+
#endif

include/vix/cli/util/Manifest.hpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
*
3+
* @file Manifest.hpp
4+
* @author Gaspard Kirira
5+
*
6+
* Copyright 2025, Gaspard Kirira. All rights reserved.
7+
* https://github.com/vixcpp/vix
8+
* Use of this source code is governed by a MIT license
9+
* that can be found in the License file.
10+
*
11+
* Vix.cpp
12+
*/
13+
#ifndef VIX_CLI_UTIL_MANIFEST_HPP
14+
#define VIX_CLI_UTIL_MANIFEST_HPP
15+
16+
#include <filesystem>
17+
#include <string>
18+
#include <vector>
19+
20+
namespace vix::cli::util::manifest
21+
{
22+
struct Dependency
23+
{
24+
std::string id;
25+
std::string requested;
26+
};
27+
28+
struct Manifest
29+
{
30+
std::vector<Dependency> dependencies;
31+
};
32+
33+
Manifest read_manifest_or_throw(const std::filesystem::path &manifestPath);
34+
35+
std::vector<Dependency> read_manifest_dependencies_or_throw(
36+
const std::filesystem::path &manifestPath);
37+
38+
void write_manifest_or_throw(
39+
const std::filesystem::path &manifestPath,
40+
const Manifest &manifest);
41+
42+
void upsert_manifest_dependency_or_throw(
43+
const std::filesystem::path &manifestPath,
44+
const Dependency &dependency);
45+
}
46+
47+
#endif

include/vix/cli/util/Resolver.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
*
3+
* @file Resolver.hpp
4+
* @author Gaspard Kirira
5+
*
6+
* Copyright 2025, Gaspard Kirira. All rights reserved.
7+
* https://github.com/vixcpp/vix
8+
* Use of this source code is governed by a MIT license
9+
* that can be found in the License file.
10+
*
11+
* Vix.cpp
12+
*/
13+
#ifndef VIX_CLI_UTIL_RESOLVER_HPP
14+
#define VIX_CLI_UTIL_RESOLVER_HPP
15+
16+
#include <vix/cli/util/Lockfile.hpp>
17+
#include <vix/cli/util/Manifest.hpp>
18+
19+
#include <vector>
20+
21+
namespace vix::cli::util::resolver
22+
{
23+
std::vector<vix::cli::util::lockfile::LockedDependency>
24+
resolve_project_dependencies_or_throw(
25+
const std::vector<vix::cli::util::manifest::Dependency> &manifestDependencies);
26+
}
27+
28+
#endif

0 commit comments

Comments
 (0)