create-ampless 1.0.0-alpha.41 → 1.0.0-alpha.42
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.js +15 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1747,6 +1747,11 @@ var AMPLESS_MANAGED_APP_PATHS = [
|
|
|
1747
1747
|
"app/login",
|
|
1748
1748
|
"app/site"
|
|
1749
1749
|
];
|
|
1750
|
+
var AMPLESS_RETIRED_PATHS = [
|
|
1751
|
+
// Retired in alpha.20+ along with the in-deploy multi-site drop (PR #93).
|
|
1752
|
+
"lib/admin-site.ts",
|
|
1753
|
+
"lib/admin-site-client.ts"
|
|
1754
|
+
];
|
|
1750
1755
|
var AMPLESS_PACKAGES = /* @__PURE__ */ new Set([
|
|
1751
1756
|
"ampless",
|
|
1752
1757
|
"@ampless/admin",
|
|
@@ -1898,7 +1903,7 @@ async function pruneEmptyDirs(root) {
|
|
|
1898
1903
|
await rm2(root, { recursive: true, force: true });
|
|
1899
1904
|
}
|
|
1900
1905
|
}
|
|
1901
|
-
async function
|
|
1906
|
+
async function findObsoleteFiles(destDir, sharedDir) {
|
|
1902
1907
|
const obsolete = [];
|
|
1903
1908
|
for (const managedPath of AMPLESS_MANAGED_APP_PATHS) {
|
|
1904
1909
|
const userPath = join3(destDir, managedPath);
|
|
@@ -1912,9 +1917,15 @@ async function findObsoleteAppFiles(destDir, sharedDir) {
|
|
|
1912
1917
|
}
|
|
1913
1918
|
}
|
|
1914
1919
|
}
|
|
1920
|
+
for (const retiredPath of AMPLESS_RETIRED_PATHS) {
|
|
1921
|
+
const userFile = join3(destDir, retiredPath);
|
|
1922
|
+
if (existsSync5(userFile)) {
|
|
1923
|
+
obsolete.push(retiredPath);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1915
1926
|
return obsolete;
|
|
1916
1927
|
}
|
|
1917
|
-
async function
|
|
1928
|
+
async function removeObsoleteFiles(destDir, paths) {
|
|
1918
1929
|
for (const rel of paths) {
|
|
1919
1930
|
const abs = join3(destDir, rel);
|
|
1920
1931
|
if (existsSync5(abs)) {
|
|
@@ -1978,7 +1989,7 @@ async function runUpgradeIn(destDir, sharedDir, opts = {}) {
|
|
|
1978
1989
|
const shippedThemes = themeSyncEnabled ? await listShippedThemes(templatesRoot) : [];
|
|
1979
1990
|
const existingThemes = themeSyncEnabled ? await discoverInstalledThemes(destDir) : [];
|
|
1980
1991
|
const preservedThemes = existingThemes.filter((t) => !shippedThemes.includes(t));
|
|
1981
|
-
const obsoleteFiles = await
|
|
1992
|
+
const obsoleteFiles = await findObsoleteFiles(destDir, sharedDir);
|
|
1982
1993
|
log3.info(
|
|
1983
1994
|
`replace: ${pc3.green(`${replaceNew.length} added`)} / ${pc3.yellow(`${replaceUpdate.length} updated`)}`
|
|
1984
1995
|
);
|
|
@@ -2020,7 +2031,7 @@ async function runUpgradeIn(destDir, sharedDir, opts = {}) {
|
|
|
2020
2031
|
await copyWithSubstitution(src, dst, vars);
|
|
2021
2032
|
}
|
|
2022
2033
|
const themeResult = themeSyncEnabled ? await syncThemes(destDir, templatesRoot) : { synced: [], preserved: [] };
|
|
2023
|
-
await
|
|
2034
|
+
await removeObsoleteFiles(destDir, obsoleteFiles);
|
|
2024
2035
|
const templatePkgRaw = await readFile3(join3(sharedDir, "package.json"), "utf-8");
|
|
2025
2036
|
const templatePkg = JSON.parse(templatePkgRaw);
|
|
2026
2037
|
const indent = detectIndent(projectPkgRaw);
|