build: adjust source files structures (#136)

* build(typescript): disable from generating source map

* build(typescript): disable from generating declaration file

* build(typescript): modify source files to be compiled to the same dir

* build(typescript): modify distribution files to be generated to `dist` directory

* refactor: rename main entrypoint from `main` to `index`

* chore(git): specify attribute for `dist` directory instead of just `dist/index.mjs`
This commit is contained in:
Alfi Maulana 2023-12-14 18:20:50 +07:00 committed by GitHub
parent 0a416228af
commit 65845a480e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 14 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{ {
"root": true, "root": true,
"ignorePatterns": ["main"], "ignorePatterns": ["dist"],
"extends": ["eslint:recommended", "prettier"], "extends": ["eslint:recommended", "prettier"],
"parserOptions": { "parserOptions": {
"ecmaVersion": 2022, "ecmaVersion": 2022,

2
.gitattributes vendored
View File

@ -1,2 +1,2 @@
main/index.mjs -diff linguist-generated dist/** -diff linguist-generated
yarn.lock -diff linguist-generated yarn.lock -diff linguist-generated

View File

@ -66,7 +66,7 @@ jobs:
with: with:
sparse-checkout: | sparse-checkout: |
action.yaml action.yaml
main dist
test test
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
@ -100,7 +100,7 @@ jobs:
with: with:
sparse-checkout: | sparse-checkout: |
action.yaml action.yaml
main dist
test test
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
@ -129,7 +129,7 @@ jobs:
with: with:
sparse-checkout: | sparse-checkout: |
action.yaml action.yaml
main dist
test test
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
@ -153,7 +153,7 @@ jobs:
with: with:
sparse-checkout: | sparse-checkout: |
action.yaml action.yaml
main dist
test test
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
@ -177,7 +177,7 @@ jobs:
with: with:
sparse-checkout: | sparse-checkout: |
action.yaml action.yaml
main dist
test test
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
@ -206,7 +206,7 @@ jobs:
with: with:
sparse-checkout: | sparse-checkout: |
action.yaml action.yaml
main dist
test test
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false

3
.gitignore vendored
View File

@ -5,5 +5,6 @@
build/ build/
coverage/ coverage/
dist/
node_modules/ node_modules/
src/*.mjs

View File

@ -52,4 +52,4 @@ outputs:
value: ${{ steps.process-inputs.outputs.build-dir }} value: ${{ steps.process-inputs.outputs.build-dir }}
runs: runs:
using: node20 using: node20
main: main/index.mjs main: dist/index.mjs

2
main/index.mjs → dist/index.mjs generated vendored
View File

@ -27303,6 +27303,6 @@ async function main() {
} }
} }
main(); main();
//# sourceMappingURL=main.mjs.map
})(); })();

View File

@ -7,8 +7,5 @@
"lines": 100, "lines": 100,
"statements": 100 "statements": 100
} }
},
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.mjs$": "<rootDir>/dist/$1.mjs"
} }
} }

View File

@ -3,8 +3,8 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "tsc && ncc build dist/main.mjs -o main", "build": "tsc && ncc build src/index.mjs -o dist",
"format": "prettier --write . !main !README.md", "format": "prettier --write . !dist !README.md",
"lint": "eslint --ignore-path .gitignore .", "lint": "eslint --ignore-path .gitignore .",
"test": "tsc && jest" "test": "tsc && jest"
}, },

View File

@ -3,9 +3,6 @@
"exactOptionalPropertyTypes": true, "exactOptionalPropertyTypes": true,
"strict": true, "strict": true,
"module": "node16", "module": "node16",
"declaration": true,
"outDir": "dist",
"sourceMap": true,
"target": "es2022", "target": "es2022",
"skipLibCheck": true "skipLibCheck": true
}, },