@cedarjs/cli-helpers 0.8.1-next.0 → 0.9.0-rc.5
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/auth/authTasks.js
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
isTypeScriptProject
|
|
12
12
|
} from "../lib/project.js";
|
|
13
13
|
import { apiSideFiles, generateUniqueFileNames } from "./authFiles.js";
|
|
14
|
-
const AUTH_PROVIDER_HOOK_IMPORT = `import { AuthProvider, useAuth } from './auth'`;
|
|
15
|
-
const AUTH_HOOK_IMPORT = `import { useAuth } from './auth'`;
|
|
14
|
+
const AUTH_PROVIDER_HOOK_IMPORT = `import { AuthProvider, useAuth } from './auth.js'`;
|
|
15
|
+
const AUTH_HOOK_IMPORT = `import { useAuth } from './auth.js'`;
|
|
16
16
|
const getWebAppPath = () => getPaths().web.app;
|
|
17
17
|
function addAuthDecoderToCreateGraphQLHandler(content) {
|
|
18
18
|
if (!new RegExp("(?=(^.*?createGraphQLHandler))\\1.*\\bauthDecoder", "s").test(
|
|
@@ -53,13 +53,13 @@ const addApiConfig = ({
|
|
|
53
53
|
newContent = addAuthDecoderToCreateGraphQLHandler(newContent);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
const hasCurrentUserImport = /(^import {.*?getCurrentUser(?!getCurrentUser).*?} from ['"]src\/lib\/auth['"])/s.test(
|
|
56
|
+
const hasCurrentUserImport = /(^import {.*?getCurrentUser(?!getCurrentUser).*?} from ['"]src\/lib\/auth(?:\.js)?['"])/s.test(
|
|
57
57
|
newContent
|
|
58
58
|
);
|
|
59
59
|
if (!hasCurrentUserImport) {
|
|
60
60
|
newContent = newContent.replace(
|
|
61
|
-
/^(import { db } from ['"]src\/lib\/db['"])$/m,
|
|
62
|
-
`import { getCurrentUser } from 'src/lib/auth'
|
|
61
|
+
/^(import { db } from ['"]src\/lib\/db(?:\.js)?['"])$/m,
|
|
62
|
+
`import { getCurrentUser } from 'src/lib/auth.js'
|
|
63
63
|
$1`
|
|
64
64
|
);
|
|
65
65
|
newContent = newContent.replace(
|
|
@@ -49,8 +49,8 @@ var import_lib = require("../lib/index.js");
|
|
|
49
49
|
var import_paths = require("../lib/paths.js");
|
|
50
50
|
var import_project = require("../lib/project.js");
|
|
51
51
|
var import_authFiles = require("./authFiles.js");
|
|
52
|
-
const AUTH_PROVIDER_HOOK_IMPORT = `import { AuthProvider, useAuth } from './auth'`;
|
|
53
|
-
const AUTH_HOOK_IMPORT = `import { useAuth } from './auth'`;
|
|
52
|
+
const AUTH_PROVIDER_HOOK_IMPORT = `import { AuthProvider, useAuth } from './auth.js'`;
|
|
53
|
+
const AUTH_HOOK_IMPORT = `import { useAuth } from './auth.js'`;
|
|
54
54
|
const getWebAppPath = () => (0, import_paths.getPaths)().web.app;
|
|
55
55
|
function addAuthDecoderToCreateGraphQLHandler(content) {
|
|
56
56
|
if (!new RegExp("(?=(^.*?createGraphQLHandler))\\1.*\\bauthDecoder", "s").test(
|
|
@@ -91,13 +91,13 @@ const addApiConfig = ({
|
|
|
91
91
|
newContent = addAuthDecoderToCreateGraphQLHandler(newContent);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const hasCurrentUserImport = /(^import {.*?getCurrentUser(?!getCurrentUser).*?} from ['"]src\/lib\/auth['"])/s.test(
|
|
94
|
+
const hasCurrentUserImport = /(^import {.*?getCurrentUser(?!getCurrentUser).*?} from ['"]src\/lib\/auth(?:\.js)?['"])/s.test(
|
|
95
95
|
newContent
|
|
96
96
|
);
|
|
97
97
|
if (!hasCurrentUserImport) {
|
|
98
98
|
newContent = newContent.replace(
|
|
99
|
-
/^(import { db } from ['"]src\/lib\/db['"])$/m,
|
|
100
|
-
`import { getCurrentUser } from 'src/lib/auth'
|
|
99
|
+
/^(import { db } from ['"]src\/lib\/db(?:\.js)?['"])$/m,
|
|
100
|
+
`import { getCurrentUser } from 'src/lib/auth.js'
|
|
101
101
|
$1`
|
|
102
102
|
);
|
|
103
103
|
newContent = newContent.replace(
|