-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: Refactor to support a test to require and es-checking library files #7
Conversation
BREAKING CHANGE: Many new files are checked for syntax.
@@ -17,7 +17,8 @@ | |||
"dependencies": { | |||
"colorette": "^1.1.0", | |||
"es-check": "^5.0.0", | |||
"pkg-can-install": "^1.0.4", | |||
"exit-hook": "^2.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependency updates.
src/can-require.js
Outdated
|
||
const run = function(cwd, pkg) { | ||
return Promise.resolve().then(function() { | ||
if (pkg.main) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test if we can require a package or not (but only if it has a main file)
@@ -21,7 +21,8 @@ const printHelp = function() { | |||
console.log(' -V, --verbose Print all results, even successful ones.'); | |||
console.log(' -q, --quiet Don\'t print anything.'); | |||
console.log(' -d, --dir [dir] Run in this project directory, defaults to cwd.'); | |||
console.log(' --skip-es-check Do not run es check on dist, for projects with no dist.'); | |||
console.log(' --skip-es-check skip the syntax check, still here for backwards compatablity'); | |||
console.log(` --skip-[name] skip a test that you do not want to run. ${testNames.join(', ')}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option replaces --skip-es-check
and supports any of the tests that we run. I am keeping --skip-es-check
around to keep this fairly backwards compatible.
src/clone-npm-pkg.js
Outdated
const promiseSpawn = require('./promise-spawn.js'); | ||
const exitHook = require('exit-hook'); | ||
|
||
const run = function(cwd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic used to live in the main verify
function, but it just made things confusing.
const text = 'Dist files have the correct js syntax'; | ||
const cjsFields = ['bin', 'main', 'browser']; | ||
const esFields = ['es2015', 'module']; | ||
const getFieldFiles = function(cwd, pkg, fields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
es check any files in package.json
, and files in ./es
, ./cjs
./dist/*.js
and ./dist/lang/*.js
const pkgCanInstall = require('./pkg-can-install.js'); | ||
const canRequire = require('./can-require'); | ||
|
||
const tests = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we ever find that we need to add more tests in the future it will be easy now. Furthermore tests now have names that make sense, rather than being named after binaries.
afe1698
to
a5b558a
Compare
a5b558a
to
6468287
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look too deeply because of the number of changes, but seems good.
…iles (#7) BREAKING CHANGE: Many new files are checked for syntax. Index file returns a new promise format.
No description provided.