Skip to content

Commit 6c7643a

Browse files
authored
chore: remove nx + remove bash scripts + convert to ESM where possible (#66)
* feat: todo * feat: todo * feat: todo * feat: doto * chore: fix build partially * feat: everything except for docs working * fix: all packages building + linting * feat: new CI * chore: revert docusaurus dep * chore: test ci * chore: test ci * chore: test ci * chore: test ci * chore: test ci * chore: fix ci * chore: test ci * fix: ci * fix: ci * fix: ci * chore: fix ci * fix: tests * chore: try ci * chore: test ci * chore: test ci * chore: fix ci * fix: ci
1 parent a1f35c4 commit 6c7643a

File tree

355 files changed

+10691
-13324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+10691
-13324
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const ESLINT_CONFIG_ISAACSCRIPT_PATH = path.join(
55
REPO_ROOT,
66
"packages",
77
"eslint-config-isaacscript",
8-
"configs",
98
);
109

1110
/** @type {import("eslint").Linter.Config} */

.github/workflows/ci.yml

Lines changed: 88 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,105 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6-
build_and_lint:
6+
get-build-packages:
77
runs-on: ubuntu-latest
8+
outputs:
9+
matrix: ${{ steps.set-matrix.outputs.matrix }}
810
steps:
9-
- name: Checkout the repository
10-
uses: actions/checkout@v3
11+
- uses: actions/checkout@v3
12+
- uses: ./.github/workflows/setup
13+
- id: set-matrix
14+
run: npx tsx ./scripts/getMonorepoPackageNames.ts build
1115

12-
- name: Setup Node.js
13-
uses: actions/setup-node@v3
14-
with:
15-
node-version: lts/*
16-
cache: yarn
16+
build:
17+
needs: get-build-packages
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
package-name: ${{ fromJson(needs.get-build-packages.outputs.matrix) }}
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: ./.github/workflows/setup
25+
- working-directory: ./packages/${{ matrix.package-name }}
26+
run: npm run build
1727

18-
- name: Retrieve the cached "node_modules" directory (if present)
19-
uses: actions/cache@v3
20-
id: node-cache
21-
with:
22-
path: node_modules
23-
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
28+
get-lint-packages:
29+
runs-on: ubuntu-latest
30+
outputs:
31+
matrix: ${{ steps.set-matrix.outputs.matrix }}
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: ./.github/workflows/setup
35+
- id: set-matrix
36+
run: npx tsx ./scripts/getMonorepoPackageNames.ts lint
2437

25-
- name: Install dependencies (if the cached directory was not found)
26-
if: steps.node-cache.outputs.cache-hit != 'true'
27-
run: yarn install --immutable
38+
lint:
39+
needs: get-lint-packages
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
package-name: ${{ fromJson(needs.get-lint-packages.outputs.matrix) }}
44+
steps:
45+
- uses: actions/checkout@v3
46+
- uses: ./.github/workflows/setup
47+
- working-directory: ./packages/${{ matrix.package-name }}
48+
run: npm run lint
2849

29-
- name: Build every package in the monorepo
30-
run: bash build.sh
50+
get-test-packages:
51+
runs-on: ubuntu-latest
52+
outputs:
53+
matrix: ${{ steps.set-matrix.outputs.matrix }}
54+
steps:
55+
- uses: actions/checkout@v3
56+
- uses: ./.github/workflows/setup
57+
- id: set-matrix
58+
run: npx tsx ./scripts/getMonorepoPackageNames.ts test
3159

32-
- name: Test every package in the monorepo
33-
run: bash test.sh
60+
test:
61+
needs: get-test-packages
62+
runs-on: ubuntu-latest
63+
strategy:
64+
matrix:
65+
package-name: ${{ fromJson(needs.get-test-packages.outputs.matrix) }}
66+
steps:
67+
- uses: actions/checkout@v3
68+
- uses: ./.github/workflows/setup
69+
- working-directory: ./packages/${{ matrix.package-name }}
70+
run: npm run test
3471

35-
- name: Lint every package in the monorepo
36-
run: bash lint.sh
72+
unused:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v3
76+
- uses: ./.github/workflows/setup
77+
#- name: Check for unused files, dependencies, and exports
78+
# run: npx knip
3779

38-
- name: Run ShellCheck
39-
uses: ludeeus/action-shellcheck@master
40-
with:
41-
ignore_paths: node_modules
80+
format:
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v3
84+
- uses: ./.github/workflows/setup
85+
- run: npx prettier --log-level=warn --check .
4286

43-
# Uncomment this for SSH debugging of CI actions.
44-
#- name: Setup tmate session
45-
# uses: mxschmitt/action-tmate@v3
46-
# with:
47-
# limit-access-to-actor: true
87+
spell-check:
88+
runs-on: ubuntu-latest
89+
steps:
90+
- uses: actions/checkout@v3
91+
- uses: ./.github/workflows/setup
92+
- run: npx cspell --no-progress --no-summary .
93+
- run: npx cspell-check-unused-words
94+
95+
docs-deploy:
96+
needs: [build, lint, test, unused, format, spell-check]
97+
runs-on: ubuntu-latest
98+
if: github.ref == 'refs/heads/main' && needs.pr-check.outputs.number != 'null'
99+
steps:
100+
- uses: actions/checkout@v3
101+
- uses: ./.github/workflows/setup
48102

49103
- name: Checkout the docs repository
50104
uses: actions/checkout@v3
51-
if: github.ref == 'refs/heads/main' && needs.pr-check.outputs.number != 'null'
52105
with:
53106
ssh-key: ${{ secrets.DOCS_SSH_PRIVATE_KEY }}
54107
repository: IsaacScript/isaacscript.github.io
@@ -63,11 +116,10 @@ jobs:
63116
- name: Deploy the documentation website
64117
id: deploy_documentation_website
65118
run: bash packages/docs/deploy.sh ${{ github.sha }}
66-
if: github.ref == 'refs/heads/main' && needs.pr-check.outputs.number != 'null'
67119

68120
- name: Run DocSearch Scraper
69121
uses: celsiusnarhwal/typesense-scraper@v2
70-
if: github.ref == 'refs/heads/main' && needs.pr-check.outputs.number != 'null' && steps.deploy_documentation_website.outputs.SHOULD_SCRAPE == '1'
122+
if: steps.deploy_documentation_website.outputs.SHOULD_SCRAPE == '1'
71123
with:
72124
api-key: ${{ secrets.TYPESENSE_API_KEY }}
73125
host: ${{ secrets.TYPESENSE_HOST }}
@@ -77,7 +129,7 @@ jobs:
77129

78130
discord:
79131
name: Discord Failure Notification
80-
needs: [build_and_lint]
132+
needs: [build, lint, test, unused, format, spell-check, docs-deploy]
81133
if: always() # This is needed to always run this job, even if the other jobs fail.
82134
runs-on: ubuntu-latest
83135
steps:

.github/workflows/setup/action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
runs:
2+
using: composite
3+
4+
steps:
5+
- name: Setup Node.js
6+
uses: actions/setup-node@v3
7+
with:
8+
node-version: lts/*
9+
cache: yarn
10+
11+
- name: Retrieve the cached "node_modules" directory (if present)
12+
uses: actions/cache@v3
13+
id: node-modules-cache
14+
with:
15+
path: node_modules
16+
key: client-build-node-modules-${{ hashFiles('yarn.lock') }}
17+
18+
- name: Install dependencies (if the cached directory was not found)
19+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
20+
run: yarn install --immutable
21+
shell: bash # Composite jobs must specify the shell.

.gitignore

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@
22
# isaacscript
33
# -----------
44

5-
# NX artifacts
6-
tmp
7-
8-
# Docusaurus artifacts
9-
.cache-loader
10-
115
# OS-specific artifacts
126
.DS_Store
137
thumbs.db
148

9+
# Docusaurus artifacts
10+
build
11+
.docusaurus
12+
.cache-loader
13+
1514
# Ignore the auto-generated API docs from TypeDoc (since it will just contain duplicate information
1615
# from what is already in the JSDoc comments of the source code).
16+
packages/docs/docs/eslint-config-isaacscript
1717
packages/docs/docs/isaacscript-common
1818
packages/docs/docs/isaac-typescript-definitions
19-
packages/docs/docs/eslint-config-isaacscript
19+
20+
# Temporary build files
21+
packages/isaacscript-common/src/indexLua.ts
2022

2123
# ------------------------------
2224
# GitHub Node.gitignore template
2325
# https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore
26+
# cspell:disable
2427
# ------------------------------
2528

2629
# Logs

.markdownlintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.gitignore
22
.markdownlintignore
3-
.remarkignore
43
node_modules
54
dist
5+
packages/docs/docs/eslint-config-isaacscript
66
packages/docs/docs/isaacscript-common
77
packages/docs/docs/isaac-typescript-definitions

.prettierignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ mod/resources/**/*.anm2
2222

2323
# @template-customization-start
2424

25-
# NX temporary directory
26-
tmp
25+
# Compiled plugins
26+
packages/isaacscript-cli/plugins/*.cjs
2727

2828
# Docusaurus artifacts
2929
.docusaurus
3030
.cache-loader
3131

32-
# "prettier-plugin-organize-imports" is bugged with JSX.
33-
packages/docs/src/components/HomepageFeatures.js
34-
packages/docs/src/pages/index.js
35-
3632
# API docs are automatically created by TypeDoc.
3733
packages/docs/docs/isaacscript-common
3834
packages/docs/docs/isaac-typescript-definitions

.remarkignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// Vanilla settings
55
// ----------------
66

7-
// This matches the Airbnb JavaScript style guide.
7+
// This matches the Airbnb JavaScript style guide, which is the most popular JavaScript style
8+
// guide in the world.
89
"editor.rulers": [100],
910
"editor.tabSize": 2,
1011

@@ -43,7 +44,7 @@
4344
// Extension settings
4445
// ------------------
4546

46-
// Use Prettier to format "cspell.json".
47+
// Use Prettier to format "cspell.jsonc".
4748
"cSpell.autoFormatConfigFile": true,
4849

4950
// -----------------

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ IsaacScript is a tool to help you create [_Binding of Isaac: Repentance_](https:
1010

1111
Please visit the [official website](https://isaacscript.github.io/) for more information.
1212

13-
This is the [monorepo](https://en.wikipedia.org/wiki/Monorepo) that houses the various packages in the ecosystem. It is powered by [Nx](https://nx.dev/).
13+
This is the [monorepo](https://en.wikipedia.org/wiki/Monorepo) that houses the various packages in the ecosystem.
1414

1515
<br>
1616

@@ -26,8 +26,9 @@ Each project in the monorepo is contained within the "packages" directory.
2626
| [isaac-lua-polyfill](./packages/isaac-lua-polyfill) | Polyfills for testing Isaac mods using TypeScript. | [![npm version](https://img.shields.io/npm/v/isaac-lua-polyfill.svg)](https://www.npmjs.com/package/isaac-lua-polyfill) |
2727
| [isaac-typescript-definitions](./packages/isaac-typescript-definitions) | TypeScript definitions for the _The Binding of Isaac: Repentance_ API. | [![npm version](https://img.shields.io/npm/v/isaac-typescript-definitions.svg)](https://www.npmjs.com/package/isaac-typescript-definitions) |
2828
| [isaacscript-cli](./packages/isaacscript-cli) | The command-line tool for managing Isaac mods written in TypeScript. | [![npm version](https://img.shields.io/npm/v/isaacscript.svg)](https://www.npmjs.com/package/isaacscript) |
29-
| [isaacscript-common-ts](./packages/isaacscript-common-ts) | Helper functions for TypeScript projects. | [![npm version](https://img.shields.io/npm/v/isaacscript-common-ts.svg)](https://www.npmjs.com/package/isaacscript-common-ts) |
3029
| [isaacscript-common](./packages/isaacscript-common) | Helper functions and features for IsaacScript mods. | [![npm version](https://img.shields.io/npm/v/isaacscript-common.svg)](https://www.npmjs.com/package/isaacscript-common) |
30+
| [isaacscript-common-node](./packages/isaacscript-common-node) | Helper functions for Node.js projects. | [![npm version](https://img.shields.io/npm/v/isaacscript-common-node.svg)](https://www.npmjs.com/package/isaacscript-common-node) |
31+
| [isaacscript-common-ts](./packages/isaacscript-common-ts) | Helper functions for TypeScript projects. | [![npm version](https://img.shields.io/npm/v/isaacscript-common-ts.svg)](https://www.npmjs.com/package/isaacscript-common-ts) |
3132
| [isaacscript-lint](./packages/isaacscript-lint) | A linting dependency meta-package for IsaacScript and TypeScript projects. | [![npm version](https://img.shields.io/npm/v/isaacscript-lint.svg)](https://www.npmjs.com/package/isaacscript-lint) |
3233
| [isaacscript-lua](./packages/isaacscript-lua) | A tool for managing IsaacScript libraries in Lua projects. | [![pypi version](https://img.shields.io/pypi/v/isaacscript-lua.svg)](https://pypi.org/project/isaacscript-lua/) |
3334
| [isaacscript-spell](./packages/isaacscript-spell) | Spelling dictionaries for _The Binding of Isaac: Repentance_. | [![npm version](https://img.shields.io/npm/v/isaacscript-spell.svg)](https://www.npmjs.com/package/isaacscript-spell) |

build-package.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

build.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

cache.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

check-line-endings.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail # Exit on errors and undefined variables.
4+
5+
# Get the directory of this script:
6+
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
7+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
8+
9+
cd "$DIR"
10+
11+
WINDOWS_FILES=$(
12+
grep \
13+
--recursive \
14+
--files-with-matches \
15+
--binary \
16+
--perl-regexp \
17+
--exclude-dir='.git' \
18+
--exclude-dir='.yarn' \
19+
--exclude-dir='node_modules' \
20+
--exclude='*.fnt' \
21+
--exclude='*.jpg' \
22+
--exclude='*.png' \
23+
--exclude='*.pyc' \
24+
--exclude='*.stb' \
25+
--exclude='*.ttf' \
26+
--exclude='*.wav' \
27+
--exclude='yarn.lock' \
28+
'\r$' .
29+
) || true
30+
if [[ $WINDOWS_FILES ]]; then
31+
echo "Files with Windows line-endings were found:"
32+
echo "$WINDOWS_FILES"
33+
exit 1
34+
fi

0 commit comments

Comments
 (0)