-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(build): enable imports directly from extensions and utils folder #77
Changes from all commits
c2d3495
b367149
4343f29
d749be3
4d6dfd9
46f61ab
7063048
a86ccbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,13 @@ jobs: | |
|
||
- run: | | ||
yarn install | ||
yarn build | ||
yarn build-mjml-react | ||
|
||
- name: Run semantic release (release + bump version) | ||
run: npx semantic-release | ||
run: | | ||
cd dist | ||
npx semantic-release | ||
env: | ||
HUSKY: 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to skip husky pre-commit hook since it causes an error when running semantic-release from the dist folder |
||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,8 @@ | |
"bugs": { | ||
"url": "https://github.com/Faire/mjml-react/issues" | ||
}, | ||
"main": "dist/src/index.js", | ||
"files": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We no longer need to specify files. We copy this to the dist folder, and we want to include everything in the dist folder in the publish |
||
"extensions.js", | ||
"utils.js", | ||
"dist" | ||
], | ||
"types": "dist/src/index.d.ts", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
|
@@ -32,15 +27,16 @@ | |
"access": "public" | ||
}, | ||
"scripts": { | ||
"build": "/bin/rm -rf dist && yarn build-cjs && yarn build-esm", | ||
"build-dist": "/bin/rm -rf dist && yarn build-cjs && yarn build-esm", | ||
"build-cjs": "tsc -p tsconfig.json", | ||
"build-esm": "tsc -p tsconfig-esm.json", | ||
"lint": "eslint .", | ||
"format": "prettier --write .", | ||
"test": "jest", | ||
"test-dist-skip-build": "jest --config=jest-dist.config.js", | ||
"test-dist": "yarn build && yarn test-dist-skip-build", | ||
"test-dist": "yarn build-dist && yarn test-dist-skip-build", | ||
"generate-mjml-react": "ts-node scripts/generate-mjml-react.ts", | ||
"build-mjml-react": "ts-node scripts/build-mjml-react.ts", | ||
"prepare": "husky install" | ||
}, | ||
"devDependencies": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { exec as execCb } from "child_process"; | ||
import * as fs from "fs"; | ||
import util from "util"; | ||
|
||
const exec = util.promisify(execCb); | ||
|
||
async function buildMjmlReact() { | ||
await exec("yarn build-dist"); | ||
moveFilesToDist(); | ||
} | ||
|
||
const FILES_TO_COPY = ["package.json", "LICENSE", "README.md"]; | ||
function moveFilesToDist() { | ||
FILES_TO_COPY.forEach((fileToCopy) => { | ||
const destination = `dist/${fileToCopy}`; | ||
if (fileToCopy === "package.json") { | ||
const file = fs.readFileSync(fileToCopy); | ||
fs.writeFileSync(destination, file.toString().replace(/dist\//g, "")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice and simple 🥂 |
||
} else { | ||
fs.copyFileSync(fileToCopy, destination); | ||
} | ||
}); | ||
} | ||
|
||
buildMjmlReact(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* This file is generated. Don't edit it directly. | ||
* Modify `scripts/generate-mjml-react.ts` to make changes to these files | ||
*/ | ||
|
||
export { Mjml } from "./Mjml"; | ||
export type { IMjmlProps } from "./Mjml"; | ||
export { MjmlAll } from "./MjmlAll"; | ||
export type { IMjmlAllProps } from "./MjmlAll"; | ||
export { MjmlClass } from "./MjmlClass"; | ||
export type { IMjmlClassProps } from "./MjmlClass"; | ||
export { MjmlInclude } from "./MjmlInclude"; | ||
export type { IMjmlIncludeProps } from "./MjmlInclude"; | ||
export { MjmlHtmlAttribute } from "./MjmlHtmlAttribute"; | ||
export type { IMjmlHtmlAttributeProps } from "./MjmlHtmlAttribute"; | ||
export { MjmlSelector } from "./MjmlSelector"; | ||
export type { IMjmlSelectorProps } from "./MjmlSelector"; | ||
export { MjmlBody } from "./MjmlBody"; | ||
export type { IMjmlBodyProps } from "./MjmlBody"; | ||
export { MjmlHead } from "./MjmlHead"; | ||
export type { IMjmlHeadProps } from "./MjmlHead"; | ||
export { MjmlAttributes } from "./MjmlAttributes"; | ||
export type { IMjmlAttributesProps } from "./MjmlAttributes"; | ||
export { MjmlBreakpoint } from "./MjmlBreakpoint"; | ||
export type { IMjmlBreakpointProps } from "./MjmlBreakpoint"; | ||
export { MjmlHtmlAttributes } from "./MjmlHtmlAttributes"; | ||
export type { IMjmlHtmlAttributesProps } from "./MjmlHtmlAttributes"; | ||
export { MjmlFont } from "./MjmlFont"; | ||
export type { IMjmlFontProps } from "./MjmlFont"; | ||
export { MjmlPreview } from "./MjmlPreview"; | ||
export type { IMjmlPreviewProps } from "./MjmlPreview"; | ||
export { MjmlStyle } from "./MjmlStyle"; | ||
export type { IMjmlStyleProps } from "./MjmlStyle"; | ||
export { MjmlTitle } from "./MjmlTitle"; | ||
export type { IMjmlTitleProps } from "./MjmlTitle"; | ||
export { MjmlHero } from "./MjmlHero"; | ||
export type { IMjmlHeroProps } from "./MjmlHero"; | ||
export { MjmlButton } from "./MjmlButton"; | ||
export type { IMjmlButtonProps } from "./MjmlButton"; | ||
export { MjmlColumn } from "./MjmlColumn"; | ||
export type { IMjmlColumnProps } from "./MjmlColumn"; | ||
export { MjmlDivider } from "./MjmlDivider"; | ||
export type { IMjmlDividerProps } from "./MjmlDivider"; | ||
export { MjmlGroup } from "./MjmlGroup"; | ||
export type { IMjmlGroupProps } from "./MjmlGroup"; | ||
export { MjmlImage } from "./MjmlImage"; | ||
export type { IMjmlImageProps } from "./MjmlImage"; | ||
export { MjmlRaw } from "./MjmlRaw"; | ||
export type { IMjmlRawProps } from "./MjmlRaw"; | ||
export { MjmlSection } from "./MjmlSection"; | ||
export type { IMjmlSectionProps } from "./MjmlSection"; | ||
export { MjmlSpacer } from "./MjmlSpacer"; | ||
export type { IMjmlSpacerProps } from "./MjmlSpacer"; | ||
export { MjmlText } from "./MjmlText"; | ||
export type { IMjmlTextProps } from "./MjmlText"; | ||
export { MjmlTable } from "./MjmlTable"; | ||
export type { IMjmlTableProps } from "./MjmlTable"; | ||
export { MjmlWrapper } from "./MjmlWrapper"; | ||
export type { IMjmlWrapperProps } from "./MjmlWrapper"; | ||
export { MjmlSocial } from "./MjmlSocial"; | ||
export type { IMjmlSocialProps } from "./MjmlSocial"; | ||
export { MjmlSocialElement } from "./MjmlSocialElement"; | ||
export type { IMjmlSocialElementProps } from "./MjmlSocialElement"; | ||
export { MjmlNavbar } from "./MjmlNavbar"; | ||
export type { IMjmlNavbarProps } from "./MjmlNavbar"; | ||
export { MjmlNavbarLink } from "./MjmlNavbarLink"; | ||
export type { IMjmlNavbarLinkProps } from "./MjmlNavbarLink"; | ||
export { MjmlAccordion } from "./MjmlAccordion"; | ||
export type { IMjmlAccordionProps } from "./MjmlAccordion"; | ||
export { MjmlAccordionElement } from "./MjmlAccordionElement"; | ||
export type { IMjmlAccordionElementProps } from "./MjmlAccordionElement"; | ||
export { MjmlAccordionText } from "./MjmlAccordionText"; | ||
export type { IMjmlAccordionTextProps } from "./MjmlAccordionText"; | ||
export { MjmlAccordionTitle } from "./MjmlAccordionTitle"; | ||
export type { IMjmlAccordionTitleProps } from "./MjmlAccordionTitle"; | ||
export { MjmlCarousel } from "./MjmlCarousel"; | ||
export type { IMjmlCarouselProps } from "./MjmlCarousel"; | ||
export { MjmlCarouselImage } from "./MjmlCarouselImage"; | ||
export type { IMjmlCarouselImageProps } from "./MjmlCarouselImage"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { namedEntityToHexCode } from "./html-entities"; | ||
export * from "./mjml-component-utils"; |
This file was deleted.
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.
As far as I could tell semantic-release doesn't allow specifying a path to package.json, so instead we run it from the same folder as the package.json in dist