framer-code-link 0.21.0-alpha.4 → 0.21.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +25 -8
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -1601,7 +1601,7 @@ var Installer = class {
|
|
|
1601
1601
|
pkg.dependencies = sortDependencyMap(dependencies);
|
|
1602
1602
|
pkg.devDependencies = sortDependencyMap(devDependencies);
|
|
1603
1603
|
await fs.writeFile(packagePath, JSON.stringify(pkg, null, 4));
|
|
1604
|
-
|
|
1604
|
+
success("Updated dependencies. Run your package manager to install them.");
|
|
1605
1605
|
debug(`Updated package.json dependency versions for ${uniquePackageNames.join(", ")}`);
|
|
1606
1606
|
}
|
|
1607
1607
|
/**
|
|
@@ -1883,19 +1883,30 @@ function isPlainObject(value) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
/**
|
|
1885
1885
|
* Reads package.json, migrates legacy top-level Code Link fields into `codeLink`,
|
|
1886
|
-
*
|
|
1886
|
+
* backfills any provided defaults for missing `codeLink` fields, and persists
|
|
1887
|
+
* when anything changed.
|
|
1887
1888
|
*/
|
|
1888
|
-
async function readAndMigratePackageJson(packageJsonPath) {
|
|
1889
|
+
async function readAndMigratePackageJson(packageJsonPath, defaults) {
|
|
1889
1890
|
try {
|
|
1890
1891
|
const raw = await fs.readFile(packageJsonPath, "utf-8");
|
|
1891
1892
|
const parsed = JSON.parse(raw);
|
|
1892
1893
|
if (!isPlainObject(parsed)) return null;
|
|
1893
|
-
|
|
1894
|
+
const hadLegacy = "shortProjectHash" in parsed || "framerProjectName" in parsed || "codeLinkNpmStrategy" in parsed;
|
|
1894
1895
|
const existing = parsed.codeLink;
|
|
1895
1896
|
const base = isPlainObject(existing) ? { ...existing } : {};
|
|
1896
1897
|
if (parsed.shortProjectHash !== void 0 && base.shortProjectHash === void 0) base.shortProjectHash = parsed.shortProjectHash;
|
|
1897
1898
|
if (parsed.framerProjectName !== void 0 && base.framerProjectName === void 0) base.framerProjectName = parsed.framerProjectName;
|
|
1898
1899
|
if (parsed.codeLinkNpmStrategy !== void 0 && base.npmStrategy === void 0) base.npmStrategy = parsed.codeLinkNpmStrategy;
|
|
1900
|
+
let backfilled = false;
|
|
1901
|
+
if (defaults?.shortProjectHash !== void 0 && base.shortProjectHash === void 0) {
|
|
1902
|
+
base.shortProjectHash = defaults.shortProjectHash;
|
|
1903
|
+
backfilled = true;
|
|
1904
|
+
}
|
|
1905
|
+
if (defaults?.framerProjectName !== void 0 && base.framerProjectName === void 0) {
|
|
1906
|
+
base.framerProjectName = defaults.framerProjectName;
|
|
1907
|
+
backfilled = true;
|
|
1908
|
+
}
|
|
1909
|
+
if (!hadLegacy && !backfilled) return parsed;
|
|
1899
1910
|
const next = { ...parsed };
|
|
1900
1911
|
delete next.shortProjectHash;
|
|
1901
1912
|
delete next.framerProjectName;
|
|
@@ -1934,10 +1945,16 @@ async function findOrCreateProjectDirectory(options) {
|
|
|
1934
1945
|
}
|
|
1935
1946
|
const cwd = baseDirectory ?? process.cwd();
|
|
1936
1947
|
const existing = await findExistingProjectDirectory(cwd, projectHash);
|
|
1937
|
-
if (existing)
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1948
|
+
if (existing) {
|
|
1949
|
+
await readAndMigratePackageJson(path.join(existing, "package.json"), {
|
|
1950
|
+
shortProjectHash: shortProjectHash(projectHash),
|
|
1951
|
+
framerProjectName: projectName
|
|
1952
|
+
});
|
|
1953
|
+
return {
|
|
1954
|
+
directory: existing,
|
|
1955
|
+
created: false
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1941
1958
|
if (!projectName) throw new Error("Failed to get Project name. Pass --name <project name>.");
|
|
1942
1959
|
const directoryName = toDirectoryName(projectName);
|
|
1943
1960
|
const pkgName = toPackageName(projectName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-code-link",
|
|
3
|
-
"version": "0.21.0-alpha.
|
|
3
|
+
"version": "0.21.0-alpha.6",
|
|
4
4
|
"description": "CLI tool for syncing Framer code components - controller-centric architecture",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@typescript/ata": "^0.9.8",
|
|
27
27
|
"chokidar": "^5.0.0",
|
|
28
28
|
"commander": "^14.0.3",
|
|
29
|
-
"parse-imports": "^3.0.0",
|
|
30
29
|
"prettier": "^3.7.4",
|
|
31
30
|
"typescript": "^5.9.3",
|
|
32
31
|
"ws": "^8.18.3"
|