Skip to content

Commit

Permalink
fix: nestjs external error with latest version and bump version (#1608)
Browse files Browse the repository at this point in the history
* fix: nestjs external error with latest version

* chore: add react-plugin scripts
  • Loading branch information
ErKeLost committed Jul 15, 2024
1 parent 5dc6ccb commit ad55abb
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 78 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-avocados-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-farm": patch
---

bump version
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/shared-types": "^7.4.0",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@farmfe/js-plugin-electron": "^1.0.0",
"core-js": "^3.36.1",
"electron": "^30.0.9",
Expand Down
4 changes: 2 additions & 2 deletions crates/create-farm-rs/templates/electron/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/shared-types": "^7.4.0",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@farmfe/js-plugin-electron": "^1.0.0",
"@farmfe/plugin-react": "^1.1.0",
"@farmfe/plugin-react": "^1.2.0",
"@types/react": "18",
"@types/react-dom": "18",
"core-js": "^3.36.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/shared-types": "^7.4.0",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@farmfe/js-plugin-electron": "^1.0.0",
"core-js": "^3.36.1",
"electron": "^30.0.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/shared-types": "^7.4.0",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@farmfe/js-plugin-electron": "^1.0.0",
"core-js": "^3.36.1",
"electron": "^30.0.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/shared-types": "^7.4.0",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@farmfe/js-plugin-electron": "^1.0.0",
"core-js": "^3.36.1",
"electron": "^30.0.9",
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/electron/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/shared-types": "^7.4.0",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@farmfe/js-plugin-electron": "^1.0.0",
"core-js": "^3.36.1",
"electron": "^30.0.9",
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"typescript": "^5.4.3"
}
}
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/nestjs/farm.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from '@farmfe/core';
import NestPlugin from './index.plugin.ts';
import NestPlugin from './index.plugin';

export default defineConfig({
plugins: [NestPlugin()],
Expand Down
19 changes: 11 additions & 8 deletions crates/create-farm-rs/templates/nestjs/index.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ export default function NestPlugin(): JsPlugin {
return {
name: 'NestPlugin',
config: (config) => {
const mode = config.compilation.mode ?? process.env.NODE_ENV ?? 'development';
const mode =
config.compilation.mode ?? process.env.NODE_ENV ?? 'development';
const isDev = mode === 'development';
const compilation = config.compilation ?? {}
const compilation = config.compilation ?? {};

const script = compilation.script ?? { plugins: [] };
return {
Expand All @@ -22,10 +23,11 @@ export default function NestPlugin(): JsPlugin {
tsx: script.parser?.tsConfig?.tsx ?? false,
},
},
decorators: {
decorators: {
legacyDecorator: script.decorators?.legacyDecorator ?? true,
decoratorMetadata: script.decorators?.decoratorMetadata ?? true,
decoratorVersion: script.decorators?.decoratorVersion ?? '2021-12',
decoratorVersion:
script.decorators?.decoratorVersion ?? '2021-12',
includes: [],
excludes: ['node_modules/**/*'],
},
Expand All @@ -35,11 +37,12 @@ export default function NestPlugin(): JsPlugin {
output: {
format: compilation.output?.format ?? 'esm',
targetEnv: compilation.output?.targetEnv ?? 'node',
entryFilename: compilation.output?.entryFilename ?? '[entryName].js',
entryFilename:
compilation.output?.entryFilename ?? '[entryName].js',
filename: compilation.output?.filename ?? '[name].[hash].mjs',
},
}
}
}
},
};
},
};
}
75 changes: 30 additions & 45 deletions crates/create-farm-rs/templates/nestjs/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "test-nest",
"name": "nestjs-example",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"type": "module",
"license": "UNLICENSED",
"scripts": {
"build": "nest build",
"dev": "farmup -w",
"build": "farm build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
Expand All @@ -22,50 +21,36 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@grpc/grpc-js": "^1.10.8",
"@nestjs/common": "^9.0.0",
"@nestjs/core": "^9.0.0",
"@nestjs/microservices": "^10.3.8",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/platform-socket.io": "^10.3.8",
"@nestjs/websockets": "^10.3.8",
"amqp-connection-manager": "^4.1.14",
"bufferutil": "^4.0.8",
"cache-manager": "^5.5.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"farmup": "^0.0.12",
"ioredis": "^5.4.1",
"kafkajs": "^2.2.4",
"mqtt": "^5.6.1",
"nats": "^2.26.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0",
"utf-8-validate": "^6.0.4"
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@farmfe/core": "^1.2.4",
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
"@types/express": "^4.17.13",
"@types/jest": "29.5.1",
"@types/node": "18.16.12",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "29.5.0",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.1.0",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.2.0",
"typescript": "^5.0.0"
"@farmfe/core": "^1.3.0",
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"farmup": "^0.0.12",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.3",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
},
"jest": {
"moduleFileExtensions": [
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@preact/preset-vite": "^2.8.1",
"typescript": "^5.4.3"
}
Expand Down
4 changes: 2 additions & 2 deletions crates/create-farm-rs/templates/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/plugin-react": "^1.1.0",
"@farmfe/core": "^1.3.0",
"@farmfe/plugin-react": "^1.2.0",
"@types/react": "18",
"core-js": "^3.36.1",
"@types/react-dom": "18",
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"solid-refresh": "^0.7.5",
"vite-plugin-solid": "^2.10.2"
}
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@tsconfig/svelte": "^5.0.4",
"core-js": "^3.36.1",
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/tauri/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@preact/preset-vite": "^2.5.0",
"typescript": "^5.0.2",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@tauri-apps/cli": "^1"
}
}
4 changes: 2 additions & 2 deletions crates/create-farm-rs/templates/tauri/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/plugin-react": "^1.1.0",
"@farmfe/core": "^1.3.0",
"@farmfe/plugin-react": "^1.2.0",
"typescript": "^5.0.2",
"core-js": "^3.36.1",
"react-refresh": "^0.14.0",
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/tauri/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"typescript": "^5.0.2",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"solid-refresh": "^0.7.5",
"vite-plugin-solid": "^2.8.0",
"@tauri-apps/cli": "^1"
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/tauri/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"vite": "^5.0.0",
"@tauri-apps/cli": "^1",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@tsconfig/svelte": "^5.0.4",
"core-js": "^3.36.1",
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/tauri/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"devDependencies": {
"@tauri-apps/cli": "^1",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"typescript": "^5.0.2"
}
}
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/tauri/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"vue-tsc": "^1.8.5",
"@tauri-apps/cli": "^1",
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"core-js": "^3.30.1"
}
}
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"typescript": "^5.4.3"
}
}
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@vitejs/plugin-vue2": "^2.3.1",
"core-js": "^3.30.1",
"vue-template-compiler": "~2.7.16"
Expand Down
2 changes: 1 addition & 1 deletion crates/create-farm-rs/templates/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.2",
"@farmfe/core": "^1.2.4",
"@farmfe/core": "^1.3.0",
"@vitejs/plugin-vue": "^5.0.4",
"core-js": "^3.30.1"
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"check": "biome check . --diagnostic-level=warn --apply",
"clean": "node scripts/clean.mjs && rimraf node_modules **/*/node_modules",
"bump": "node scripts/bump.mjs",
"bump:create-farm": "node scripts/bump-create-farm-version.mjs",
"test:rs:update": "cross-env FARM_UPDATE_SNAPSHOTS=1 cargo test -p farmfe_compiler",
"ready": "node scripts/ready.mjs",
"test-e2e": "vitest run -c vitest.config.e2e.ts",
Expand Down
5 changes: 4 additions & 1 deletion scripts/bump-create-farm-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import path from 'node:path';
const templatesDir = path.resolve('crates/create-farm-rs/templates');

const packageCorePath = path.resolve('packages/core/package.json');
const packageReactPluginPath = path.resolve('rust-plugins/react/package.json');
const packageCliPath = path.resolve('packages/cli/package.json');
const packageCoreJson = JSON.parse(fs.readFileSync(packageCorePath, 'utf8'));
const packageCliJson = JSON.parse(fs.readFileSync(packageCliPath, 'utf8'));
const packageReactPluginJson = JSON.parse(fs.readFileSync(packageReactPluginPath, 'utf8'));
const dependenciesToUpdate = {
"@farmfe/core": `^${packageCoreJson.version}`,
"@farmfe/cli": `^${packageCliJson.version}`
"@farmfe/cli": `^${packageCliJson.version}`,
"@farmfe/plugin-react": `^${packageReactPluginJson.version}`,
};

function updatePackageJsonDependencies(dir) {
Expand Down

0 comments on commit ad55abb

Please sign in to comment.