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

Typescript-Migration: @storybook/addons #5018

Merged
merged 34 commits into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9d2f1fc
WIP working on migration for @storybook/addons
kroeder Dec 17, 2018
231470a
Merge remote-tracking branch 'origin/ts-migration/channels' into ts-m…
igor-dv Dec 17, 2018
3857828
Unfinished things
igor-dv Dec 17, 2018
fa2c957
Rewrote @storybook/addons
kroeder Dec 17, 2018
7b56599
removed unnecessary module declaration
kroeder Dec 17, 2018
46eb123
Merge branch 'next' into ts-migration/addons
kroeder Dec 21, 2018
4beeba3
Fixed export issue in lib/addons
kroeder Dec 21, 2018
cd7eb71
Removed addons from devDep because it is already a dependency
kroeder Dec 21, 2018
6f6b119
Renamed createChannel to mockChannel in storybook-mock-channel
kroeder Dec 21, 2018
7b6a9c3
Remove jsnext:main with ts + add global as a module declaration to notes
igor-dv Dec 22, 2018
ac730de
Added exports for register.tsx in public_api
kroeder Dec 23, 2018
2652e10
Try to fix CI smoke-test
kroeder Dec 23, 2018
b681f0d
Removed types for react in package; types are already in the root pac…
kroeder Dec 23, 2018
ec0a8c2
Still trying to fix CI
kroeder Dec 23, 2018
c617694
yarn.lock
kroeder Dec 23, 2018
afc55ca
revert debug output
kroeder Dec 23, 2018
17075d9
Use named imports
kroeder Dec 23, 2018
395f776
Use named imports
kroeder Dec 23, 2018
60c6320
Added types entry in channel package.json
kroeder Dec 23, 2018
d90fba2
Removed jsx tsconfig entry in addon-notes
kroeder Dec 23, 2018
05b1f5a
Workaround proposal for splitting up pure ts projects from mixed ones
kroeder Dec 23, 2018
0d88e53
Check existence of types
kroeder Dec 23, 2018
8d7005a
Merge branch 'next' into ts-migration/addons
kroeder Dec 23, 2018
ce41026
fix require path
kroeder Dec 23, 2018
33ad476
Set jsx to react
kroeder Dec 24, 2018
86a2813
Set require back to js instead of jsx
kroeder Dec 24, 2018
3132aec
Exclude test files
kroeder Dec 24, 2018
5e34e42
Debugging native-smoke CI - revert this
kroeder Dec 24, 2018
b778871
Merge branch 'next' into ts-migration/addons
kroeder Dec 26, 2018
b24a792
silent false for test purpose
kroeder Dec 27, 2018
05119a8
more debug messages
kroeder Dec 27, 2018
3343b93
Enhanced error output on CI build errors
kroeder Dec 27, 2018
13123b7
Improved error output
kroeder Dec 27, 2018
a903991
try to fix ci
kroeder Dec 27, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"bootstrap": "node ./scripts/bootstrap.js",
"bootstrap:crna-kitchen-sink": "npm --prefix examples-native/crna-kitchen-sink install",
"bootstrap:docs": "yarn install --cwd docs",
"build-packs": "lerna exec --scope '@storybook/*' --parallel -- \\$LERNA_ROOT_PATH/scripts/build-pack.sh \\$LERNA_ROOT_PATH/packs",
"build-packs": "lerna exec --scope '@storybook/*' -- \\$LERNA_ROOT_PATH/scripts/build-pack.sh \\$LERNA_ROOT_PATH/packs",
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to remove --parallel in order to fix native-smoke-test
The ts build of addons always failed because it seemed that channels wasn't build but addons relied on channels so it could not build as well

I found this lerna/lerna#1681 and thought "give it a shot", though I'm not sure if this is okay? I spent a lot of time on fixing this, if this is not the right fix I definitely need help for another way.

Copy link
Member

Choose a reason for hiding this comment

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

🆗

"build-storybooks": "./scripts/build-storybooks.sh",
"changelog": "pr-log --sloppy --cherry-pick",
"changelog:next": "pr-log --sloppy --since-prerelease",
Expand Down
5 changes: 2 additions & 3 deletions scripts/compile-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ function tscfy(options = {}) {
}

const command = getCommand(watch);
const shellExecReturn = shell.exec(command, { silent });
const { code } = shellExecReturn;
const { code } = shell.exec(command, { silent });

handleExit(code, errorCallback(shellExecReturn));
handleExit(code, errorCallback);
}

module.exports = {
Expand Down
12 changes: 5 additions & 7 deletions scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,21 @@ function removeTsFromDist() {
}
}

function logError(type, packageJson, shellExecReturn) {
function logError(type, packageJson) {
log.error(
`FAILED to compile ${type}: ${chalk.bold(
`${packageJson.name}@${packageJson.version}\n ${shellExecReturn}`
)}`
`FAILED to compile ${type}: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}`
);
}

const packageJson = getPackageJson();

removeDist();
if (packageJson && packageJson.types && packageJson.types.indexOf('d.ts') !== -1) {
tscfy({ errorCallback: shellExecMessage => logError('ts', packageJson, shellExecMessage) });
tscfy({ errorCallback: () => logError('ts', packageJson) });
} else {
babelify({ errorCallback: shellExecMessage => logError('js', packageJson, shellExecMessage) });
babelify({ errorCallback: () => logError('js', packageJson) });
removeTsFromDist();
tscfy({ errorCallback: shellExecMessage => logError('ts', packageJson, shellExecMessage) });
tscfy({ errorCallback: () => logError('ts', packageJson) });
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Pure ts projects may cause unexpected behavior when it runs through babelify as well
In my case babelify copied tsx files into dist


console.log(chalk.gray(`Built: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}`));