@cedarjs/codemods 2.7.1-next.0 → 2.8.0-rc.37
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/codemods/list.yargs.js +13 -47
- package/dist/codemods/redwood/v2.3.x/tsconfigForRouteHooks/tsconfigForRouteHooks.js +7 -37
- package/dist/codemods/redwood/v2.3.x/tsconfigForRouteHooks/tsconfigForRouteHooks.yargs.js +6 -42
- package/dist/codemods/redwood/v2.x.x/configureFastify/configureFastify.js +3 -23
- package/dist/codemods/redwood/v2.x.x/configureFastify/configureFastify.yargs.js +22 -58
- package/dist/codemods/redwood/v2.x.x/updateResolverTypes/updateResolverTypes.js +6 -26
- package/dist/codemods/redwood/v2.x.x/updateResolverTypes/updateResolverTypes.yargs.js +12 -48
- package/dist/codemods/redwood/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.js +3 -23
- package/dist/codemods/redwood/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.yargs.js +15 -48
- package/dist/codemods/redwood/v4.x.x/useArmor/useArmor.js +3 -23
- package/dist/codemods/redwood/v4.x.x/useArmor/useArmor.yargs.js +12 -48
- package/dist/codemods/redwood/v5.x.x/cellQueryResult/cellQueryResult.js +3 -23
- package/dist/codemods/redwood/v5.x.x/cellQueryResult/cellQueryResult.yargs.js +10 -46
- package/dist/codemods/redwood/v5.x.x/detectEmptyCells/detectEmptyCells.js +12 -31
- package/dist/codemods/redwood/v5.x.x/detectEmptyCells/detectEmptyCells.yargs.js +6 -42
- package/dist/codemods/redwood/v5.x.x/renameValidateWith/renameValidateWith.js +3 -23
- package/dist/codemods/redwood/v5.x.x/renameValidateWith/renameValidateWith.yargs.js +12 -48
- package/dist/codemods/redwood/v5.x.x/updateAuth0ToV2/updateAuth0ToV2.js +3 -23
- package/dist/codemods/redwood/v5.x.x/updateAuth0ToV2/updateAuth0ToV2.yargs.js +15 -51
- package/dist/codemods/redwood/v5.x.x/updateNodeEngineTo18/updateNodeEngineTo18.js +8 -42
- package/dist/codemods/redwood/v5.x.x/updateNodeEngineTo18/updateNodeEngineTo18.yargs.js +6 -42
- package/dist/codemods/redwood/v5.x.x/upgradeToReact18/upgradeToReact18.js +20 -56
- package/dist/codemods/redwood/v5.x.x/upgradeToReact18/upgradeToReact18.yargs.js +14 -46
- package/dist/codemods/redwood/v6.x.x/changeGlobalToGlobalThis/changeGlobalToGlobalThis.js +3 -23
- package/dist/codemods/redwood/v6.x.x/changeGlobalToGlobalThis/changeGlobalToGlobalThis.yargs.js +15 -48
- package/dist/codemods/redwood/v6.x.x/convertJsToJsx/convertJsToJsx.js +5 -35
- package/dist/codemods/redwood/v6.x.x/convertJsToJsx/convertJsToJsx.yargs.js +10 -46
- package/dist/codemods/redwood/v6.x.x/entryClientNullCheck/entryClientNullCheck.js +3 -23
- package/dist/codemods/redwood/v6.x.x/entryClientNullCheck/entryClientNullCheck.yargs.js +12 -48
- package/dist/codemods/redwood/v6.x.x/processEnvDotNotation/processEnvDotNotation.js +3 -23
- package/dist/codemods/redwood/v6.x.x/processEnvDotNotation/processEnvDotNotation.yargs.js +12 -48
- package/dist/codemods/redwood/v6.x.x/replaceComponentSvgs/replaceComponentSvgs.js +20 -50
- package/dist/codemods/redwood/v6.x.x/replaceComponentSvgs/replaceComponentSvgs.yargs.js +12 -48
- package/dist/codemods/redwood/v6.x.x/updateDevFatalErrorPage/updateDevFatalErrorPage.js +15 -49
- package/dist/codemods/redwood/v6.x.x/updateDevFatalErrorPage/updateDevFatalErrorPage.yargs.js +6 -42
- package/dist/codemods/redwood/v6.x.x/updateThemeConfig/updateThemeConfig.js +3 -23
- package/dist/codemods/redwood/v6.x.x/updateThemeConfig/updateThemeConfig.yargs.js +12 -48
- package/dist/codemods/redwood/v7.x.x/updateGraphQLConfig/updateGraphqlConfig.js +8 -42
- package/dist/codemods/redwood/v7.x.x/updateGraphQLConfig/updateGraphqlConfig.yargs.js +6 -42
- package/dist/codemods/v2.3.x/moveGeneratorTemplates/moveGeneratorTemplates.js +15 -45
- package/dist/codemods/v2.3.x/moveGeneratorTemplates/moveGeneratorTemplates.yargs.js +6 -42
- package/dist/codemods/v2.7.x/prismaV7Prep/prismaV7Prep.js +25 -57
- package/dist/codemods/v2.7.x/prismaV7Prep/prismaV7Prep.yargs.js +62 -80
- package/dist/codemods.js +24 -46
- package/dist/lib/cells.js +33 -75
- package/dist/lib/fetchFileFromTemplate.js +5 -25
- package/dist/lib/getFilesWithPattern.js +6 -36
- package/dist/lib/getRootPackageJSON.js +8 -38
- package/dist/lib/isTSProject.js +6 -36
- package/dist/lib/prettify.js +12 -42
- package/dist/lib/runTransform.js +4 -38
- package/dist/lib/ts2js.js +9 -39
- package/package.json +9 -9
|
@@ -1,43 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var list_yargs_exports = {};
|
|
30
|
-
__export(list_yargs_exports, {
|
|
31
|
-
aliases: () => aliases,
|
|
32
|
-
builder: () => builder,
|
|
33
|
-
command: () => command,
|
|
34
|
-
description: () => description,
|
|
35
|
-
handler: () => handler
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(list_yargs_exports);
|
|
38
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
39
|
-
var import_path = __toESM(require("path"));
|
|
40
|
-
var import_yargs_parser = require("yargs-parser");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { decamelize } from "yargs-parser";
|
|
41
4
|
const command = "list <rwVersion>";
|
|
42
5
|
const description = "List available codemods for a specific version";
|
|
43
6
|
const aliases = ["ls"];
|
|
@@ -45,23 +8,26 @@ const builder = (yargs) => {
|
|
|
45
8
|
yargs.positional("rwVersion", {
|
|
46
9
|
type: "string",
|
|
47
10
|
required: true,
|
|
48
|
-
choices:
|
|
49
|
-
|
|
11
|
+
choices: fs.readdirSync(import.meta.dirname).filter(
|
|
12
|
+
// Only list the folders
|
|
13
|
+
(file) => !fs.statSync(path.join(import.meta.dirname, file)).isFile()
|
|
14
|
+
)
|
|
50
15
|
});
|
|
51
16
|
};
|
|
52
17
|
const handler = ({ rwVersion }) => {
|
|
53
18
|
console.log("Listing codemods for", rwVersion);
|
|
54
19
|
console.log();
|
|
55
|
-
const modsForVersion =
|
|
20
|
+
const modsForVersion = fs.readdirSync(
|
|
21
|
+
path.join(import.meta.dirname, rwVersion)
|
|
22
|
+
);
|
|
56
23
|
modsForVersion.forEach((codemod) => {
|
|
57
|
-
console.log(`- npx @cedarjs/codemods ${
|
|
24
|
+
console.log(`- npx @cedarjs/codemods ${decamelize(codemod)}`);
|
|
58
25
|
});
|
|
59
26
|
};
|
|
60
|
-
|
|
61
|
-
0 && (module.exports = {
|
|
27
|
+
export {
|
|
62
28
|
aliases,
|
|
63
29
|
builder,
|
|
64
30
|
command,
|
|
65
31
|
description,
|
|
66
32
|
handler
|
|
67
|
-
}
|
|
33
|
+
};
|
|
@@ -1,42 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var tsconfigForRouteHooks_exports = {};
|
|
30
|
-
__export(tsconfigForRouteHooks_exports, {
|
|
31
|
-
default: () => addApiAliasToTsConfig
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(tsconfigForRouteHooks_exports);
|
|
34
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
35
|
-
var import_prettify = __toESM(require("../../../../lib/prettify"));
|
|
1
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
2
|
+
import prettify from "../../../../lib/prettify.js";
|
|
36
3
|
async function addApiAliasToTsConfig() {
|
|
37
4
|
const ts = await import("typescript");
|
|
38
5
|
const webConfigPath = ts.findConfigFile(
|
|
39
|
-
|
|
6
|
+
getPaths().web.base,
|
|
40
7
|
ts.sys.fileExists
|
|
41
8
|
);
|
|
42
9
|
if (!webConfigPath) {
|
|
@@ -64,7 +31,7 @@ async function addApiAliasToTsConfig() {
|
|
|
64
31
|
ts.sys.writeFile(
|
|
65
32
|
webConfigPath,
|
|
66
33
|
// @NOTE: prettier will remove trailing commas, but whatever
|
|
67
|
-
await (
|
|
34
|
+
await prettify(JSON.stringify(updatedConfig), { parser: "json" })
|
|
68
35
|
);
|
|
69
36
|
} else {
|
|
70
37
|
throw new Error(
|
|
@@ -72,3 +39,6 @@ async function addApiAliasToTsConfig() {
|
|
|
72
39
|
);
|
|
73
40
|
}
|
|
74
41
|
}
|
|
42
|
+
export {
|
|
43
|
+
addApiAliasToTsConfig as default
|
|
44
|
+
};
|
|
@@ -1,51 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var tsconfigForRouteHooks_yargs_exports = {};
|
|
30
|
-
__export(tsconfigForRouteHooks_yargs_exports, {
|
|
31
|
-
command: () => command,
|
|
32
|
-
description: () => description,
|
|
33
|
-
handler: () => handler
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(tsconfigForRouteHooks_yargs_exports);
|
|
36
|
-
var import_tasuku = __toESM(require("tasuku"));
|
|
37
|
-
var import_tsconfigForRouteHooks = __toESM(require("./tsconfigForRouteHooks"));
|
|
1
|
+
import task from "tasuku";
|
|
2
|
+
import addApiAliasToTsConfig from "./tsconfigForRouteHooks.js";
|
|
38
3
|
const command = "tsconfig-for-route-hooks";
|
|
39
4
|
const description = "(v2.3.x->v2.3.x) Allow $api imports in *.routesHooks.ts files";
|
|
40
5
|
const handler = () => {
|
|
41
|
-
(
|
|
42
|
-
(
|
|
6
|
+
task("Tsconfig For Route Hooks", async ({ setOutput }) => {
|
|
7
|
+
addApiAliasToTsConfig();
|
|
43
8
|
setOutput("All done! Run `yarn cedar lint --fix` to prettify your code");
|
|
44
9
|
});
|
|
45
10
|
};
|
|
46
|
-
|
|
47
|
-
0 && (module.exports = {
|
|
11
|
+
export {
|
|
48
12
|
command,
|
|
49
13
|
description,
|
|
50
14
|
handler
|
|
51
|
-
}
|
|
15
|
+
};
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var configureFastify_exports = {};
|
|
20
|
-
__export(configureFastify_exports, {
|
|
21
|
-
default: () => transform
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(configureFastify_exports);
|
|
24
1
|
function transform(file, api) {
|
|
25
2
|
const j = api.jscodeshift;
|
|
26
3
|
const ast = j(file.source);
|
|
@@ -41,3 +18,6 @@ function transform(file, api) {
|
|
|
41
18
|
});
|
|
42
19
|
return ast.toSource();
|
|
43
20
|
}
|
|
21
|
+
export {
|
|
22
|
+
transform as default
|
|
23
|
+
};
|
|
@@ -1,83 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var configureFastify_yargs_exports = {};
|
|
30
|
-
__export(configureFastify_yargs_exports, {
|
|
31
|
-
command: () => command,
|
|
32
|
-
description: () => description,
|
|
33
|
-
handler: () => handler
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(configureFastify_yargs_exports);
|
|
36
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
37
|
-
var import_path = __toESM(require("path"));
|
|
38
|
-
var import_fetch = require("@whatwg-node/fetch");
|
|
39
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
40
|
-
var import_tasuku = __toESM(require("tasuku"));
|
|
41
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
42
|
-
var import_prettify = __toESM(require("../../../../lib/prettify"));
|
|
43
|
-
var import_runTransform = __toESM(require("../../../../lib/runTransform"));
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fetch } from "@whatwg-node/fetch";
|
|
4
|
+
import fg from "fast-glob";
|
|
5
|
+
import task from "tasuku";
|
|
6
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
7
|
+
import prettify from "../../../../lib/prettify.js";
|
|
8
|
+
import runTransform from "../../../../lib/runTransform.js";
|
|
44
9
|
const command = "configure-fastify";
|
|
45
10
|
const description = "(v2.x.x->v2.x.x) Updates api side\u2019s server.config.js to configure Fastify";
|
|
46
11
|
const handler = () => {
|
|
47
|
-
(
|
|
48
|
-
const [API_SERVER_CONFIG_PATH] =
|
|
49
|
-
cwd:
|
|
12
|
+
task("Configure Fastify", async ({ setOutput }) => {
|
|
13
|
+
const [API_SERVER_CONFIG_PATH] = fg.sync("server.config.{js,ts}", {
|
|
14
|
+
cwd: getPaths().api.base,
|
|
50
15
|
absolute: true
|
|
51
16
|
});
|
|
52
|
-
if (
|
|
53
|
-
await (
|
|
54
|
-
transformPath:
|
|
17
|
+
if (fs.existsSync(API_SERVER_CONFIG_PATH)) {
|
|
18
|
+
await runTransform({
|
|
19
|
+
transformPath: path.join(import.meta.dirname, "configureFastify.js"),
|
|
55
20
|
targetPaths: [API_SERVER_CONFIG_PATH]
|
|
56
21
|
});
|
|
57
|
-
|
|
22
|
+
fs.writeFileSync(
|
|
58
23
|
API_SERVER_CONFIG_PATH,
|
|
59
|
-
await (
|
|
24
|
+
await prettify(fs.readFileSync(API_SERVER_CONFIG_PATH, "utf-8"))
|
|
60
25
|
);
|
|
61
26
|
setOutput("All done!");
|
|
62
27
|
} else {
|
|
63
|
-
const res = await
|
|
28
|
+
const res = await fetch(
|
|
64
29
|
"https://raw.githubusercontent.com/cedarjs/cedar/main/packages/create-cedar-app/template/api/server.config.js"
|
|
65
30
|
);
|
|
66
31
|
const text = await res.text();
|
|
67
|
-
const NEW_API_SERVER_CONFIG_PATH =
|
|
68
|
-
|
|
32
|
+
const NEW_API_SERVER_CONFIG_PATH = path.join(
|
|
33
|
+
getPaths().api.base,
|
|
69
34
|
"server.config.js"
|
|
70
35
|
);
|
|
71
|
-
|
|
36
|
+
fs.writeFileSync(NEW_API_SERVER_CONFIG_PATH, await prettify(text));
|
|
72
37
|
setOutput(
|
|
73
38
|
"Done! No server.config.js found, so we updated your project to use the latest version."
|
|
74
39
|
);
|
|
75
40
|
}
|
|
76
41
|
});
|
|
77
42
|
};
|
|
78
|
-
|
|
79
|
-
0 && (module.exports = {
|
|
43
|
+
export {
|
|
80
44
|
command,
|
|
81
45
|
description,
|
|
82
46
|
handler
|
|
83
|
-
}
|
|
47
|
+
};
|
|
@@ -1,30 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var updateResolverTypes_exports = {};
|
|
20
|
-
__export(updateResolverTypes_exports, {
|
|
21
|
-
default: () => transform
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(updateResolverTypes_exports);
|
|
24
|
-
var import_jscodeshift = require("jscodeshift");
|
|
25
|
-
const isTypeReference = (typeAnnotation) => import_jscodeshift.TSTypeReference.check(typeAnnotation);
|
|
1
|
+
import { Identifier, TSTypeReference } from "jscodeshift";
|
|
2
|
+
const isTypeReference = (typeAnnotation) => TSTypeReference.check(typeAnnotation);
|
|
26
3
|
const getTypeName = (node) => {
|
|
27
|
-
return
|
|
4
|
+
return Identifier.check(node.typeName) ? node.typeName.name : null;
|
|
28
5
|
};
|
|
29
6
|
const isWrappedInPartial = (node) => {
|
|
30
7
|
const typeAnnotation = node.typeAnnotation;
|
|
@@ -75,3 +52,6 @@ function transform(file, api) {
|
|
|
75
52
|
});
|
|
76
53
|
return ast.toSource();
|
|
77
54
|
}
|
|
55
|
+
export {
|
|
56
|
+
transform as default
|
|
57
|
+
};
|
|
@@ -1,52 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var updateResolverTypes_yargs_exports = {};
|
|
30
|
-
__export(updateResolverTypes_yargs_exports, {
|
|
31
|
-
command: () => command,
|
|
32
|
-
description: () => description,
|
|
33
|
-
handler: () => handler
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(updateResolverTypes_yargs_exports);
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
38
|
-
var import_tasuku = __toESM(require("tasuku"));
|
|
39
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
40
|
-
var import_runTransform = __toESM(require("../../../../lib/runTransform"));
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fg from "fast-glob";
|
|
3
|
+
import task from "tasuku";
|
|
4
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
5
|
+
import runTransform from "../../../../lib/runTransform.js";
|
|
41
6
|
const command = "update-resolver-types";
|
|
42
7
|
const description = '(v2.x.x->v3.x.x) Wraps types for "relation" resolvers in the bottom of service files';
|
|
43
8
|
const handler = () => {
|
|
44
|
-
(
|
|
45
|
-
await (
|
|
46
|
-
transformPath:
|
|
9
|
+
task("Update Resolver Types", async ({ setOutput }) => {
|
|
10
|
+
await runTransform({
|
|
11
|
+
transformPath: path.join(import.meta.dirname, "updateResolverTypes.js"),
|
|
47
12
|
// Target services written in TS only
|
|
48
|
-
targetPaths:
|
|
49
|
-
cwd:
|
|
13
|
+
targetPaths: fg.sync("**/*.ts", {
|
|
14
|
+
cwd: getPaths().api.services,
|
|
50
15
|
ignore: ["**/node_modules/**", "**/*.test.ts", "**/*.scenarios.ts"],
|
|
51
16
|
absolute: true
|
|
52
17
|
})
|
|
@@ -54,9 +19,8 @@ const handler = () => {
|
|
|
54
19
|
setOutput("All done! Run `yarn cedar lint --fix` to prettify your code");
|
|
55
20
|
});
|
|
56
21
|
};
|
|
57
|
-
|
|
58
|
-
0 && (module.exports = {
|
|
22
|
+
export {
|
|
59
23
|
command,
|
|
60
24
|
description,
|
|
61
25
|
handler
|
|
62
|
-
}
|
|
26
|
+
};
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var updateClerkGetCurrentUser_exports = {};
|
|
20
|
-
__export(updateClerkGetCurrentUser_exports, {
|
|
21
|
-
default: () => transform
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(updateClerkGetCurrentUser_exports);
|
|
24
1
|
const newReturn = `userWithoutPrivateMetadata`;
|
|
25
2
|
const destructureStatement = `const { privateMetadata, ...${newReturn} } = decoded`;
|
|
26
3
|
function transform(file, api) {
|
|
@@ -69,3 +46,6 @@ function transform(file, api) {
|
|
|
69
46
|
lineTerminator: "\n"
|
|
70
47
|
});
|
|
71
48
|
}
|
|
49
|
+
export {
|
|
50
|
+
transform as default
|
|
51
|
+
};
|
package/dist/codemods/redwood/v4.2.x/updateClerkGetCurrentUser/updateClerkGetCurrentUser.yargs.js
CHANGED
|
@@ -1,58 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var updateClerkGetCurrentUser_yargs_exports = {};
|
|
30
|
-
__export(updateClerkGetCurrentUser_yargs_exports, {
|
|
31
|
-
command: () => command,
|
|
32
|
-
description: () => description,
|
|
33
|
-
handler: () => handler
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(updateClerkGetCurrentUser_yargs_exports);
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_tasuku = __toESM(require("tasuku"));
|
|
38
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
39
|
-
var import_isTSProject = __toESM(require("../../../../lib/isTSProject"));
|
|
40
|
-
var import_runTransform = __toESM(require("../../../../lib/runTransform"));
|
|
1
|
+
import path from "path";
|
|
2
|
+
import task from "tasuku";
|
|
3
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
+
import isTSProject from "../../../../lib/isTSProject.js";
|
|
5
|
+
import runTransform from "../../../../lib/runTransform.js";
|
|
41
6
|
const command = "update-clerk-get-current-user";
|
|
42
7
|
const description = "(v4.1.x->v4.2.x) For Clerk users; updates the getCurrentUser function";
|
|
43
8
|
const handler = () => {
|
|
44
|
-
(
|
|
45
|
-
const authFile =
|
|
46
|
-
await (
|
|
47
|
-
transformPath:
|
|
48
|
-
|
|
9
|
+
task("Update getCurrentUser", async ({ setOutput }) => {
|
|
10
|
+
const authFile = isTSProject ? "auth.ts" : "auth.js";
|
|
11
|
+
await runTransform({
|
|
12
|
+
transformPath: path.join(
|
|
13
|
+
import.meta.dirname,
|
|
14
|
+
"updateClerkGetCurrentUser.js"
|
|
15
|
+
),
|
|
16
|
+
targetPaths: [path.join(getPaths().api.base, "src", "lib", authFile)]
|
|
49
17
|
});
|
|
50
18
|
setOutput("All done! Run `yarn cedar lint --fix` to prettify your code");
|
|
51
19
|
});
|
|
52
20
|
};
|
|
53
|
-
|
|
54
|
-
0 && (module.exports = {
|
|
21
|
+
export {
|
|
55
22
|
command,
|
|
56
23
|
description,
|
|
57
24
|
handler
|
|
58
|
-
}
|
|
25
|
+
};
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useArmor_exports = {};
|
|
20
|
-
__export(useArmor_exports, {
|
|
21
|
-
default: () => transform
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useArmor_exports);
|
|
24
1
|
function transform(file, api) {
|
|
25
2
|
const j = api.jscodeshift;
|
|
26
3
|
const ast = j(file.source);
|
|
@@ -61,3 +38,6 @@ function transform(file, api) {
|
|
|
61
38
|
lineTerminator: "\n"
|
|
62
39
|
});
|
|
63
40
|
}
|
|
41
|
+
export {
|
|
42
|
+
transform as default
|
|
43
|
+
};
|