mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix build
This commit is contained in:
parent
390333f05f
commit
d9acb302ab
@ -71,6 +71,10 @@ module.exports = {
|
||||
selector: 'SwitchCase > *.consequent[type!="BlockStatement"]',
|
||||
message: "Switch cases without blocks are disallowed.",
|
||||
},
|
||||
{
|
||||
selector: "CallExpression[callee.property.name='catch'] > MemberExpression[object.name='console'][property.name='error']",
|
||||
message: "Don't do .catch(console.error). Please handle errors explicitly, eg. with runAsynchronously<WithAlert> or process.exit(1).",
|
||||
},
|
||||
{
|
||||
selector:
|
||||
"MemberExpression:has(Identifier[name='yupString']) > Identifier[name='url']",
|
||||
|
||||
@ -21,7 +21,10 @@ export default function Page() {
|
||||
setPlayList(data);
|
||||
}
|
||||
|
||||
getPlayList().catch(console.error);
|
||||
getPlayList().catch((error) => {
|
||||
alert("An error occurred.");
|
||||
console.error(error);
|
||||
});
|
||||
}, [token]);
|
||||
|
||||
return (
|
||||
|
||||
@ -62,16 +62,11 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": ">=18.2 || >=19.0.0-rc.0",
|
||||
"@types/react-dom": ">=18.2 || >=19.0.0-rc.0",
|
||||
"react": ">=18.2 || >=19.0.0-rc.0",
|
||||
"react-dom": ">=18.2 || >=19.0.0-rc.0"
|
||||
"react": ">=18.2 || >=19.0.0-rc.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -40,18 +40,18 @@
|
||||
,"//": "ELSE_PLATFORM",
|
||||
"build": "rimraf dist && tsup-node",
|
||||
"dev": "rimraf dist && tsup-node --watch"
|
||||
,"//": "END_PLATFORM"
|
||||
,"//": "END_PLATFORM",
|
||||
|
||||
"//": "IF_PLATFORM template react-like",
|
||||
"//": "IF_PLATFORM template react-like"
|
||||
,"css": "pnpm run css-tw && pnpm run css-sc",
|
||||
"css:watch": "concurrently -n \"tw,sc\" -k \"pnpm run css-tw:watch\" \"pnpm run css-sc:watch\"",
|
||||
"css-tw:watch": "tailwindcss -i ./src/global.css -o ./src/generated/tailwind.css --watch",
|
||||
"css-tw": "tailwindcss -i ./src/global.css -o ./src/generated/tailwind.css",
|
||||
"css-sc": "tsx ./scripts/process-css.ts ./src/generated/tailwind.css ./src/generated/global-css.ts",
|
||||
"css-sc:watch": "chokidar --silent './src/generated/tailwind.css' -c 'pnpm run css-sc' --throttle 2000"
|
||||
,"//": "END_PLATFORM"
|
||||
,"//": "END_PLATFORM",
|
||||
|
||||
"//": "IF_PLATFORM template",
|
||||
"//": "IF_PLATFORM template"
|
||||
,"codegen": "pnpm run css && pnpm run quetzal",
|
||||
"codegen:watch": "concurrently -n \"css,quetzal\" -k \"pnpm run css:watch\" \"pnpm run quetzal:watch\"",
|
||||
"override-env-local-for-quetzal": "echo \"\\n$STACK_ENV_LOCAL_PACKAGE_BUILD_OVERRIDE_FOR_QUETZAL\\n\" >> .env.local",
|
||||
@ -104,7 +104,6 @@
|
||||
"react-dom": ">=18.2 || >=19.0.0-rc.0",
|
||||
"next": ">=14.1 || >=15.0.0-canary.0 || >=15.0.0-rc.0",
|
||||
"//": "END_PLATFORM",
|
||||
"//": "NEXT_LINE_PLATFORM next",
|
||||
"react": ">=18.2 || >=19.0.0-rc.0"
|
||||
},
|
||||
"//": "END_PLATFORM",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { fileToBase64 } from '@stackframe/stack-shared/dist/utils/base64';
|
||||
import { runAsynchronouslyWithAlert } from '@stackframe/stack-shared/dist/utils/promises';
|
||||
import { Button, Slider, Typography } from '@stackframe/stack-ui';
|
||||
import imageCompression from 'browser-image-compression';
|
||||
import { Upload } from 'lucide-react';
|
||||
@ -39,17 +40,16 @@ export function ProfileImageEditor(props: {
|
||||
input.onchange = (e) => {
|
||||
const file = (e.target as HTMLInputElement).files?.[0];
|
||||
if (!file) return;
|
||||
fileToBase64(file)
|
||||
.then(async (rawUrl) => {
|
||||
if (await checkImageUrl(rawUrl)) {
|
||||
setRawUrl(rawUrl);
|
||||
setError(null);
|
||||
} else {
|
||||
setError(t('Invalid image'));
|
||||
}
|
||||
})
|
||||
.then(() => input.remove())
|
||||
.catch(console.error);
|
||||
runAsynchronouslyWithAlert(async () => {
|
||||
const rawUrl = await fileToBase64(file);
|
||||
if (await checkImageUrl(rawUrl)) {
|
||||
setRawUrl(rawUrl);
|
||||
setError(null);
|
||||
} else {
|
||||
setError(t('Invalid image'));
|
||||
}
|
||||
input.remove();
|
||||
});
|
||||
};
|
||||
input.click();
|
||||
}
|
||||
|
||||
@ -95,4 +95,7 @@ withGeneratorLock(async () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
}).catch(console.error);
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@ -102,8 +102,13 @@ function generateFromTemplate(options: {
|
||||
});
|
||||
}
|
||||
|
||||
function processPackageJson(content: string) {
|
||||
const jsonObj = JSON.parse(content);
|
||||
function processPackageJson(path: string, content: string) {
|
||||
let jsonObj: any;
|
||||
try {
|
||||
jsonObj = JSON.parse(content);
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to parse package.json at ${path}`, { cause: error });
|
||||
}
|
||||
return JSON.stringify({ "//": COMMENT_LINE, ...jsonObj }, null, 2);
|
||||
}
|
||||
|
||||
@ -117,7 +122,7 @@ function baseEditFn(options: {
|
||||
}
|
||||
const result = processMacros(options.content, options.platforms);
|
||||
if (options.relativePath === 'package-template.json') {
|
||||
return processPackageJson(result);
|
||||
return processPackageJson(options.relativePath, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -136,7 +141,7 @@ withGeneratorLock(async () => {
|
||||
const processedPackageJson = processMacros(packageTemplateContent, PLATFORMS["template"]);
|
||||
writeFileSyncIfChanged(
|
||||
path.join(srcDir, "package.json"),
|
||||
processPackageJson(processedPackageJson)
|
||||
processPackageJson(path.join(srcDir, "package-template.json"), processedPackageJson)
|
||||
);
|
||||
|
||||
generateFromTemplate({
|
||||
@ -186,4 +191,7 @@ withGeneratorLock(async () => {
|
||||
return baseEditFn({ relativePath, content, platforms: PLATFORMS["react"] });
|
||||
},
|
||||
});
|
||||
}).catch(console.error);
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user