Skip to content

Commit

Permalink
build(node-modules-linking): fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Sep 17, 2023
1 parent 7e7be85 commit ae39a67
Show file tree
Hide file tree
Showing 12 changed files with 1,913 additions and 2,700 deletions.
43 changes: 31 additions & 12 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,40 @@ jobs:
run: pnpm run build:affected:examples

test-packages:
runs-on: buildjet-2vcpu-ubuntu-2004
if: contains(inputs.skip, 'test') == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
runs-on: buildjet-2vcpu-ubuntu-2004
if: contains(inputs.skip, 'test') == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
id: setup
uses: ./.github/actions/setup
- name: Setup
id: setup
uses: ./.github/actions/setup

- run: pnpm run install-compiler
- run: pnpm run install-compiler

- name: Run affected tests for packages
run: pnpm nx affected:test --configuration=ci --exclude='*,!tag:package,postgres,sqlite,mysql,mongo'

test-examples:
runs-on: buildjet-2vcpu-ubuntu-2004
if: contains(inputs.skip, 'test') == false
needs:
- test-packages
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
id: setup
uses: ./.github/actions/setup

- run: pnpm run install-compiler

- name: Run affected tests for packages
run: pnpm nx affected:test --configuration=ci --exclude='*,!tag:package,postgres,sqlite,mysql,mongo'
- name: Run affected tests for examples
run: pnpm run test:affected:examples

test-sqlite:
if: contains(needs.print-affected.outputs.projects, 'sqlite')
Expand Down
13 changes: 3 additions & 10 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
auto-install-peers=false
#node-linker=hoisted
ignore-workspace-root-check=true
shamefully-hoist=true
public-hoist-pattern[]=!typescript
hoist-pattern[]=*
hoist-pattern[]=!*deepkit*
public-hoist-pattern[]=!*deepkit
hoist-pattern[]=!typescript
#hoist-pattern[]=!@angular/compiler
#hoist-pattern[]=!@angular/compiler-cli
#hoist-pattern[]=!@angular-devkit/build-angular
#hoist-pattern[]=!@angular-devkit/core
#hoist-pattern[]=!@angular/core
#hoist-pattern[]=!@nx/angular
#hoist-pattern[]=!ng-packagr
public-hoist-pattern[]=!typescript
2 changes: 2 additions & 0 deletions examples/node-modules-linking/.links.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"@deepkit/rpc-tcp": "../../dist/packages/rpc-tcp",
"@deepkit/crypto": "../../dist/packages/crypto",
"@deepkit/workflow": "../../dist/packages/workflow",
"@deepkit/template": "../../dist/packages/template",
"@deepkit/nx-webpack-plugin": "../../dist/packages/nx-webpack-plugin",
"@deepkit/http": "../../dist/packages/http",
"@deepkit/event": "../../dist/packages/event",
"@deepkit/logger": "../../dist/packages/logger",
Expand Down
43 changes: 22 additions & 21 deletions examples/node-modules-linking/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
{
"name": "node-modules-linking",
"private": true,
"dependencies": {
"@deepkit/core": "1.0.1-alpha.97",
"@deepkit/core-rxjs": "1.0.1-alpha.97",
"@deepkit/bson": "1.0.1-alpha.97",
"@deepkit/type": "1.0.1-alpha.97",
"@deepkit/crypto": "1.0.1-alpha.89",
"@deepkit/workflow": "1.0.1-alpha.97",
"@deepkit/type-compiler": "1.0.1-alpha.97",
"@deepkit/sql": "1.0.1-alpha.98",
"@deepkit/injector": "1.0.1-alpha.97",
"@deepkit/rpc": "1.0.1-alpha.97",
"@deepkit/rpc-tcp": "1.0.1-alpha.97",
"@deepkit/http": "1.0.1-alpha.98",
"@deepkit/event": "1.0.1-alpha.97",
"@deepkit/logger": "1.0.1-alpha.97",
"@deepkit/framework": "1.0.1-alpha.99",
"@deepkit/app": "1.0.1-alpha.98",
"@deepkit/postgres": "1.0.1-alpha.98",
"@deepkit/stopwatch": "1.0.1-alpha.97",
"@deepkit/orm": "1.0.1-alpha.98"
"peerDependencies": {
"@deepkit/core": "*",
"@deepkit/core-rxjs": "*",
"@deepkit/bson": "*",
"@deepkit/type": "*",
"@deepkit/crypto": "*",
"@deepkit/workflow": "*",
"@deepkit/type-compiler": "*",
"@deepkit/sql": "*",
"@deepkit/injector": "*",
"@deepkit/rpc": "*",
"@deepkit/rpc-tcp": "*",
"@deepkit/http": "*",
"@deepkit/template": "*",
"@deepkit/event": "*",
"@deepkit/logger": "*",
"@deepkit/framework": "*",
"@deepkit/app": "*",
"@deepkit/postgres": "*",
"@deepkit/stopwatch": "*",
"@deepkit/orm": "*",
"@oclif/errors": ""
},
"devDependencies": {
"@deepkit-modules/nx-webpack-plugin": "0.1.0",
"npm-local-development": "0.4.0"
}
}
49 changes: 41 additions & 8 deletions examples/node-modules-linking/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,43 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "examples/node-modules-linking/src",
"projectType": "application",
"implicitDependencies": ["framework"],
"targets": {
"link": {
"executor": "nx:run-commands",
"inputs": [
"{projectRoot}/.links.json"
],
"dependsOn": [
{
"projects": [
"framework"
],
"target": "build"
}
],
"options": {
"command": "npm-local-development . --no-watcher",
"cwd": "examples/node-modules-linking"
},
"configurations": {
"serve": {
"watch": {
"command": "npm-local-development .",
"cwd": "examples/node-modules-linking"
}
}
},
"build": {
"executor": "@nx/webpack:webpack",
"dependsOn": ["link"],
"outputs": ["{options.outputPath}"],
"dependsOn": [
"link",
{
"projects": ["nx-webpack-plugin"],
"target": "build"
}
],
"outputs": [
"{options.outputPath}"
],
"defaultConfiguration": "production",
"options": {
"target": "node",
Expand All @@ -40,6 +58,13 @@
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"dependsOn": [
"link",
{
"projects": ["nx-webpack-plugin"],
"target": "build"
}
],
"options": {
"buildTarget": "node-modules-linking:build"
},
Expand All @@ -54,15 +79,23 @@
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": ["examples/node-modules-linking/**/*.ts"]
"lintFilePatterns": [
"examples/node-modules-linking/**/*.ts"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"dependsOn": ["link"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"dependsOn": [
"link"
],
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"options": {
"jestConfig": "examples/node-modules-linking/jest.config.ts",
"passWithNoTests": true
Expand Down
2 changes: 1 addition & 1 deletion examples/node-modules-linking/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TestController } from './test.controller';

void new App({
imports: [
new FrameworkModule({ port: 8082 }),
new FrameworkModule({ port: 8080 }),
],
controllers: [TestController]
})
Expand Down
32 changes: 25 additions & 7 deletions examples/node-modules-linking/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"esModuleInterop": true,
"strictFunctionTypes": true,
"noImplicitReturns": true,
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"strict": true,
"emitDecoratorMetadata": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"useDefineForClassFields": false,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true,
"target": "es2022",
"noImplicitAny": false,
"module": "esnext",
"lib": ["esnext", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true
},
"files": [],
"include": [],
"references": [
Expand All @@ -9,10 +32,5 @@
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"esModuleInterop": true,
"strictFunctionTypes": true,
"noImplicitReturns": true
}
]
}
2 changes: 1 addition & 1 deletion examples/node-modules-linking/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { composePlugins, withNx } from '@nx/webpack';
import { withDeepkit } from '@deepkit-modules/nx-webpack-plugin';
import { withDeepkit } from '../../dist/packages/nx-webpack-plugin';

export default composePlugins(withNx(), withDeepkit());
35 changes: 26 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
"private": true,
"scripts": {
"test": "nx run-many -t=test",
"test:coverage": "npm run test --coverage",
"test:coverage": "nx run-many -t=test --coverage",
"test:affected": "nx affected:test",
"test:packages": "nx run-many -t=test --exclude='*,!tag:package'",
"test:affected:packages": "nx affected:test --exclude='*,!tag:package'",
"test:examples": "nx run-many -t=test --exclude='*,!tag:example'",
"test:affected:examples": "nx affected:test --exclude='*,!tag:example'",
"clean": "rm -rf .angular && rm -rf dist",
"build": "nx run-many -t=build",
"build:dev": "NODE_ENV=development npm run build:dev",
"build:affected": "nx affected:build",
"build:affected:packages": "nx affected:build --exclude='*,!tag:package'",
"build:packages": "nx run-many -t=build --exclude='*,!tag:package'",
"build:affected:examples": "nx affected:build --exclude='*,!tag:example'",
"build:examples": "nx run-many -t=build --exclude='*,!tag:example'",
"lint": "nx run-many -t=lint",
"lint:affected": "nx affected:lint",
"install-compiler": "node ./scripts/install-compiler.mjs",
Expand All @@ -19,14 +27,15 @@
"postinstall": "if [ \\\"$CI\\\" != \\\"true\\\" ]; then npm run install-compiler; fi"
},
"devDependencies": {
"@angular-devkit/build-angular": "16.2.1",
"@angular-devkit/core": "16.2.1",
"@angular-devkit/build-angular": "16.2.2",
"@angular-devkit/core": "16.2.2",
"@angular-devkit/schematics": "16.2.1",
"@angular-eslint/eslint-plugin": "16.1.2",
"@angular-eslint/eslint-plugin-template": "16.1.2",
"@angular-eslint/template-parser": "16.1.2",
"@angular/cli": "16.2.1",
"@angular/language-service": "16.2.4",
"@angular/cli": "16.2.2",
"@angular/language-service": "16.2.5",
"@babel/core": "^7.22.19",
"@jest/globals": "^29.2.1",
"@nx/angular": "^16.8.1",
"@nx/devkit": "16.8.1",
Expand All @@ -46,9 +55,11 @@
"@types/estree": "^0.0.45",
"@types/file-saver": "^2.0.2",
"@types/format-util": "^1.0.1",
"@types/fs-extra": "11.0.2",
"@types/hammerjs": "^2.0.41",
"@types/jest": "^29.4.0",
"@types/lz-string": "^1.3.34",
"@types/marked": "^5.0.1",
"@types/micromatch": "^4.0.2",
"@types/mongodb": "3.5.25",
"@types/node": "18.11.10",
Expand Down Expand Up @@ -134,7 +145,7 @@
"file-type": "16.5.4",
"format-util": "^1.0.5",
"formidable": "^2.0.1",
"fs-extra": "^9.0.1",
"fs-extra": "11.1.1",
"get-parameter-names": "^0.3.0",
"get-tsconfig": "^4.5.0",
"globby": "^11.1.0",
Expand Down Expand Up @@ -169,24 +180,30 @@
"sift": "^7.0.1",
"sqlstring": "^2.3.2",
"sqlstring-sqlite": "^0.1.1",
"stream": "^0.0.2",
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.1",
"to-fast-properties": "^3.0.1",
"ts-loader": "9.4.4",
"tslib": "^2.6.2",
"uuid": "^9.0.0",
"vite": "4.0.0-alpha.0",
"vite": "4.4.9",
"webpack": "5.88.2",
"widest-line": "^3.1.0",
"wrap-ansi": "^6.2.0",
"ws": "^8.6.0",
"zone.js": "~0.12.0"
"zone.js": "0.13.3"
},
"resolutions": {
"typescript": "5.2.2"
},
"engines": {
"node": ">= 16.0.0"
},
"pnpm": {
"patchedDependencies": {
"npm-local-development@0.4.0": "patches/npm-local-development@0.4.0.patch"
}
}
}
16 changes: 16 additions & 0 deletions patches/npm-local-development@0.4.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/dist/index.js b/dist/index.js
index 1e82e2f1a42cc57075549bbd0606131423d4d8cd..dd957806571b00667e35b10a3cb022f7f2379971 100755
--- a/dist/index.js
+++ b/dist/index.js
@@ -240,8 +240,9 @@ function config(cwd, watching, foundPackageFolders, linkedPackages) {
for (const packageFolder of foundPackageFolders) {
const pkgConfig = fs.readJSONSync(path_1.join(packageFolder, 'package.json'));
const dependencies = pkgConfig['dependencies'] || {};
- const devDependencies = pkgConfig['devDependencies'] || {};
- const allDependencies = Object.assign(Object.assign({}, dependencies), devDependencies);
+ const peerDependencies = pkgConfig['peerDependencies'] || {};
+ const devDependencies = pkgConfig['devDependencies'] || {};
+ const allDependencies = { ...dependencies, ...peerDependencies, ...devDependencies };
for (const packageName in syncConfig) {
if (allDependencies[packageName]) {
promises.push(sync(packageFolder, packageName, syncConfig[packageName], watching));
Loading

0 comments on commit ae39a67

Please sign in to comment.