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,
"ignorePatterns": ["main"],
"ignorePatterns": ["dist"],
"extends": ["eslint:recommended", "prettier"],
"parserOptions": {
"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

View File

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

3
.gitignore vendored
View File

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

View File

@ -52,4 +52,4 @@ outputs:
value: ${{ steps.process-inputs.outputs.build-dir }}
runs:
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();
//# sourceMappingURL=main.mjs.map
})();

View File

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

View File

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

View File

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