mirror of
https://github.com/sechan100/daily-routine-2.git
synced 2026-07-22 05:37:51 +00:00
build: 현재 빌드 모드에 대한 플래그를 전역변수에 추가하고, 이에 따라 개발에 필요한 도구들을 활성화
This commit is contained in:
parent
a574beef46
commit
099036de24
2 changed files with 17 additions and 10 deletions
|
|
@ -13,9 +13,9 @@ if you want to view the source, please visit the github repository of this plugi
|
|||
*/
|
||||
`;
|
||||
|
||||
const development = process.argv[2] === "development";
|
||||
const local = process.argv[2] === "local";
|
||||
const prod = process.argv[2] === "production";
|
||||
const isDevelopment = process.argv.includes("dev");
|
||||
const isLocal = process.argv.includes("local");
|
||||
const isProd = process.argv.includes("production");
|
||||
|
||||
// CSS를 하나로 합치기 위한 rename 플러그인
|
||||
const renamePlugin = {
|
||||
|
|
@ -60,18 +60,18 @@ const context = await esbuild.context({
|
|||
...builtins,
|
||||
],
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify(development || local || prod)
|
||||
'process.env.NODE_ENV': isDevelopment ? '"development"' : '"production"',
|
||||
},
|
||||
format: "cjs", // CommonJS 포맷
|
||||
target: "es2018",
|
||||
logLevel: "warning",
|
||||
sourcemap: prod ? false : "inline",
|
||||
sourcemap: isProd ? false : "inline",
|
||||
treeShaking: true,
|
||||
outfile: "main.js", // JavaScript 번들 파일
|
||||
plugins: [
|
||||
renamePlugin, // CSS 파일 이름 변경 플러그인
|
||||
],
|
||||
minify: prod,
|
||||
minify: isProd,
|
||||
loader: {
|
||||
".tsx": "tsx", // TypeScript와 TSX 파일을 처리
|
||||
".ts": "ts",
|
||||
|
|
@ -81,10 +81,11 @@ const context = await esbuild.context({
|
|||
write: true,
|
||||
});
|
||||
|
||||
if(prod) {
|
||||
|
||||
if(isProd) {
|
||||
await context.rebuild();
|
||||
process.exit(0);
|
||||
} else if(local) {
|
||||
} else if(isLocal) {
|
||||
await context.rebuild();
|
||||
console.log("\n === 클라우드로 플러그인 복사 시작 ===");
|
||||
await copyPluginFilesTo_iCloud();
|
||||
|
|
|
|||
10
src/main.ts
10
src/main.ts
|
|
@ -38,9 +38,15 @@ export default class DailyRoutinePlugin extends Plugin {
|
|||
activateView(DailyRoutineObsidianView.VIEW_TYPE, 1);
|
||||
}
|
||||
});
|
||||
// this.app.emulateMobile(!this.app.isMobile);
|
||||
|
||||
process.env.NODE_ENV === "development" && this.addRibbonIcon(
|
||||
"toggle-left",
|
||||
"Toggle Mobile View",
|
||||
// @ts-ignore
|
||||
() => this.app.emulateMobile(!this.app.isMobile)
|
||||
);
|
||||
|
||||
setTimeout(() => activateView(DailyRoutineObsidianView.VIEW_TYPE, 1), 0);
|
||||
setTimeout(() => activateView(DailyRoutineObsidianView.VIEW_TYPE, 1), 500);
|
||||
}
|
||||
|
||||
onunload() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue