@pulse-editor/cli 0.1.1-beta.36 → 0.1.1-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import webpack from 'webpack';
2
- export declare function webpackCompile(mode: 'development' | 'production' | 'preview', buildTarget?: 'client' | 'server', isWatchMode?: boolean): Promise<void | webpack.MultiCompiler>;
1
+ import webpack from "webpack";
2
+ export declare function webpackCompile(mode: "development" | "production" | "preview", buildTarget?: "client" | "server", isWatchMode?: boolean): Promise<void | webpack.MultiCompiler>;
@@ -1,23 +1,25 @@
1
- import webpack from 'webpack';
2
- import { createWebpackConfig } from './webpack-config.js';
1
+ import webpack from "webpack";
2
+ import { generateTempTsConfig } from "./configs/utils.js";
3
+ import { createWebpackConfig } from "./webpack-config.js";
3
4
  export async function webpackCompile(mode, buildTarget, isWatchMode = false) {
4
- const configs = await createWebpackConfig(mode === 'preview', buildTarget ?? 'both', mode === 'development'
5
- ? 'development'
6
- : mode === 'preview'
7
- ? 'development'
8
- : 'production');
5
+ generateTempTsConfig();
6
+ const configs = await createWebpackConfig(mode === "preview", buildTarget ?? "both", mode === "development"
7
+ ? "development"
8
+ : mode === "preview"
9
+ ? "development"
10
+ : "production");
9
11
  const compiler = webpack(configs);
10
12
  if (isWatchMode) {
11
13
  compiler.watch({}, (err, stats) => {
12
14
  if (err) {
13
- console.error('❌ Webpack build failed', err);
15
+ console.error("❌ Webpack build failed", err);
14
16
  return;
15
17
  }
16
18
  });
17
19
  return compiler;
18
20
  }
19
21
  return new Promise((resolve, reject) => {
20
- compiler.run(err => {
22
+ compiler.run((err) => {
21
23
  if (err) {
22
24
  reject(err);
23
25
  return;
@@ -101,31 +101,6 @@ class MFServerPlugin {
101
101
  * @param compiler
102
102
  */
103
103
  async compileServerFunctions(compiler) {
104
- // Generate tsconfig for server functions
105
- function generateTempTsConfig() {
106
- const tempTsConfigPath = path.join(process.cwd(), "node_modules/.pulse/tsconfig.server.json");
107
- const tsConfig = {
108
- compilerOptions: {
109
- target: "ES2020",
110
- module: "esnext",
111
- moduleResolution: "bundler",
112
- strict: true,
113
- declaration: true,
114
- outDir: path.join(process.cwd(), "dist"),
115
- },
116
- include: [
117
- path.join(process.cwd(), "src/server-function/**/*"),
118
- path.join(process.cwd(), "pulse.config.ts"),
119
- path.join(process.cwd(), "global.d.ts"),
120
- ],
121
- exclude: [
122
- path.join(process.cwd(), "node_modules"),
123
- path.join(process.cwd(), "dist"),
124
- ],
125
- };
126
- fs.writeFileSync(tempTsConfigPath, JSON.stringify(tsConfig, null, 2));
127
- }
128
- generateTempTsConfig();
129
104
  // Run a new webpack compilation to pick up new server functions
130
105
  const options = {
131
106
  ...compiler.options,
@@ -4,3 +4,4 @@ export declare function readConfigFile(): Promise<any>;
4
4
  export declare function discoverAppSkillActions(): {
5
5
  [x: string]: string;
6
6
  } | null;
7
+ export declare function generateTempTsConfig(): void;
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { existsSync } from "fs";
2
+ import { existsSync, writeFileSync } from "fs";
3
3
  import fs from "fs/promises";
4
4
  import { globSync } from "glob";
5
5
  import { networkInterfaces } from "os";
@@ -116,3 +116,30 @@ export function discoverAppSkillActions() {
116
116
  }, {});
117
117
  return entryPoints;
118
118
  }
119
+ // Generate tsconfig for server functions
120
+ export function generateTempTsConfig() {
121
+ const tempTsConfigPath = path.join(process.cwd(), "node_modules/.pulse/tsconfig.server.json");
122
+ if (existsSync(tempTsConfigPath)) {
123
+ return;
124
+ }
125
+ const tsConfig = {
126
+ compilerOptions: {
127
+ target: "ES2020",
128
+ module: "esnext",
129
+ moduleResolution: "bundler",
130
+ strict: true,
131
+ declaration: true,
132
+ outDir: path.join(process.cwd(), "dist"),
133
+ },
134
+ include: [
135
+ path.join(process.cwd(), "src/server-function/**/*"),
136
+ path.join(process.cwd(), "pulse.config.ts"),
137
+ path.join(process.cwd(), "global.d.ts"),
138
+ ],
139
+ exclude: [
140
+ path.join(process.cwd(), "node_modules"),
141
+ path.join(process.cwd(), "dist"),
142
+ ],
143
+ };
144
+ writeFileSync(tempTsConfigPath, JSON.stringify(tsConfig, null, 2));
145
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulse-editor/cli",
3
- "version": "0.1.1-beta.36",
3
+ "version": "0.1.1-beta.37",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "pulse": "dist/cli.js"