fix: Booking atom phone booking field and booking fields order (#18678)
* chore: examples app make managed user admin * fix: phone field not appearing * fix: booking fields order * feat: local libraries setup script * chore: add log when parsing booking field fails * fix: backwards compatbile name booking field * chore: libraries publish support scripts * chore: bump libraries * docs * fix: phone default field return label and placeholder * fix: e2e tests
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const VERSION = "9.9.9";
|
||||
|
||||
// note(Lauris): update libraries package.json version
|
||||
const librariesPath = path.join(__dirname, "..");
|
||||
const librariesPackageJsonPath = path.join(librariesPath, "package.json");
|
||||
const librariesPackageJson = JSON.parse(fs.readFileSync(librariesPackageJsonPath, "utf8"));
|
||||
|
||||
librariesPackageJson.version = VERSION;
|
||||
|
||||
fs.writeFileSync(librariesPackageJsonPath, `${JSON.stringify(librariesPackageJson, null, 2)}\n`);
|
||||
|
||||
// note(Lauris): update API v2 package.json dependency
|
||||
const apiV2PackageJsonPath = path.join(librariesPath, "..", "..", "..", "apps", "api", "v2", "package.json");
|
||||
const apiV2PackageJson = JSON.parse(fs.readFileSync(apiV2PackageJsonPath, "utf8"));
|
||||
|
||||
apiV2PackageJson.dependencies["@calcom/platform-libraries"] = `npm:@calcom/platform-libraries@${VERSION}`;
|
||||
|
||||
fs.writeFileSync(apiV2PackageJsonPath, `${JSON.stringify(apiV2PackageJson, null, 2)}\n`);
|
||||
@@ -0,0 +1,58 @@
|
||||
import { spawn } from "child_process";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// Get the published version before resetting
|
||||
const librariesPath = path.join(__dirname, "..");
|
||||
const librariesPackageJsonPath = path.join(librariesPath, "package.json");
|
||||
const librariesPackageJson = JSON.parse(fs.readFileSync(librariesPackageJsonPath, "utf8"));
|
||||
const publishedVersion = librariesPackageJson.version;
|
||||
|
||||
// Reset libraries package.json version to 0.0.0
|
||||
librariesPackageJson.version = "0.0.0";
|
||||
fs.writeFileSync(librariesPackageJsonPath, `${JSON.stringify(librariesPackageJson, null, 2)}\n`);
|
||||
|
||||
// Update API v2 package.json dependency
|
||||
const apiV2PackageJsonPath = path.join(
|
||||
librariesPath,
|
||||
"..",
|
||||
"..",
|
||||
"..",
|
||||
"apps",
|
||||
"api",
|
||||
"v2",
|
||||
"package.json"
|
||||
);
|
||||
const apiV2PackageJson = JSON.parse(fs.readFileSync(apiV2PackageJsonPath, "utf8"));
|
||||
|
||||
apiV2PackageJson.dependencies[
|
||||
"@calcom/platform-libraries"
|
||||
] = `npm:@calcom/platform-libraries@${publishedVersion}`;
|
||||
fs.writeFileSync(apiV2PackageJsonPath, `${JSON.stringify(apiV2PackageJson, null, 2)}\n`);
|
||||
|
||||
// Run yarn install
|
||||
const yarnInstall = spawn("yarn", ["install"], {
|
||||
stdio: "inherit",
|
||||
cwd: path.join(librariesPath, "..", "..", ".."),
|
||||
});
|
||||
|
||||
yarnInstall.on("close", (code) => {
|
||||
if (code !== 0) {
|
||||
console.error("yarn install failed");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("Successfully reset version and updated dependencies");
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,65 @@
|
||||
import fs from "fs";
|
||||
import https from "https";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
// Fetch current version from npm registry
|
||||
function getCurrentVersion() {
|
||||
return new Promise((resolve, reject) => {
|
||||
https
|
||||
.get(
|
||||
"https://registry.npmjs.org/@calcom/platform-libraries",
|
||||
{
|
||||
headers: { Accept: "application/json" },
|
||||
},
|
||||
(res) => {
|
||||
let data = "";
|
||||
res.on("data", (chunk) => (data += chunk));
|
||||
res.on("end", () => {
|
||||
try {
|
||||
const packageInfo = JSON.parse(data);
|
||||
const currentVersion = packageInfo["dist-tags"].latest;
|
||||
resolve(currentVersion);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
.on("error", reject);
|
||||
});
|
||||
}
|
||||
|
||||
// Increment patch version (a.b.c -> a.b.c+1)
|
||||
function incrementPatchVersion(version) {
|
||||
const parts = version.split(".");
|
||||
parts[2] = String(Number(parts[2]) + 1);
|
||||
return parts.join(".");
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// Get and increment version
|
||||
const currentVersion = await getCurrentVersion();
|
||||
const newVersion = incrementPatchVersion(currentVersion);
|
||||
console.log(`Current version in npm: ${currentVersion}. Incremented locally to ${newVersion}`);
|
||||
|
||||
// Update libraries package.json version
|
||||
const librariesPath = path.join(__dirname, "..");
|
||||
const librariesPackageJsonPath = path.join(librariesPath, "package.json");
|
||||
const librariesPackageJson = JSON.parse(fs.readFileSync(librariesPackageJsonPath, "utf8"));
|
||||
|
||||
librariesPackageJson.version = newVersion;
|
||||
fs.writeFileSync(librariesPackageJsonPath, `${JSON.stringify(librariesPackageJson, null, 2)}\n`);
|
||||
|
||||
console.log("Successfully incremented @calcom/platform-libraries package.json version.");
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user