chore: move code to src/ and emit with TypeScript (#5568)

This updates our `tsconfig.json` so it emits our JavaScript files as
well as type checking them. We compile into `./lib` which we then ship
in our npm package. The source code has moved from `./lib` into `./src`.

Because the `src/` directory is exclusively JS files, this change is a
no-op in terms of code functionality but is the first step towards being
able to replace `src/X.js` with `src/X.ts` in a way that allows us to
migrate incrementally.

The `lib` directory is gitignored, and the `src` directory is
npmignored. On `npm publish` we will now run `npm run tsc` in order to
generate the outputted code.
This commit is contained in:
Jack Franklin
2020-04-02 15:25:19 +01:00
committed by GitHub
parent c82b5560f0
commit 7a2a41f208
41 changed files with 15214 additions and 23 deletions

View File

@@ -72,12 +72,12 @@ declare global {
export default Protocol;
`;
const outputPath = path.join(__dirname, '..', '..', 'lib', 'protocol.d.ts');
const outputPath = path.join(__dirname, '..', '..', 'src', 'protocol.d.ts');
require('fs').writeFileSync(outputPath, output);
console.log(`Wrote protocol.d.ts for ${version} to ${path.relative(process.cwd(), outputPath)}`);
console.log(`You should commit the changes.`);
});
/**
* @typedef {Object} Property
* @property {string=} $ref