Skip to content

Commit 4529092

Browse files
committed
mention NODE_ENV as build and prod run environment, fix type issues
1 parent cb089a5 commit 4529092

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
"scripts": {
3434
"format": "prettier --write 'src/**/*.{css,html,ts,tsx}'",
3535
"lint": "eslint 'src/**/*.{css,html,ts,tsx}' --fix",
36-
"build": "bun run build.ts",
36+
"build": "NODE_ENV=production bun run build.ts",
3737
"test": "bun test --watch --timeout 1000 --rerun-each 2 --coverage",
38-
"generate_dev": "bun src/generate.tsx",
39-
"server_dev": "bun run --watch src/index.ts",
40-
"dev": "bun run --env-file=.env.development build && bun run generate_dev && bun run server_dev",
38+
"generate_dev": "bun run --env-file=.env.development src/generate.tsx",
39+
"server_dev": "bun run --env-file=.env.development --watch src/index.ts",
40+
"dev": "bun generate_dev && bun run server_dev",
4141
"generate": "bun run out/generate.js",
4242
"server": "bun run out/index.js",
43-
"prod": "bun run generate && bun run server",
43+
"prod": "NODE_ENV=production bun run generate && bun run server",
4444
"clean": "bun run src/public-clean-up.ts"
4545
}
4646
}

src/generate.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ ${urls}
4444
* Clean up articles directory after processing
4545
* @param articlesPath Path to articles directory
4646
*/
47-
async function cleanupArticlesDirectory(articlesPath: string): Promise<void> {
47+
async function cleanupArticlesDirectory(): Promise<void> {
48+
const articlesPath = process.env.ARTICLES
4849
try {
4950
await rm(articlesPath, {recursive: true})
5051
} catch (error) {

src/pullarticles.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function processRepoContents(
8888
octokit: Octokit,
8989
owner: string,
9090
repo: string,
91-
repoPath = '',
91+
repoPath: string,
9292
articlesDir: string
9393
): Promise<void> {
9494
try {
@@ -129,7 +129,7 @@ async function pullArticles(): Promise<void> {
129129
try {
130130
const octokit = createOctokitClient(process.env.GITHUB_TOKEN)
131131
const {owner, repo} = parseRepoDetails(process.env.SOURCE)
132-
const articlesDir = resolvePath(process.cwd(), process.env.ARTICLE)
132+
const articlesDir = resolvePath(process.cwd(), process.env.ARTICLES)
133133

134134
await fs.mkdir(articlesDir, {recursive: true})
135135
await processRepoContents(octokit, owner, repo, '', articlesDir)

0 commit comments

Comments
 (0)