-
Notifications
You must be signed in to change notification settings - Fork 1
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
Wrapped globSync and extracted blueprintRoot #24
Conversation
6c1053b
to
80985cd
Compare
@@ -30,7 +30,6 @@ function getPublicAssets(options) { | |||
|
|||
const filePaths = findFiles('public/**/*', { | |||
cwd: projectRoot, | |||
matchFilesOnly: true, |
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.
So far, we always looked for files (and never directories).
|
||
test('utils | blueprints | blueprint-root', function () { | ||
assert.strictEqual( | ||
blueprintRoot.endsWith('src/blueprints/ember-addon'), |
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.
Given that the value of blueprintRoot
depends on where the codemod is installed locally, the assertion using endsWith
may be the strongest assertion that we can make (without leaking the implementation details in the test).
if (!packageName) { | ||
throw new SyntaxError( | ||
`ERROR: In package.json, the package name \`${addonPackage.name}\` is not valid.` | ||
); | ||
} |
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.
In ember-codemod-pod-to-octane
, I realized that it's not a good idea to perform validation inside this function (concerns weren't separated well).
/* | ||
This object has an order dependency. The `default` key must appear last. | ||
*/ |
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.
Related: #16
Background
In #20, updating
glob
fromv8
tov9
involved fixing breaking changes. Fortunately, the fix wasn't difficult because I had usedglob.sync
(now namedglobSync
) in only two (2) different ways.Nonetheless,
globSync
is used in several files, each with a unique context (i.e. the steps are different from one another). To help onboard new contributors, we should wrapglobSync
and minimize the API that we need.What changed?
I took care of a few technical risks:
findFiles
, which wrapsglobSync
and minimizes the API.unionize
, which creates the brace expansion thatglob
understands.blueprintRoot
. The value depends on wherenpx
installs the codemod on the end-developer's machine.findFiles
andblueprintRoot
.