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

init: pnpm setup #6114

Merged
merged 9 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
File renamed without changes.
36 changes: 36 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup Project
description: 'Sets up the project by installing dependencies, building the project, and installing Turbo.'

inputs:
pnpm-version:
description: 'The version of pnpm to use for installing dependencies.'
required: false
default: 8.6.3
node-version:
description: 'The version of Node.js to use for building the project.'
required: false
default: '20.16.0'
turbo-version:
description: 'The version of Turbo to install globally.'
required: false
default: 2.0.14

runs:
using: composite
steps:
- uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'pnpm'
- name: Install Turbo
run: npm i -g turbo@${{ inputs.turbo-version }}
shell: bash
- name: Install dependencies
run: pnpm install
shell: bash
- name: Build project
run: pnpm build --force
shell: bash
38 changes: 13 additions & 25 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
name: Core Package Tests

name: GrapesJS Qualty Checks
on:
push:
branches: [dev]
pull_request:
branches: [dev]

jobs:
quality:
quailty-checks:
runs-on: ubuntu-latest
danstarns marked this conversation as resolved.
Show resolved Hide resolved
defaults:
run:
working-directory: ./packages/core

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "./packages/core/yarn.lock"
- run: yarn --frozen-lockfile
- run: npm run lint
- run: npm run lint:ts
- run: npm run format:check
- run: yarn build
- run: npm run ts:build:check
- run: npm run docs:api
- run: npm test
- uses: ./.github/actions/setup-project
- name: Line
run: pnpm lint
- name: Format
run: pnpm format:check
- name: Build
run: pnpm build --force
- name: Test
run: pnpm test
- name: Docs
run: pnpm docs:api
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ images/
private/
vendor/
coverage/
/locale/
locale/
node_modules/
bower_components/
grapesjs-*.tgz
_index.html
docs/.vuepress/dist
dist/
dist/
.turbo/
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ For the development purpose you should follow instructions below.

<script type="text/javascript">
var editor = grapesjs.init({
container: "#gjs",
container: '#gjs',
components: '<div class="txt-red">Hello world!</div>',
style: ".txt-red{color: red}",
style: '.txt-red{color: red}',
});
</script>
```
Expand Down
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "@grapesjs/monorepo",
"version": "0.0.0",
"packageManager": "pnpm@8.6.3",
"scripts": {
"start": "turbo start --filter \"grapesjs\"",
"test": "turbo test --filter \"grapesjs\"",
"docs": "cd ./packages/core && pnpm run docs",
"docs:api": "cd ./packages/core && pnpm run docs:api",
"lint": "eslint .",
"build": "turbo build",
"clean": "find . -type d \\( -name \"node_modules\" -o -name \"build\" -o -name \".turbo\" -o -name \"dist\" \\) -exec rm -rf {} + && rm ./pnpm-lock.yaml",
"format": "prettier . --write",
"format:check": "prettier . --check"
},
"devDependencies": {
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the dev deps for typescript, testing, building, and lining are now in this file.

"@babel/cli": "7.24.8",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@babel/preset-typescript": "7.24.7",
"@jest/globals": "29.7.0",
"@types/jest": "29.5.12",
"@types/node": "22.4.1",
"@types/underscore": "^1.11.15",
"@typescript-eslint/eslint-plugin": "8.1.0",
"@typescript-eslint/parser": "8.0.1",
"cross-env": "7.0.3",
"css-loader": "7.1.2",
"dotenv": "16.4.5",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard-with-typescript": "43.0.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jest": "28.8.0",
"eslint-plugin-n": "17.10.2",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-promise": "7.1.0",
"eslint-plugin-react-hooks": "4.6.2",
"jest": "29.7.0",
"prettier": "3.3.3",
"ts-jest": "29.2.4",
"ts-loader": "9.5.1",
"ts-node": "10.9.2",
"turbo": "2.0.14",
"typescript": "5.5.4"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
Copy link
Member Author

Choose a reason for hiding this comment

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

They are hoisted to the root.

"@babel/*",
"typescript",
"ts-node",
"@tsconfig/*",
"@types/*",
"jest",
"@jest/*",
"supertest",
"prettier"
]
}
},
"engines": {
"node": ">=20",
"pnpm": ">=8"
}
}
21 changes: 2 additions & 19 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,21 @@
"backbone-undo": "0.2.6",
"codemirror": "5.63.0",
"codemirror-formatting": "1.0.0",
"html-entities": "~1.4.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

@artf this is needed to stop error:

Looks like we should keep it.

"promise-polyfill": "8.1.3",
"underscore": "1.13.1"
},
"devDependencies": {
"@babel/cli": "7.24.8",
"@babel/preset-typescript": "7.24.7",
"@types/jest": "29.5.12",
"@types/markdown-it": "14.1.2",
"@typescript-eslint/eslint-plugin": "8.2.0",
"@typescript-eslint/parser": "8.0.1",
"@vuepress/plugin-google-analytics": "1.8.2",
"@vuepress/types": "1.9.10",
"documentation": "14.0.3",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.8.0",
"eslint-plugin-prettier": "5.1.3",
"grapesjs-cli": "4.1.3",
Copy link
Member Author

Choose a reason for hiding this comment

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

There is a conflict in the repo with webpack, as vuepress relies on a different version of webpack as to grapesjs-cli, we can resolve this better and share webpack when we have the cli in the monorepo.

"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jsdom": "24.1.1",
"npm-run-all": "4.1.5",
"postcss": "8",
"prettier": "3.3.3",
"sass": "1.42.1",
"typescript": "5.5.4",
"vuepress": "1.9.10",
"whatwg-fetch": "3.6.20"
},
Expand All @@ -86,21 +75,15 @@
"docs:build-vp": "vuepress build docs",
"docs:build": "npm run docs:api && npm run docs:build-vp",
"docs:deploy": "docs/deploy.sh",
"lint": "eslint .",
"lint:ts": "tsc --noEmit",
"build": "npm run build-all && npm run ts:check",
"build": "npm run build-all",
"build-all": "run-s build:*",
"build:js": "grapesjs-cli build --patch=false --targets=\"> 1%, ie 11, safari 8, not dead\" --statsOutput=\"stats.json\" --localePath=\"src/i18n/locale\"",
"build:mjs": "BUILD_MODULE=true grapesjs-cli build --dts='skip' --patch=false --targets=\"> 1%, ie 11, safari 8, not dead\"",
"build:css": "sass src/styles/scss/main.scss dist/css/grapes.min.css --no-source-map --style=compressed --load-path=node_modules",
"ts:build": "grapesjs-cli build --dts='only' --patch=false",
"ts:check": "tsc --noEmit --esModuleInterop dist/index.d.ts",
"ts:build:check": "npm run ts:build && npm run ts:check",
"start": "run-p start:*",
"start:js": "grapesjs-cli serve",
"start:css": "npm run build:css -- --watch",
"format": "prettier . --write",
"format:check": "prettier . --check",
"test": "jest --forceExit",
"test:dev": "jest --watch"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = ({ config, pkg, webpack }) => {
modules: [...(config.resolve && config.resolve.modules), 'src'],
alias: {
...(config.resolve && config.resolve.alias),
jquery: 'utils/cash-dom',
jquery: `${rootDir}/src/utils/cash-dom`,
backbone: `${rootDir}/node_modules/backbone`,
underscore: `${rootDir}/node_modules/underscore`,
},
Expand Down
Loading
Loading