Skip to content

Commit

Permalink
Merge pull request #2 from CrunchyData/willking/change-output
Browse files Browse the repository at this point in the history
Willking/change output
  • Loading branch information
wking-io authored Dec 14, 2023
2 parents aa75b98 + ae8b0e5 commit 6d8209d
Show file tree
Hide file tree
Showing 41 changed files with 24 additions and 116 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
},
],
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePatter: '^_' }],
'no-unused-vars': ['warn', { varsIgnorePatter: '^_' }],
'testing-library/no-await-sync-events': 'off',
'jest-dom/prefer-in-document': 'off',
'@typescript-eslint/no-duplicate-imports': 'warn',
Expand Down
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
node_modules

/build
/public/build
/public/images
/public/pdf
/server-build
/docs-build
/docs-public/build
/docs-public/images
/docs-public/pdf
/docs-server-build
.env

*.local.*
Expand All @@ -14,4 +14,4 @@ node_modules

documentation
/scripts/crd-builder/specs
/public/documentation
/docs-public/documentation
6 changes: 3 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ node_modules

/content/**/*.mdx

/build
/public/build
/server-build
/docs-build
/docs-public/build
/docs-server-build
.env

/test-results/
Expand Down
94 changes: 0 additions & 94 deletions app/utils/timing.server.ts

This file was deleted.

2 changes: 1 addition & 1 deletion index.js → docs-index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dotenv/config'

if (process.env.NODE_ENV === 'production') {
await import('./server-build/index.js')
await import('./docs-server-build/index.js')
} else {
await import('./server/index.ts')
}
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"build:server": "tsx ./scripts/build-server.ts",
"dev": "run-p dev:*",
"dev:remix": "remix dev -c \"npm run dev-server\" --no-restart",
"dev-server": "cross-env MOCKS=true tsx watch --clear-screen=false --ignore \"app/**\" --ignore \"build/**\" --ignore \"node_modules/**\" ./index.js",
"dev-server": "cross-env MOCKS=true tsx watch --clear-screen=false --ignore \"app/**\" --ignore \"docs-build/**\" --ignore \"node_modules/**\" ./index.js",
"format": "prettier --write .",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
"lint:files": "ts-node --esm scripts/lint-file-case.ts",
"start": "cross-env NODE_ENV=production node .",
"start": "cross-env NODE_ENV=production node docs-index.js",
"test": "vitest",
"typecheck": "tsc",
"validate": "run-p lint typecheck test",
Expand All @@ -28,10 +28,10 @@
},
"eslintIgnore": [
"/node_modules",
"/build",
"/public/build",
"/docs-build",
"/docs-public/build",
"/playwright-report",
"/server-build"
"/docs-server-build"
],
"dependencies": {
"@headlessui/react": "^1.7.14",
Expand Down
3 changes: 3 additions & 0 deletions remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*/
export default {
cacheDirectory: './node_modules/.cache/remix',
assetsBuildDirectory: 'docs-public/build',
serverBuildPath: 'docs-build/index.js',
publicPath: '/docs-public/build/',
ignoredRouteFiles: ['**/.*', '**/.test.{js,jsx,ts,tsx}'],
serverModuleFormat: 'esm',
serverPlatform: 'node',
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ for (const file of allFiles) {
if (/\.(ts|js|tsx|jsx)$/.test(file)) {
entries.push(file)
} else {
const dest = file.replace(here('../server'), here('../server-build'))
const dest = file.replace(here('../server'), here('../docs-server-build'))
fsExtra.ensureDirSync(path.parse(dest).dir)
fsExtra.copySync(file, dest)
console.log(`copied: ${file.replace(`${here('../server')}/`, '')}`)
Expand All @@ -32,7 +32,7 @@ console.log('building...')
esbuild
.build({
entryPoints: glob.sync(globsafe(here('../server/**/*.+(ts|js|tsx|jsx)'))),
outdir: here('../server-build'),
outdir: here('../docs-server-build'),
target: [`node${pkg.engines.node}`],
platform: 'node',
format: 'esm',
Expand Down
8 changes: 4 additions & 4 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from 'path-to-regexp'
import { fileURLToPath, pathToFileURL } from 'url'

const BUILD_DIR = path.join(process.cwd(), 'build', 'index.js')
const BUILD_DIR = path.join(process.cwd(), 'docs-build', 'index.js')
const BUILD_DIR_FILE_URL = pathToFileURL(BUILD_DIR).href

const __dirname = path.dirname(fileURLToPath(import.meta.url))
Expand All @@ -38,13 +38,13 @@ app.disable('x-powered-by')

// Remix fingerprints its assets so we can cache forever.
app.use(
'/build',
express.static('public/build', { immutable: true, maxAge: '1y' }),
'/docs-public/build',
express.static('docs-public/build', { immutable: true, maxAge: '1y' }),
)

// Everything else (like favicon.ico) is cached for an hour. You may want to be
// more aggressive with this caching.
app.use(express.static('public', { maxAge: '1h' }))
app.use(express.static('docs-public', { maxAge: '1h' }))

morgan.token('url', (req, res) => decodeURIComponent(req.url ?? ''))
app.use(morgan('tiny'))
Expand Down

0 comments on commit 6d8209d

Please sign in to comment.