Browse Source

init: pnpm setup

pull/6114/head
danstarns 1 year ago
parent
commit
3a002ec6f6
  1. 0
      .eslintrc.js
  2. 36
      .github/actions/setup-project/action.yml
  3. 38
      .github/workflows/quality.yml
  4. 5
      .gitignore
  5. 0
      .prettierignore
  6. 0
      .prettierrc
  7. 4
      README.md
  8. 66
      package.json
  9. 21
      packages/core/package.json
  10. 2
      packages/core/webpack.config.js
  11. 17696
      pnpm-lock.yaml
  12. 2
      pnpm-workspace.yaml
  13. 24
      turbo.json

0
packages/core/.eslintrc.js → .eslintrc.js

36
.github/actions/setup-project/action.yml

@ -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
.github/workflows/quality.yml

@ -1,5 +1,4 @@
name: Core Package Tests
name: GrapesJS Qualty Checks
on:
push:
branches: [dev]
@ -7,29 +6,18 @@ on:
branches: [dev]
jobs:
quality:
quailty-checks:
runs-on: ubuntu-latest
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
.gitignore

@ -15,10 +15,11 @@ images/
private/
vendor/
coverage/
/locale/
locale/
node_modules/
bower_components/
grapesjs-*.tgz
_index.html
docs/.vuepress/dist
dist/
dist/
.turbo/

0
packages/core/.prettierignore → .prettierignore

0
packages/core/.prettierrc → .prettierrc

4
README.md

@ -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>
```

66
package.json

@ -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": {
"@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": [
"@babel/*",
"typescript",
"ts-node",
"@tsconfig/*",
"@types/*",
"jest",
"@jest/*",
"supertest",
"prettier"
]
}
},
"engines": {
"node": ">=20",
"pnpm": ">=8"
}
}

21
packages/core/package.json

@ -36,32 +36,21 @@
"backbone-undo": "0.2.6",
"codemirror": "5.63.0",
"codemirror-formatting": "1.0.0",
"html-entities": "~1.4.0",
"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",
"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"
},
@ -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"
}

2
packages/core/webpack.config.js

@ -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`,
},

17696
pnpm-lock.yaml

File diff suppressed because it is too large

2
pnpm-workspace.yaml

@ -0,0 +1,2 @@
packages:
- "packages/**"

24
turbo.json

@ -0,0 +1,24 @@
{
"$schema": "https://turborepo.org/schema.json",
"tasks": {
"lint": {
"outputs": []
},
"test": {
"dependsOn": ["build"],
"inputs": ["**/*.{ts,tsx,js,jsx}"]
},
"build": {
"dependsOn": ["^build"],
"outputs": ["build/**"]
},
"dev": {
"cache": false,
"persistent": true
},
"start": {
"cache": false,
"persistent": true
}
}
}
Loading…
Cancel
Save