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

feat: migrate to nx workspace #1483

Draft
wants to merge 21 commits into
base: dev
Choose a base branch
from
Draft
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
Next Next commit
feat: add nx workspace settings
  • Loading branch information
JosefBredereck committed Feb 6, 2023
commit 5bbee082c4e0d2d8187fbd487827090baf010fbe
40 changes: 37 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,50 @@
node_modules/
pattern_exports/
.DS_Store
Thumbs.db
.nyc_output/
.idea/
.env
packages/core/test/public
packages/*/public
!packages/core/test/patterns/public/.gitkeep
!packages/core/test/patterns/testDependencyGraph.json
lerna-debug.log
packages/edition-node-gulp/dependencyGraph.json
packages/uikit-workshop/dist
.yarn

yarn-error.log

# compiled output
dist
tmp
/out-tsc

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

# System Files
.DS_Store
Thumbs.db

# 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
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
**/*.json
**/README.md
**/node_modules/
**/bower_components/
Expand All @@ -9,9 +8,10 @@ packages/core/scripts/api.handlebars
packages/core/scripts/events.handlebars
packages/core/test/files/annotations.js
packages/**/annotations.js
*.json
*.md
**/reset.scss
**/_meta/_head.*
**/_meta/_foot.*
**/development-edition*/source/_patterns/**
/dist
/coverage
7 changes: 6 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"singleQuote": true,
"endOfLine": "auto"
"endOfLine": "auto",
"trailingComma": "all",
"printWidth": 112,
"arrowParens": "always",
"useTabs": false,
"tabWidth": 2
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["editorconfig.editorconfig", "henrynguyen5-vsc.vsc-nvm"]
"recommendations": ["editorconfig.editorconfig", "henrynguyen5-vsc.vsc-nvm", "firsttris.vscode-jest-runner"]
}
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nrwl/jest';

export default {
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default;

module.exports = { ...nxPreset };
28 changes: 13 additions & 15 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
"lerna": "4.0.0",
"version": "6.0.1",
"packages": [
"packages/*"
"packages/cli",
"packages/core",
"packages/docs",
"packages/live-server",
"packages/plugin-tab",
"packages/starterkit-handlebars",
"packages/starterkit-twig-demo",
"packages/uikit-polyfills",
"packages/uikit-workshop",
"dist/packages/*"
],
"command": {
"init": {
"exact": true
},
"publish": {
"allowBranch": [
"master",
"dev"
],
"allowBranch": ["master", "dev"],
"conventionalCommits": true,
"gitReset": true,
"includeMergedTags": true,
Expand All @@ -23,16 +29,8 @@
"includeMergedTags": true
}
},
"ignoreChanges": [
"**/__fixtures__/**",
"**/__tests__/**",
"**/*.md",
"**/__snapshots__/**"
],
"ignoreChanges": ["**/__fixtures__/**", "**/__tests__/**", "**/*.md", "**/__snapshots__/**"],
"npmClient": "yarn",
"npmClientArgs": [
"--ignore-optional",
"--registry=https://registry.npmjs.org/"
],
"npmClientArgs": ["--ignore-optional", "--registry=https://registry.npmjs.org/"],
"useWorkspaces": true
}
43 changes: 43 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "pattern-lab",
"useDaemonProcess": false,
"affected": {
"defaultBase": "main"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s"
],
"sharedGlobals": []
},
"workspaceLayout": {
"appsDir": "packages",
"libsDir": "packages"
}
}
80 changes: 62 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
{
"workspaces": {
"packages": [
"packages/*"
"packages/cli",
"packages/core",
"packages/docs",
"packages/live-server",
"packages/plugin-tab",
"packages/starterkit-handlebars",
"packages/starterkit-twig-demo",
"packages/uikit-polyfills",
"packages/uikit-workshop",
"dist/packages/*"
],
"nohoist": [
"@pattern-lab/engine-*",
"**/@pattern-lab/engine-*",
"**/@pattern-lab/uikit-workshop"
]
},
"dependencies": {
"@auto-it/released": "^10.27.0",
"@babel/plugin-proposal-decorators": "^7.13.5",
"@babel/plugin-syntax-jsx": "^7.12.13",
"auto": "^10.27.0",
"babel-eslint": "^10.0.2",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-prettier": "^3.1.0",
"lerna": "4.0.0",
"prettier": "^2.8.1",
"pretty-quick": "^3.1.3"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pattern-lab/patternlab-node.git"
Expand All @@ -40,7 +36,58 @@
"postpublish": "auto release",
"preview:docs": "cd packages/docs && yarn production",
"preview:hbs": "cd packages/development-edition-engine-handlebars && yarn pl:starterkit && yarn pl:build",
"prepare": "husky install"
"prepare": "husky install",
"build:engine": "nx run engine-handlebars:build",
"build:all": "nx run-many --target=build"
},
"devDependencies": {
"@auto-it/all-contributors": "10.38.5",
"@auto-it/conventional-commits": "10.38.5",
"@auto-it/first-time-contributor": "10.38.5",
"@auto-it/released": "^10.27.0",
"@babel/plugin-proposal-decorators": "^7.13.5",
"@babel/plugin-syntax-jsx": "^7.12.13",
"@basalt/twig-renderer": "^2.1.0",
"@jscutlery/semver": "^2.29.3",
"@nrwl/eslint-plugin-nx": "15.6.3",
"@nrwl/jest": "15.6.3",
"@nrwl/js": "15.6.3",
"@nrwl/linter": "15.6.3",
"@nrwl/workspace": "15.6.3",
"@types/fs-extra": "^11.0.1",
"@types/glob": "^8.0.1",
"@types/jest": "28.1.1",
"@types/mustache": "^4.2.2",
"@types/node": "18.11.18",
"@types/nunjucks": "^3.2.1",
"@types/underscore": "^1.11.4",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"auto": "^10.27.0",
"babel-eslint": "^10.0.2",
"eslint": "~8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-prettier": "^3.1.0",
"fs-extra": "^11.1.0",
"glob": "^8.1.0",
"gulp": "^4.0.2",
"handlebars": "4.7.7",
"husky": "^8.0.2",
"jest": "28.1.1",
"jest-environment-jsdom": "28.1.1",
"lerna": "4.0.0",
"liquidjs": "10.4.0",
"mustache": "4.2.0",
"nunjucks": "3.2.3",
"nx": "15.6.3",
"prettier": "^2.8.1",
"pretty-quick": "^3.1.3",
"ts-jest": "28.0.5",
"ts-node": "10.9.1",
"tslib": "^2.3.0",
"twing": "^5.1.2",
"typescript": "~4.8.2",
"underscore": "^1.13.6"
},
"nyc": {
"exclude": [
Expand All @@ -49,8 +96,5 @@
"packages/core/test",
"packages/live-server"
]
},
"devDependencies": {
"husky": "^8.0.2"
}
}
18 changes: 18 additions & 0 deletions packages/cli/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
3 changes: 0 additions & 3 deletions packages/core/.eslintrc.js

This file was deleted.

18 changes: 18 additions & 0 deletions packages/core/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
2 changes: 0 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"version": "6.0.1",
"main": "./src/index.js",
"dependencies": {
"@pattern-lab/engine-handlebars": "^6.0.0",
"@pattern-lab/engine-mustache": "^6.0.0",
"@pattern-lab/live-server": "^6.0.0",
"chalk": "4.1.0",
"chokidar": "3.5.1",
Expand Down
18 changes: 18 additions & 0 deletions packages/create/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
1 change: 0 additions & 1 deletion packages/create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"bin": "index.js",
"main": "index.js",
"scripts": {},
"dependencies": {
"@pattern-lab/cli": "^6.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/development-edition-engine-handlebars/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Thumbs.db
.idea/
public
dependencyGraph.json
source/*
source
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"comments": []
"comments": [
{
"el": ".c-header",
"title": "Masthead",
"comment": "The main header of the site doesn't take up too much screen real estate in order to keep the focus on the core content."
},
{
"el": ".c-logo",
"title": "Logo",
"comment": "The logo isn't an image but regular text, which ensures that the logo displays crisply even on high resolution displays."
}
]
}
Loading