Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ Show if there are captions for the language you want in YouTube videos.
- Node.js
- npm

### Step by step
### Step by step for release

1. run `npm install` in terminal.
2. run `npm run build:[chrome or firefox]` in terminal. (built source will be created in `dist` folder)
3. run `npm run build:zip:[chrome or firefox]` in terminal.
4. then, `[chrome or firefox] yt-caption-checker-[version].zip` will be created.

### Step by step for development

1. run `npm install` in terminal.
2. run `npm run build:[chrome or firefox] -- --dev` in terminal. (built source will be created in `dist` folder)
3. run `npm run build:zip:[chrome or firefox]` in terminal.
4. then, `[chrome or firefox] yt-caption-checker-[version].zip` will be created.
9 changes: 8 additions & 1 deletion README_KO.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ README 페이지를 영문로 보시려면 아래를 참고하세요.
- Node.js
- npm

### Step by step
### Step by step for release

1. 터미널에서 `npm install` 을 실행하세요.
2. 터미널에서 `npm run build:[chrome 혹은 firefox]` 를 실행하세요. (dist 폴더에 빌드된 소스가 저장됩니다)
3. 터미널에서 `npm run build:zip:[chrome 혹은 firefox]` 을 실행하세요.
4. `[chrome 혹은 firefox] yt-caption-checker-[version].zip` 가 최상위 폴더에 생성됩니다.

### Step by step for development

1. 터미널에서 `npm install` 을 실행하세요.
2. 터미널에서 `npm run build:[chrome 혹은 firefox] -- --dev` 를 실행하세요. (dist 폴더에 빌드된 소스가 저장됩니다)
3. 터미널에서 `npm run build:zip:[chrome 혹은 firefox]` 을 실행하세요.
4. `[chrome 혹은 firefox] yt-caption-checker-[version].zip` 가 최상위 폴더에 생성됩니다.
14 changes: 13 additions & 1 deletion build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { fileURLToPath } from 'url'
import pack from '../package.json' with { type: 'json' }

const browser = process.argv[2]
const isDev = process.argv.includes('--dev')

const __dirname = path.dirname(fileURLToPath(import.meta.url))

Expand All @@ -24,7 +25,16 @@ const copyDir = async (src, dest) => {
}

if (!entry.name.endsWith('.test.js')) {
await fs.copyFile(srcPath, destPath)
if (entry.name.endsWith('.js')) {
const content = await fs.readFile(srcPath, 'utf-8')
const replaced = content.replaceAll(
'__YCC_DEV__',
isDev ? 'true' : 'false',
)
await fs.writeFile(destPath, replaced, 'utf-8')
} else {
await fs.copyFile(srcPath, destPath)
}
}
}
}
Expand All @@ -51,6 +61,8 @@ const updateManifest = async () => {
const build = async () => {
await updateManifest()

console.log('build mode:', isDev ? 'dev' : 'prod')

await fs.rm(outputDir, { recursive: true, force: true })
await copyDir(srcDir, outputDir)
await fs.copyFile(
Expand Down
Loading