-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(upgrade): add package.json update flow to cli (#10388)
* chore: check-in work * chore: check-in work * chore(upgrade): clean-up project and eslint violations * chore(project): update prettierignore to include upgrade/cli.js * refactor(upgrade): remove extra comments, move afterAll block Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ac4b4bf
commit c0e02b4
Showing
33 changed files
with
1,608 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,6 @@ packages/icons-react/next/** | |
|
||
# Nextjs | ||
.next | ||
|
||
# Upgrade | ||
packages/upgrade/cli.js |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Generated by `esbuild` using `yarn build` | ||
/cli.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright IBM Corp. 2019, 2019 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mockAnswers = new Map(); | ||
|
||
const prompt = jest.fn().mockImplementation(async (questions) => { | ||
return questions | ||
.map((question) => { | ||
const answer = mockAnswers.get(question.name); | ||
if (!answer) { | ||
throw new Error( | ||
`Invalid mock usage for \`inquirer\`. Expected an answer to be ` + | ||
`mocked before prompt was called for question \`${question.name}\`` | ||
); | ||
} | ||
mockAnswers.delete(question.name); | ||
return { | ||
key: question.name, | ||
value: answer, | ||
}; | ||
}) | ||
.reduce((acc, { key, value }) => { | ||
return { | ||
...acc, | ||
[key]: value, | ||
}; | ||
}, {}); | ||
}); | ||
|
||
function mockAnswer(key, value) { | ||
mockAnswers.set(key, value); | ||
return { | ||
mockAnswers, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
prompt, | ||
mockAnswer, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "sample-project", | ||
"dependencies": { | ||
"carbon-components": "^10.49.0", | ||
"carbon-components-react": "^7.49.0", | ||
"carbon-icons": "^7.0.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright IBM Corp. 2019, 2019 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const logger = { | ||
setLevel: jest.fn(), | ||
log: jest.fn(), | ||
}; | ||
|
||
const levels = ['error', 'warn', 'info', 'verbose', 'debug', 'silly']; | ||
|
||
for (const level of levels) { | ||
logger[level] = jest.fn(); | ||
} | ||
|
||
export { logger }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.