Skip to content

Commit

Permalink
Refactor: change output dir to "dist" (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored Nov 7, 2023
1 parent 4edd5e9 commit f8a3f1b
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"project": "./tsconfig.json",
"sourceType": "module"
},
"ignorePatterns": ["build/**"],
"ignorePatterns": ["dist/**"],

"env": {
"jest/globals": true
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/node-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
NODE_ARCH=amd64
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${NODE_ARCH/\//}.tar.gz"
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}"
cp package.json build/
cp package.json dist/
docker run --rm --platform "linux/${NODE_ARCH}" --volume "$(pwd):/app" --workdir "/app" \
"node:$(jq --raw-output '.volta.node' package.json)" sh -c \
"./node_modules/.bin/caxa --input build/ --output igir -- \"{{caxa}}/node_modules/.bin/node\" \"{{caxa}}/index.js\" && ./igir --help"
"./node_modules/.bin/caxa --input dist/ --output igir -- \"{{caxa}}/node_modules/.bin/node\" \"{{caxa}}/index.js\" && ./igir --help"
tar cvf - igir | gzip --best > "${BIN_OUTPUT}"
- os: ubuntu
arch: arm/v7
Expand All @@ -71,10 +71,10 @@ jobs:
NODE_ARCH=arm/v7
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${NODE_ARCH/\//}.tar.gz"
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}"
cp package.json build/
cp package.json dist/
docker run --rm --platform "linux/${NODE_ARCH}" --volume "$(pwd):/app" --workdir "/app" \
"node:$(jq --raw-output '.volta.node' package.json)" sh -c \
"./node_modules/.bin/caxa --input build/ --output igir -- \"{{caxa}}/node_modules/.bin/node\" \"{{caxa}}/index.js\" && ./igir --help"
"./node_modules/.bin/caxa --input dist/ --output igir -- \"{{caxa}}/node_modules/.bin/node\" \"{{caxa}}/index.js\" && ./igir --help"
tar cvf - igir | gzip --best > "${BIN_OUTPUT}"
- os: ubuntu
arch: arm64/v8
Expand All @@ -83,10 +83,10 @@ jobs:
NODE_ARCH=arm64/v8
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${NODE_ARCH/\//}.tar.gz"
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}"
cp package.json build/
cp package.json dist/
docker run --rm --platform "linux/${NODE_ARCH}" --volume "$(pwd):/app" --workdir "/app" \
"node:$(jq --raw-output '.volta.node' package.json)" sh -c \
"./node_modules/.bin/caxa --input build/ --output igir -- \"{{caxa}}/node_modules/.bin/node\" \"{{caxa}}/index.js\" && ./igir --help"
"./node_modules/.bin/caxa --input dist/ --output igir -- \"{{caxa}}/node_modules/.bin/node\" \"{{caxa}}/index.js\" && ./igir --help"
tar cvf - igir | gzip --best > "${BIN_OUTPUT}"
# TODO(cemmer): macOS arm64: https://github.com/github/roadmap/issues/528
- os: macos
Expand All @@ -95,8 +95,8 @@ jobs:
NODE_ARCH=$(node --print 'process.arch')
BIN_OUTPUT="igir-${NPM_PKG_VERSION}-${RUNNER_OS}-${NODE_ARCH}.tar.gz"
echo "BIN_OUTPUT=${BIN_OUTPUT}" >> "${GITHUB_ENV}"
cp package.json build/
./node_modules/.bin/caxa --input build/ --output igir -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/index.js"
cp package.json dist/
./node_modules/.bin/caxa --input dist/ --output igir -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/index.js"
./igir --help
tar cvf - igir | gzip --best > "${BIN_OUTPUT}"
- os: windows
Expand All @@ -105,8 +105,8 @@ jobs:
$NODE_ARCH=$(node --print 'process.arch')
$BIN_OUTPUT="igir-$NPM_PKG_VERSION-${env:RUNNER_OS}-${NODE_ARCH}.zip"
echo "BIN_OUTPUT=${BIN_OUTPUT}" | Out-File -FilePath $env:GITHUB_ENV -Append # no need for -Encoding utf8
copy package.json build\
.\node_modules\.bin\caxa --input build\ --output igir.exe -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/index.js"
copy package.json dist\
.\node_modules\.bin\caxa --input dist\ --output igir.exe -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/index.js"
.\igir.exe --help
Compress-Archive -Path igir.exe -DestinationPath "${BIN_OUTPUT}" -CompressionLevel Optimal -Force
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
tar -xvzf igir-*.tgz
cd package
npm install --ignore-scripts
./build/index.js --help
./dist/index.js --help
cd ..
rm -rf package
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dist


# Custom
build/
dist/
site/
*.bat
*.sh
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const jestConfig: JestConfigWithTsJest = {
},

// Don't run any compiled versions of the tests, if they exist
modulePathIgnorePatterns: ['<rootDir>/build/'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
// Don't report coverage on the test directory
coveragePathIgnorePatterns: ['<rootDir>/test/'],

Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@
"funding": "https://github.com/sponsors/emmercm",
"type": "module",
"files": [
"build",
"dist",
"!**/test/**",
"!**/*.test.*"
"!**/*.test.*",
"!**/jest.*"
],
"main": "build/index.js",
"main": "dist/index.js",
"bin": {
"igir": "build/index.js"
"igir": "dist/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emmercm/igir.git"
},
"scripts": {
"cache:clear": "npm cache clean --force && node --experimental-vm-modules ./node_modules/jest/bin/jest.js --clearCache",
"postinstall": "node --eval \"if(require('fs').existsSync('build')===false){process.exit(1);}\" || npm run build",
"postinstall": "node --eval \"if(require('fs').existsSync('dist')===false){process.exit(1);}\" || npm run build",
"prepare": "husky install",
"start": "node --loader ts-node/esm index.ts",
"build": "tsc && node --eval \"if(process.platform!=='win32'){process.exit(1);}\" || chmod +x build/index.js",
"build": "tsc && node --eval \"if(process.platform!=='win32'){process.exit(1);}\" || chmod +x dist/index.js",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "npm run test:unit && npm run lint",
Expand Down
2 changes: 1 addition & 1 deletion scripts/asciinema-rec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [[ "${1:-}" == "play" ]]; then
# shellcheck disable=SC2317
npx() {
shift # discard "igir@latest"
node ../build/index.js "$@" --dat-name-regex-exclude "/encrypted|headerless/i"
node ../dist/index.js "$@" --dat-name-regex-exclude "/encrypted|headerless/i"
}
# shellcheck disable=SC2317
tree() {
Expand Down
2 changes: 1 addition & 1 deletion test/endToEndTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd "$(parent_find . "package.json")"

test_igir() {
temp="$(mktemp -d)"
./build/index.js "$@" \
./dist/index.js "$@" \
--dat test/fixtures/dats/* \
--input test/fixtures/roms/* \
--output "${temp}"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./build", /* Specify an output folder for all emitted files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand Down

0 comments on commit f8a3f1b

Please sign in to comment.