The dist folder was made incorrectly. Not sure what happened. I also contacted you on Discord about it. Regardless this PR should fix all issues. Simply run npm publish and it will lint, test and build the code all automatically. You won't ever have to touch the content of the dist folder, which is how it should be regarded.
I added a bunch more of npx to ensure the scripts use the tools. They should've done so already but still, can't be too sure I guess?
Anyway the takeaway is that you shouldn't copy-pasta the NPM scripts if you were doing that, that's the only thing that comes in my mind that could've happened anyway. Just do npm run <script_name> or npm run-script <script_name> to run them. prebuild and postbuild are automatically ran before and after npm run build respectively and prepublishOnly is always run before npm publish.
Running npm publish --dry-run now results in:
Favna@Stormfortress MINGW64 /e/UserFiles/DevProjects/booru (fix/package-scripts)
$ npm publish --dry-run
> booru@2.0.1 prepublishOnly .
> npm run-script build
> booru@2.0.1 prebuild E:\UserFiles\DevProjects\booru
> npm run-script clean && npm run-script lint && npm run-script test
> booru@2.0.1 clean E:\UserFiles\DevProjects\booru
> npx rimraf ./dist
> booru@2.0.1 lint E:\UserFiles\DevProjects\booru
> npx tslint --fix -p . -c ./tslint.json ./src/**/*.ts
> booru@2.0.1 test E:\UserFiles\DevProjects\booru
> npx jest --no-cache
PASS test test/util.spec.ts
PASS test test/realbooru.spec.ts
PASS test test/konachan-com.spec.ts
PASS test test/rule43paheal.spec.ts
PASS test test/danbooru.spec.ts
PASS test test/safebooru.spec.ts
PASS test test/furrybooru.spec.ts (5.071s)
PASS test test/rule34.spec.ts
PASS test test/konachan-net.spec.ts
PASS test test/lolibooru.spec.ts (5.199s)
PASS test test/hypnohub.spec.ts (5.246s)
PASS test test/derpibooru.spec.ts (5.335s)
PASS test test/e621.spec.ts (5.6s)
PASS test test/xbooru.spec.ts
PASS test test/gelbooru.spec.ts (5.637s)
PASS test test/tbib.spec.ts
PASS test test/e926.spec.ts (6.211s)
PASS test test/yandere.spec.ts
Test Suites: 18 passed, 18 total
Tests: 38 passed, 38 total
Snapshots: 0 total
Time: 9.344s
Ran all test suites.
> booru@2.0.1 build E:\UserFiles\DevProjects\booru
> npx tsc
> booru@2.0.1 postbuild E:\UserFiles\DevProjects\booru
> npx terser-folder ./dist -eo ./dist -x .js && npx copyfiles ./example.js ./dist
File dist\boorus\Derpibooru.js written successfully !
File dist\index.js written successfully !
File dist\Constants.js written successfully !
File dist\structures\InternalSearchParameters.js written successfully !
File dist\boorus\XmlBooru.js written successfully !
File dist\structures\Post.js written successfully !
File dist\boorus\Booru.js written successfully !
File dist\structures\SearchResults.js written successfully !
File dist\structures\Site.js written successfully !
File dist\structures\SiteApi.js written successfully !
File dist\structures\SearchParameters.js written successfully !
File dist\Utils.js written successfully !
File dist\structures\SiteInfo.js written successfully !
npm notice
npm notice package: booru@2.0.1
npm notice === Tarball Contents ===
npm notice 1.9kB package.json
npm notice 1.1kB LICENSE.md
npm notice 2.7kB readme.md
npm notice 814B dist/boorus/Booru.d.ts
npm notice 2.0kB dist/boorus/Booru.js
npm notice 394B dist/boorus/Derpibooru.d.ts
npm notice 779B dist/boorus/Derpibooru.js
npm notice 167B dist/boorus/XmlBooru.d.ts
npm notice 309B dist/boorus/XmlBooru.js
npm notice 498B dist/Constants.d.ts
npm notice 1.1kB dist/Constants.js
npm notice 1.5kB dist/example.js
npm notice 653B dist/index.d.ts
npm notice 2.0kB dist/index.js
npm notice 5.8kB dist/sites.json
npm notice 212B dist/structures/InternalSearchParameters.d.ts
npm notice 68B dist/structures/InternalSearchParameters.js
npm notice 889B dist/structures/Post.d.ts
npm notice 2.4kB dist/structures/Post.js
npm notice 133B dist/structures/SearchParameters.d.ts
npm notice 68B dist/structures/SearchParameters.js
npm notice 623B dist/structures/SearchResults.d.ts
npm notice 924B dist/structures/SearchResults.js
npm notice 332B dist/structures/Site.d.ts
npm notice 345B dist/structures/Site.js
npm notice 84B dist/structures/SiteApi.d.ts
npm notice 68B dist/structures/SiteApi.js
npm notice 272B dist/structures/SiteInfo.d.ts
npm notice 68B dist/structures/SiteInfo.js
npm notice 462B dist/Utils.d.ts
npm notice 1.3kB dist/Utils.js
npm notice === Tarball Details ===
npm notice name: booru
npm notice version: 2.0.1
npm notice package size: 9.5 kB
npm notice unpacked size: 30.0 kB
npm notice shasum: 8a0eafae460354bf422f5942d49c8dbd6a8231ac
npm notice integrity: sha512-DopsCV1krFlMv[...]ndCianW9N+bkw==
npm notice total files: 31
npm notice
+ booru@2.0.1
example.js was not included in the distribution which means ... was a wrong way to fix it. As seen above it should get copied into dist/ and so the path was correct. These were the files that were in your published version:
I'm also not sure where test.js and test.d.ts came from. That would suggest you have a local non-ignored, non-committed and non-pushed test.ts file in src/.
The dist folder was made incorrectly. Not sure what happened. I also contacted you on Discord about it. Regardless this PR should fix all issues. Simply run
npm publish
and it will lint, test and build the code all automatically. You won't ever have to touch the content of thedist
folder, which is how it should be regarded.I added a bunch more of
npx
to ensure the scripts use the tools. They should've done so already but still, can't be too sure I guess?Anyway the takeaway is that you shouldn't copy-pasta the NPM scripts if you were doing that, that's the only thing that comes in my mind that could've happened anyway. Just do
npm run <script_name>
ornpm run-script <script_name>
to run them.prebuild
andpostbuild
are automatically ran before and afternpm run build
respectively andprepublishOnly
is always run beforenpm publish
.Running
npm publish --dry-run
now results in:example.js
was not included in the distribution which means ... was a wrong way to fix it. As seen above it should get copied intodist/
and so the path was correct. These were the files that were in your published version:I'm also not sure where
test.js
andtest.d.ts
came from. That would suggest you have a local non-ignored, non-committed and non-pushedtest.ts
file insrc/
.