Skip to content

Commit

Permalink
out/ instead of build/
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffomatic committed Sep 26, 2020
1 parent 6481f2c commit 04a6e90
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build/*
out/*
dist/*
src/assets/**/*.json
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.cache/
.vscode/
dist/
build/
out/
node_modules/
yarn-error.log
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
"start": "parcel src/index.html",
"build": "parcel build src/index.html --public-url ./",
"dev": "npx ts-node src/gameService/watch.ts",
"devServe": "npx ts-node src/gameService/serve.ts",
"devBuildClient": "npx ts-node gameService/buildClient.ts",
"typecheck": "tsc -p . --noEmit",
"lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
"test": "jest",
"clean": "rm -rf build .cache dist"
"clean": "rm -rf out .cache dist"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/gameService/buildClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import * as path from 'path'

import * as Bundler from 'parcel-bundler'

import { clientBuildPath, gameSrcPath } from './common'
import { clientBuildOutputPath, gameSrcPath } from './common'

console.log('Creating bundle...')

const bundler = new Bundler(path.join(gameSrcPath, 'index.html'), {
outDir: clientBuildPath,
outDir: clientBuildOutputPath,
outFile: 'index.html', // The name of the outputFile
publicUrl: '/client',
watch: false, // explicitly disable watching...we want the supervisor to control this
Expand Down
4 changes: 2 additions & 2 deletions src/gameService/buildServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from 'path'

import * as Bundler from 'parcel-bundler'

import { buildkeyPath, gameSrcPath, serverBuildPath } from './common'
import { buildkeyPath, gameSrcPath, serverBuildOutputPath } from './common'

function getMtimeMs(filepath: string): number {
const stats = fs.statSync(filepath)
Expand All @@ -29,7 +29,7 @@ fs.writeFileSync(
const bundler = new Bundler(path.join(gameSrcPath, 'serverEntrypoint.ts'), {
target: 'node',
// bundleNodeModules: true,
outDir: serverBuildPath,
outDir: serverBuildOutputPath,
outFile: 'server.js', // The name of the outputFile
watch: false, // explicitly disable watching...we want the supervisor to control this
cache: true,
Expand Down
6 changes: 3 additions & 3 deletions src/gameService/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const findProjectRoot = (): string => {

export const projectRootPath = findProjectRoot()
export const gameSrcPath = path.join(projectRootPath, 'src')
export const buildPath = path.join(projectRootPath, 'build')
export const clientBuildPath = path.join(buildPath, 'client')
export const serverBuildPath = path.join(buildPath, 'server')
export const buildOutputPath = path.join(projectRootPath, 'out')
export const clientBuildOutputPath = path.join(buildOutputPath, 'client')
export const serverBuildOutputPath = path.join(buildOutputPath, 'server')
export const buildkeyPath = path.join(gameSrcPath, 'gameService', 'buildkey.ts')
4 changes: 2 additions & 2 deletions src/gameService/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChildProcessWithoutNullStreams, spawn } from 'child_process'
import * as fs from 'fs'
import * as path from 'path'

import { gameSrcPath, serverBuildPath } from './common'
import { gameSrcPath, serverBuildOutputPath } from './common'

// Removes a newline from the end of a buffer, if it exists.
const trimNewlineSuffix = (data: Buffer): Buffer => {
Expand Down Expand Up @@ -62,7 +62,7 @@ const rebuild = async () => {
server.kill()
}

server = spawn('npx', ['node', path.join(serverBuildPath, 'server.js')])
server = spawn('npx', ['node', path.join(serverBuildOutputPath, 'server.js')])
server.stdout.on('data', (data) =>
console.log(trimNewlineSuffix(data).toString()),
)
Expand Down
8 changes: 5 additions & 3 deletions src/serverEntrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as WebSocket from 'ws'

import { SIMULATION_PERIOD_S } from '~/constants'
import { buildkey } from '~/gameService/buildkey'
import { clientBuildPath } from '~/gameService/common'
import { clientBuildOutputPath } from '~/gameService/common'
import { Server as GameServer } from '~/Server'

const gameServer = new GameServer()
Expand All @@ -22,7 +22,7 @@ const httpServer = new Koa()
const port = 3000

const entrypointPage = fs
.readFileSync(path.join(clientBuildPath, 'index.html'))
.readFileSync(path.join(clientBuildOutputPath, 'index.html'))
.toString('utf8')
const entrypointWithHotReload = entrypointPage.replace(
'<!-- DEV SERVER HOT RELOAD PLACEHOLDER -->',
Expand All @@ -45,7 +45,9 @@ router
return await next()
})
.get('/client/(.*)', async (ctx) =>
koaSend(ctx, ctx.path.substr('/client/'.length), { root: clientBuildPath }),
koaSend(ctx, ctx.path.substr('/client/'.length), {
root: clientBuildOutputPath,
}),
)
.get('/api/buildkey', async (ctx) => (ctx.body = buildkey))
.get('/api/connect', async (ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"exclude": [
"dist",
"build",
"out",
"node_modules"
]
}

0 comments on commit 04a6e90

Please sign in to comment.