Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tsc output and published package structure #18

Merged
merged 2 commits into from
Feb 10, 2021

Conversation

kherock
Copy link
Contributor

@kherock kherock commented Feb 9, 2021

I saw #8 open and thought I could make an easy fix here. I've found it usually gets confusing when you want to transpile src -> lib yet want to reference values from package.json at the project root or have test files outside of the src root directory. The way I've seen it done is to

  • use a separate tsconfig.build.json setting rootDir and include[] to src
  • to import values from package.json, either turn off resolveJsonModule and use require, or leave it on and use fs.readFileSync if you need json module types in other places

Aside from that, I also noticed the use of .npmignore wasn't doing a great job—files like .vscode/*, fixtures/*, tsconfig.json, etc. were getting into the package tgz. I've removed it and added "files": ["lib"], this is safe because of how most npm clients include/ignore files by default.

New package tree after these changes:

.
├── bin
│   ├── spack.js
│   └── swc.js
├── lib
│   ├── spack
│   │   ├── extensions.js
│   │   ├── index.js
│   │   └── options.js
│   └── swc
│       ├── dir.js
│       ├── file.js
│       ├── index.js
│       ├── options.js
│       └── util.js
├── package.json
└── README.md

@CLAassistant
Copy link

CLAassistant commented Feb 9, 2021

CLA assistant check
All committers have signed the CLA.

@kdy1
Copy link
Member

kdy1 commented Feb 10, 2021

Thanks!!

@kdy1 kdy1 merged commit c456493 into swc-project:master Feb 10, 2021
@kherock kherock deleted the fix-tsc-output branch June 28, 2021 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants