@frigear-nu/cli 0.2.9 → 0.3.0
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/chunks/upgrade.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import consola from 'consola';
|
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { readFile, writeFile, readdir, stat, mkdir, rename } from 'node:fs/promises';
|
|
5
5
|
import { join, basename, relative, dirname, resolve } from 'node:path';
|
|
6
|
-
import { parseModule } from 'magicast';
|
|
6
|
+
import { parseModule, generateCode } from 'magicast';
|
|
7
7
|
import { getDefaultExportOptions } from 'magicast/helpers';
|
|
8
8
|
import { m as isBetween, n as duplicateVersions, s as sharedDuplicates, d as defineCommandArgs, f as findWorkspaceRoot, o as manifestFiles, q as findPins, u as currentVersions, v as compareVersions, x as rewritePins, y as movePatchedDependencies } from '../shared/cli.A6PoFRmM.mjs';
|
|
9
9
|
import { p as parseTargets, l as latestVersion } from '../shared/cli.Dh9sTqNx.mjs';
|
|
@@ -127,6 +127,61 @@ const accountComponents = {
|
|
|
127
127
|
]
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
+
const documentPaths = (documents) => items(documents).map((document) => option(document, "path")).filter((path) => typeof path === "string");
|
|
131
|
+
const accountDocuments = {
|
|
132
|
+
id: "account-documents",
|
|
133
|
+
package: "@frigear-nu/account",
|
|
134
|
+
since: "0.7.0",
|
|
135
|
+
title: "The account documents page moved to @frigear-nu/documents",
|
|
136
|
+
docs: `${DOCS}/modules/content/documents`,
|
|
137
|
+
rules: [
|
|
138
|
+
{
|
|
139
|
+
pattern: /(['"`])\/account\/documents\b/g,
|
|
140
|
+
message: "`/account/documents` is gone: link to the documents page of `@frigear-nu/documents` (`/dashboard/documents` by default) instead."
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
steps: [
|
|
144
|
+
"Install `@frigear-nu/documents` (`frigear-nu add documents`) and upload the files the account listed through `/admin/documents`, shared with the same people (signed-in users, or a role in place of the old `permission`). Then delete them from `public/`, where anyone with the URL could fetch them.",
|
|
145
|
+
"Remove the permissions the app registered only for account documents (in `authentication.permissions` and the roles' `grant`)."
|
|
146
|
+
],
|
|
147
|
+
async project({ root, files, dryRun }) {
|
|
148
|
+
const applied = [];
|
|
149
|
+
const manual = [];
|
|
150
|
+
for (const file of nuxtConfigs(files)) {
|
|
151
|
+
const at = relative(root, file);
|
|
152
|
+
let mod;
|
|
153
|
+
let options;
|
|
154
|
+
try {
|
|
155
|
+
mod = parseModule(await readFile(file, "utf-8"));
|
|
156
|
+
options = getDefaultExportOptions(mod);
|
|
157
|
+
} catch {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const settings = option(options, "account.settings");
|
|
161
|
+
if (!settings) continue;
|
|
162
|
+
const pages = option(settings, "pages");
|
|
163
|
+
const removed = [];
|
|
164
|
+
const paths = documentPaths(settings.documents);
|
|
165
|
+
if (settings.documents !== void 0) {
|
|
166
|
+
delete settings.documents;
|
|
167
|
+
removed.push("`account.settings.documents`");
|
|
168
|
+
}
|
|
169
|
+
if (pages?.documents !== void 0) {
|
|
170
|
+
delete pages.documents;
|
|
171
|
+
removed.push("`account.settings.pages.documents`");
|
|
172
|
+
}
|
|
173
|
+
if (!removed.length) continue;
|
|
174
|
+
if (!dryRun) await writeFile(file, `${generateCode(mod).code.trimEnd()}
|
|
175
|
+
`, "utf-8");
|
|
176
|
+
applied.push(`${at}: removed ${removed.join(" and ")}`);
|
|
177
|
+
if (paths.length) {
|
|
178
|
+
manual.push(`${at}: the account listed ${paths.map((path) => `\`${path}\``).join(", ")}. Upload them through \`/admin/documents\` of \`@frigear-nu/documents\`, shared with the same people, then delete them from \`public/\`.`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return { applied, manual };
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
130
185
|
const GUIDE = `${DOCS}/guide/going-further/migrate-access-control`;
|
|
131
186
|
const authPermissions = {
|
|
132
187
|
id: "auth-permissions",
|
|
@@ -519,6 +574,45 @@ const oauthServerApplicationsPage = {
|
|
|
519
574
|
return { manual };
|
|
520
575
|
}
|
|
521
576
|
};
|
|
577
|
+
const teamsProjects = {
|
|
578
|
+
id: "teams-projects",
|
|
579
|
+
package: "@frigear-nu/teams",
|
|
580
|
+
since: "0.2.0",
|
|
581
|
+
title: "Projects are their own records, not a team kind",
|
|
582
|
+
docs: `${DOCS}/modules/organisation/teams#projects`,
|
|
583
|
+
schema: true,
|
|
584
|
+
rules: [
|
|
585
|
+
{
|
|
586
|
+
pattern: /\bPROJECT_TEAM_KIND\b/g,
|
|
587
|
+
message: "Removed: projects are no team kind any more. Use the project routes (`teamsApi.admin.projects`, `teamsApi.publicProjects`) instead of teams of kind `project`."
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
pattern: /\bkind:\s*['"]project['"]/g,
|
|
591
|
+
message: "The shipped `project` ladder is gone: a seeded or created team of kind `project` fails (no ladder). Move seeds to `teams.seed.projects` (no `kind`), or define a `project` ladder of your own."
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
pattern: /\/api\/admin\/teams\/[^'"`\s]*\/contributions\b|\bteamsApi\.admin\.contributions?\b/g,
|
|
595
|
+
message: "The `contributions` routes are removed: teams are linked to a project with `/api/admin/projects/:id/teams` (`teamsApi.admin.projectTeams(id)`), and a team's projects are read with `teamsApi.admin.teamProjects(id)`."
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
pattern: /\b(?:useTeamContributionActions|TeamContributionSlideover)\b/g,
|
|
599
|
+
message: "Removed: use `useProjectTeamActions(project)` (and `ProjectTeamSlideover`) on the project page."
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
pattern: /\.(?:contributors|workingOn)\b/g,
|
|
603
|
+
message: "The public team DTO has `projects` (the public projects it works on) instead of `contributors` and `workingOn`. Check this is the teams DTO.",
|
|
604
|
+
files: /\.(?:vue|ts)$/
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
pattern: /\bmultipleSections\b/g,
|
|
608
|
+
message: '`public.teams.multipleSections` is removed: the admin always says "Teams"; projects have their own admin page (`settings.pages.adminProjects`).'
|
|
609
|
+
}
|
|
610
|
+
],
|
|
611
|
+
steps: [
|
|
612
|
+
"Turn on the project admin pages with `teams.settings.pages.adminProjects` and `adminProject` (`true`), next to `admin` and `adminTeam`.",
|
|
613
|
+
"Generate the app's migration and edit it to copy teams of kind `project` into `projects` (their members into `project_members`, their links into `project_teams`) before `team_contributions` is dropped, then delete those teams and the `project` ladder row. Uploaded images are not moved: upload them again."
|
|
614
|
+
]
|
|
615
|
+
};
|
|
522
616
|
|
|
523
617
|
const SERVER_AUTH = ["@frigear-nu/auth", "@frigear-nu/users", "@frigear-nu/oauth-server"];
|
|
524
618
|
const hasServerSessions = async (config, options) => {
|
|
@@ -587,7 +681,9 @@ const migrations = [
|
|
|
587
681
|
oauthServerApplicationsPage,
|
|
588
682
|
moduleKitPreload,
|
|
589
683
|
uiPreload,
|
|
590
|
-
authBootstrapRoute
|
|
684
|
+
authBootstrapRoute,
|
|
685
|
+
teamsProjects,
|
|
686
|
+
accountDocuments
|
|
591
687
|
];
|
|
592
688
|
|
|
593
689
|
const code = (text) => `\`${text.replace(/`/g, "'")}\``;
|
package/dist/cli.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { m as default, a as mainCmd } from './shared/cli.
|
|
1
|
+
export { m as default, a as mainCmd } from './shared/cli.IEy-SSS4.mjs';
|
|
2
2
|
export { PLATFORMS, STARTERS, default as initCmd, resolveStarter } from './chunks/init.mjs';
|
|
3
3
|
export { m as migrations, u as upgradeWorkspace } from './chunks/upgrade.mjs';
|
|
4
4
|
export { a as addPlatform, f as fillPlaceholders, m as mergeRootScripts, p as platformScripts, r as resolveAppScope, b as resolvePlatform, c as resolveTemplateSource } from './shared/cli._jTVAy9s.mjs';
|