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(init): init package with better main, types #179

Merged
merged 2 commits into from Jun 26, 2018

Conversation

ofrobots
Copy link
Contributor

Fixes: #144

@codecov-io
Copy link

codecov-io commented Jun 22, 2018

Codecov Report

Merging #179 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #179   +/-   ##
=======================================
  Coverage   99.13%   99.13%           
=======================================
  Files          10       10           
  Lines         460      460           
  Branches       31       31           
=======================================
  Hits          456      456           
  Misses          4        4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f09fc3...f6ae73d. Read the comment docs.

src/init.ts Outdated
// TODO(ofrobots): add proper error handling.
cp.spawnSync('npm', ['init', '-y']);
packageJson = await readJson('./package.json');
packageJson = DEFUALT_PACKAGE_JSON;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the try-catch here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed not. Removed.

@@ -21,7 +21,19 @@ import * as path from 'path';
import {Options} from './cli';
import {readFilep as read, readJsonp as readJson, writeFileAtomicp as write} from './util';

const pkg = require('../../package.json') as PackageJson;
const pkg = require('../../package.json');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the type annotation here disappear?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't an annotation but rather a cast. The cast was not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also – we don't use this yet – but going forward we would stronger types for package.json available from new resolveJsonModule in TS 2.9.

@ofrobots ofrobots merged commit 122fe81 into google:master Jun 26, 2018
@ofrobots ofrobots deleted the fix/144 branch June 26, 2018 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants