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

MJML6 Migrate from Lerna to NX, and introducing Typescript #2908

Open
wants to merge 16 commits into
base: fix/replace-html-minifier
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

18 changes: 0 additions & 18 deletions .eslintrc

This file was deleted.

54 changes: 32 additions & 22 deletions .github/workflows/mjml-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
name: Mjml CI
on: [push, pull_request]
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
actions: read
contents: read

jobs:
build:
main:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
with:
node-version: ${{ matrix.node-version }}
- name: Run linting & tests
run: |
yarn install
yarn build
yarn lint
cd packages/mjml-parser-xml
yarn install
yarn test --debug
cd ../../packages/mjml-core
yarn test --debug
cd ../../packages/mjml
yarn test
fetch-depth: 0

- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
- run: bunx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"

- run: bun install --no-cache
- uses: nrwl/nx-set-shas@v4

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: bun nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- run: bun nx affected -t lint test build
47 changes: 41 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
.DS_Store
*.log
.idea/
lib
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
tmp
/out-tsc

# dependencies
node_modules
test.html
/**/npmignore

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

.nx/cache
.nx/workspace-data
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

6 changes: 4 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"printWidth": 80,
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"trailingComma": "all"
"printWidth": 120,
"tabWidth": 2,
"arrowParens": "avoid"
}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [

"nrwl.angular-console"
]
}
20 changes: 0 additions & 20 deletions babel.config.js

This file was deleted.

Binary file added bun.lockb
Binary file not shown.
39 changes: 39 additions & 0 deletions ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
actions: read
contents: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0


- uses: oven-sh/setup-bun@v1
with:
bun-version: latest


# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
- run: bunx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"


- run: bun install --no-cache
- uses: nrwl/nx-set-shas@v4

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: bun nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- run: bun nx affected -t lint test build
13 changes: 0 additions & 13 deletions lerna.json

This file was deleted.

1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// ?
13 changes: 13 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "nx/presets/npm.json",
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"nxCloudId": "66ffc8309ce17251260acaf7",
"namedInputs": {
"sharedGlobals": [
"{workspaceRoot}/.github/workflows/ci.yml"
],
"default": [
"sharedGlobals"
]
}
}
40 changes: 12 additions & 28 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,34 +1,18 @@
{
"name": "mjml-master",
"name": "mjml-next",
"version": "0.0.0",
"license": "MIT",
"main": "main.js",
"scripts": {},
"private": true,
"scripts": {
"build:watch": "lerna run build --parallel -- -- -w",
"build": "lerna run build --parallel --ignore mjml-browser",
"build-browser": "cd packages/mjml-browser && yarn build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"postinstall": "lerna bootstrap",
"prettier": "prettier --write \"packages/**/{src,bin}/**/*.?(js|json)\""
"dependencies": {
"typescript": "^5.6.2"
},
"devDependencies": {
"@nx/js": "19.8.3",
"nx": "19.8.3"
},
"workspaces": [
"packages/*"
],
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.7",
"@babel/register": "^7.8.6",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-lodash": "^3.3.4",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.21.1",
"lerna": "^3.22.1",
"open": "^7.3.0",
"prettier": "^3.2.4",
"rimraf": "^3.0.2"
}
]
}
Empty file added packages/.gitkeep
Empty file.
15 changes: 3 additions & 12 deletions packages/mjml-accordion/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "mjml-accordion",
"description": "mjml-accordion",
"version": "4.15.3",
"main": "lib/index.js",
"version": "5.0.0-alpha.4",
"main": "src/index.js",
"files": [
"lib"
],
Expand All @@ -16,17 +16,8 @@
"url": "https://github.com/mjmlio/mjml/issues"
},
"homepage": "https://mjml.io",
"scripts": {
"clean": "rimraf lib",
"build": "babel src --out-dir lib --root-mode upward"
},
"dependencies": {
"@babel/runtime": "^7.23.9",
"lodash": "^4.17.21",
"mjml-core": "4.15.3"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"rimraf": "^3.0.2"
"mjml-core": "5.0.0-alpha.4"
}
}
21 changes: 21 additions & 0 deletions packages/mjml-accordion/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "mjml-accordion",
"targets": {
"build": {
"executor": "@nrwl/node:package",
"options": {
"outputPath": "dist/packages/mjml-accordion",
"tsConfig": "packages/mjml-accordion/tsconfig.json",
"packageJson": "packages/mjml-accordion/package.json",
"main": "packages/mjml-accordion/src/index.ts",
"assets": ["packages/mjml-accordion/README.md"]
}
},
"release": {
"executor": "nx:run-commands",
"options": {
"command": "npm publish dist/packages/mjml-accordion --access public"
}
}
}
}
Loading
Loading