This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1698 from Shopify/multi-build-support
Multi-build support (cjs, esm, esnext) for all quilt packages
- Loading branch information
Showing
406 changed files
with
4,267 additions
and
2,647 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
node_modules | ||
coverage | ||
**/node_modules/* | ||
**/packages/*.js | ||
*.d.ts | ||
**/templates/* | ||
**/dummy/** | ||
templates | ||
gems/**/dummy | ||
packages/*/build | ||
**/*.d.ts | ||
**/*.js | ||
**/*.esnext | ||
**/*.mjs |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package.json | ||
node_modules | ||
dist | ||
packages/*/build | ||
coverage | ||
*.svg | ||
templates/*.md | ||
|
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
This file was deleted.
Oops, something went wrong.
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,63 @@ | ||
import { | ||
Package, | ||
createComposedProjectPlugin, | ||
createProjectTestPlugin, | ||
createProjectBuildPlugin, | ||
} from '@sewing-kit/plugins'; | ||
import {react} from '@sewing-kit/plugin-react'; | ||
import {javascript, updateBabelPreset} from '@sewing-kit/plugin-javascript'; | ||
import {typescript} from '@sewing-kit/plugin-typescript'; | ||
import {buildFlexibleOutputs} from '@sewing-kit/plugin-package-flexible-outputs'; | ||
import {} from '@sewing-kit/plugin-jest'; | ||
|
||
import {addLegacyDecoratorSupport} from './plugin'; | ||
|
||
export function quiltPackage({jestEnv = 'jsdom', useReact = false} = {}) { | ||
return createComposedProjectPlugin<Package>('Quilt.Package', [ | ||
javascript(), | ||
typescript(), | ||
useReact && react(), | ||
buildFlexibleOutputs(), | ||
createProjectBuildPlugin('Quilt.PackageBuild', ({hooks}) => { | ||
hooks.target.hook(({hooks}) => { | ||
hooks.configure.hook(hooks => { | ||
hooks.babelIgnorePatterns?.hook(ext => [ | ||
...ext, | ||
'**/test/**/*', | ||
'**/tests/**/*', | ||
]); | ||
|
||
hooks.babelConfig?.hook(addLegacyDecoratorSupport); | ||
}); | ||
}); | ||
}), | ||
createProjectTestPlugin('Quilt.PackageTest', ({hooks}) => { | ||
hooks.configure.hook(hooks => { | ||
hooks.jestEnvironment?.hook(() => jestEnv); | ||
|
||
hooks.jestTransforms?.hook(transforms => ({ | ||
...transforms, | ||
'\\.(gql|graphql)$': 'jest-transform-graphql', | ||
})); | ||
|
||
hooks.jestWatchIgnore?.hook(patterns => [ | ||
...patterns, | ||
'<rootDir>/.*/tests?/.*fixtures', | ||
]); | ||
|
||
hooks.babelConfig?.hook(addLegacyDecoratorSupport); | ||
|
||
// Each test imports from react-testing during setup | ||
hooks.babelConfig?.hook( | ||
updateBabelPreset( | ||
['@babel/preset-react', require.resolve('@babel/preset-react')], | ||
{ | ||
development: false, | ||
useBuiltIns: true, | ||
}, | ||
), | ||
); | ||
}); | ||
}), | ||
]); | ||
} |
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,23 @@ | ||
import {BabelConfig, updateBabelPlugin} from '@sewing-kit/plugin-javascript'; | ||
|
||
export function addLegacyDecoratorSupport(config: BabelConfig) { | ||
return updateBabelPlugin( | ||
[ | ||
'@babel/plugin-proposal-class-properties', | ||
require.resolve('@babel/plugin-proposal-class-properties'), | ||
], | ||
{ | ||
loose: true, | ||
}, | ||
)(config).then(babelConfig => { | ||
return updateBabelPlugin( | ||
[ | ||
'@babel/plugin-proposal-decorators', | ||
require.resolve('@babel/plugin-proposal-decorators'), | ||
], | ||
() => ({ | ||
legacy: true, | ||
}), | ||
)(babelConfig); | ||
}); | ||
} |
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
File renamed without changes.
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.