@akanjs/config 0.0.27 → 0.0.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/config",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,83 +1,73 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var webpack_backend_exports = {};
29
- __export(webpack_backend_exports, {
30
- default: () => webpack_backend_default
31
- });
32
- module.exports = __toCommonJS(webpack_backend_exports);
33
- var import_webpack = require("@nx/webpack");
34
- var import_generate_package_json_webpack_plugin = __toESM(require("generate-package-json-webpack-plugin"));
35
- var import_path = __toESM(require("path"));
36
- var import_run_script_webpack_plugin = require("run-script-webpack-plugin");
37
- var import_webpack2 = __toESM(require("webpack"));
38
- var import_webpack_node_externals = __toESM(require("webpack-node-externals"));
1
+ const { composePlugins, withNx } = require("@nx/webpack");
2
+ const GeneratePackageJsonPlugin = require("generate-package-json-webpack-plugin");
3
+ const path = require("path");
4
+ const { RunScriptWebpackPlugin } = require("run-script-webpack-plugin");
5
+ const webpack = require("webpack");
6
+ const nodeExternals = require("webpack-node-externals");
7
+
8
+ // interface WebpackConfig extends webpack.Configuration {
9
+ // module?: {
10
+ // rules?: webpack.RuleSetRule[];
11
+ // };
12
+ // plugins?: webpack.WebpackPluginInstance[];
13
+ // externals?: any[]; // Using any[] for externals as webpack types are complex and vary by version
14
+ // }
15
+
16
+ // interface PackageJson {
17
+ // [key: string]: unknown;
18
+ // name: string;
19
+ // version: string;
20
+ // main: string;
21
+ // engines: {
22
+ // node: string;
23
+ // };
24
+ // }
25
+
39
26
  const appName = process.env.NX_TASK_TARGET_PROJECT ?? "unknown";
40
- const config = (0, import_webpack.composePlugins)((0, import_webpack.withNx)(), (config2) => {
41
- const tsloaderRule = config2.module?.rules?.find((rule) => rule.loader?.includes("ts-loader"));
27
+
28
+ const config = composePlugins(withNx(), (config) => {
29
+ const tsloaderRule = config.module?.rules?.find((rule) => rule.loader?.includes("ts-loader"));
42
30
  if (tsloaderRule) {
43
31
  tsloaderRule.exclude = [
44
- /\.tsx$/,
45
- // Explicitly exclude .tsx files
46
- /\/ui\/.*\.(ts|tsx)$/,
47
- // Exclude .ts and .tsx files in any "ui" directory
48
- /\/client\/.*\.(ts|tsx)$/,
49
- // Exclude .ts and .tsx files in any "client" directory
50
- /\/next\/.*\.(ts|tsx)$/,
51
- // Exclude .ts and .tsx files in any "client" directory
52
- /\.store\.ts$/
53
- // Exclude files ending with .store.ts
32
+ /\.tsx$/, // Explicitly exclude .tsx files
33
+ /\/ui\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "ui" directory
34
+ /\/client\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "client" directory
35
+ /\/next\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "client" directory
36
+ /\.store\.ts$/, // Exclude files ending with .store.ts
54
37
  ];
55
38
  }
39
+
56
40
  const basePackage = {
57
41
  name: `${appName}/backend`,
58
42
  version: "1.0.0",
59
43
  main: "./main.js",
60
- engines: { node: ">= 18" }
44
+ engines: { node: ">= 18" },
61
45
  };
62
- config2.plugins ??= [];
63
- config2.plugins.push(new import_generate_package_json_webpack_plugin.default(basePackage));
64
- if (process.env.NX_TASK_TARGET_TARGET !== "serve-backend")
65
- return config2;
46
+
47
+ config.plugins ??= [];
48
+ config.plugins.push(new GeneratePackageJsonPlugin(basePackage));
49
+
50
+ if (process.env.NX_TASK_TARGET_TARGET !== "serve-backend") return config;
51
+
66
52
  const cwd = process.cwd();
67
- Object.assign(config2, {
68
- entry: [import_path.default.join(cwd, "node_modules/webpack/hot/poll?100"), `./main.ts`],
53
+ Object.assign(config, {
54
+ entry: [path.join(cwd, "node_modules/webpack/hot/poll?100"), `./main.ts`],
69
55
  mode: "development",
70
56
  output: {
71
- path: import_path.default.join(cwd, `dist/apps/${appName}/backend`),
72
- filename: "main.js"
73
- }
57
+ path: path.join(cwd, `dist/apps/${appName}/backend`),
58
+ filename: "main.js",
59
+ },
74
60
  });
75
- config2.plugins.push(
76
- new import_webpack2.default.HotModuleReplacementPlugin(),
77
- new import_run_script_webpack_plugin.RunScriptWebpackPlugin({ name: "main.js", autoRestart: true })
61
+
62
+ config.plugins.push(
63
+ new webpack.HotModuleReplacementPlugin(),
64
+ new RunScriptWebpackPlugin({ name: "main.js", autoRestart: true })
78
65
  );
79
- config2.externals ??= [];
80
- config2.externals.push((0, import_webpack_node_externals.default)({ allowlist: ["webpack/hot/poll?100"] }));
81
- return config2;
66
+
67
+ config.externals ??= [];
68
+ config.externals.push(nodeExternals({ allowlist: ["webpack/hot/poll?100"] }));
69
+
70
+ return config;
82
71
  });
83
- var webpack_backend_default = config;
72
+
73
+ module.exports = config;
@@ -1,54 +1,42 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var webpack_csr_exports = {};
29
- __export(webpack_csr_exports, {
30
- default: () => webpack_csr_default
31
- });
32
- module.exports = __toCommonJS(webpack_csr_exports);
33
- var import_react = require("@nx/react");
34
- var import_webpack = require("@nx/webpack");
35
- var import_path = __toESM(require("path"));
36
- var import_webpack2 = __toESM(require("webpack"));
37
- const config = (0, import_webpack.composePlugins)((0, import_webpack.withNx)({ skipTypeChecking: true }), (0, import_react.withReact)(), (config2) => {
38
- config2.resolve = {
39
- ...config2.resolve ?? {},
1
+ const { withReact } = require("@nx/react");
2
+ const { composePlugins, withNx } = require("@nx/webpack");
3
+ const path = require("path");
4
+ const webpack = require("webpack");
5
+ const { EnvironmentPlugin } = require("webpack");
6
+
7
+ // interface WebpackConfig extends webpack.Configuration {
8
+ // resolve?: {
9
+ // alias?: Record<string, string>;
10
+ // fallback?: Record<string, string | false>;
11
+ // };
12
+ // plugins?: webpack.WebpackPluginInstance[];
13
+ // }
14
+
15
+ // interface ProcessEnv {
16
+ // NX_TASK_TARGET_PROJECT?: string;
17
+ // NEXT_PUBLIC_REPO_NAME?: string;
18
+ // NEXT_PUBLIC_SERVE_DOMAIN?: string;
19
+ // NEXT_PUBLIC_APP_NAME?: string;
20
+ // NEXT_PUBLIC_ENV?: string;
21
+ // NEXT_PUBLIC_OPERATION_MODE?: string;
22
+ // APP_OPERATION_MODE?: string;
23
+ // }
24
+
25
+ const config = composePlugins(withNx({ skipTypeChecking: true }), withReact(), (config) => {
26
+ config.resolve = {
27
+ ...(config.resolve ?? {}),
40
28
  alias: {
41
- ...config2.resolve?.alias ?? {},
42
- "next/font/local": import_path.default.resolve(__dirname, "./createFont"),
43
- "next/font/google": import_path.default.resolve(__dirname, "./createFont"),
44
- "next/navigation": import_path.default.resolve(__dirname, "./router"),
45
- [`@${process.env.NX_TASK_TARGET_PROJECT}/lib`]: import_path.default.resolve(
29
+ ...(config.resolve?.alias ?? {}),
30
+ "next/font/local": path.resolve(__dirname, "./createFont"),
31
+ "next/font/google": path.resolve(__dirname, "./createFont"),
32
+ "next/navigation": path.resolve(__dirname, "./router"),
33
+ [`@${process.env.NX_TASK_TARGET_PROJECT}/lib`]: path.resolve(
46
34
  __dirname,
47
35
  `../../../${process.env.NX_TASK_TARGET_PROJECT}/lib/`
48
- )
36
+ ),
49
37
  },
50
38
  fallback: {
51
- ...config2.resolve?.fallback ?? {},
39
+ ...(config.resolve?.fallback ?? {}),
52
40
  url: require.resolve("url"),
53
41
  fs: false,
54
42
  vm: require.resolve("vm-browserify"),
@@ -57,25 +45,33 @@ const config = (0, import_webpack.composePlugins)((0, import_webpack.withNx)({ s
57
45
  http: require.resolve("stream-http"),
58
46
  https: require.resolve("https-browserify"),
59
47
  os: require.resolve("os-browserify/browser"),
60
- stream: require.resolve("stream-browserify")
61
- }
48
+ stream: require.resolve("stream-browserify"),
49
+ },
62
50
  };
63
- config2.plugins = [
64
- ...config2.plugins?.filter((plugin) => plugin.constructor.name !== "ForkTsCheckerWebpackPlugin") ?? [],
51
+
52
+ // config.output = {
53
+ // path: path.resolve(__dirname, "public"),
54
+ // filename: "[name].js",
55
+ // globalObject: "self",
56
+ // };
57
+ // config.target = "webworker";
58
+ config.plugins = [
59
+ ...(config.plugins?.filter((plugin) => plugin.constructor.name !== "ForkTsCheckerWebpackPlugin") ?? []),
65
60
  //add process plugin
66
- new import_webpack2.default.ProvidePlugin({
67
- process: "process/browser"
61
+ new webpack.ProvidePlugin({
62
+ process: "process/browser",
68
63
  }),
69
- new import_webpack2.EnvironmentPlugin({
64
+ new EnvironmentPlugin({
70
65
  NEXT_PUBLIC_REPO_NAME: process.env.NEXT_PUBLIC_REPO_NAME,
71
66
  NEXT_PUBLIC_SERVE_DOMAIN: process.env.NEXT_PUBLIC_SERVE_DOMAIN,
72
67
  NEXT_PUBLIC_APP_NAME: process.env.NEXT_PUBLIC_APP_NAME ?? process.env.NX_TASK_TARGET_PROJECT,
73
68
  NEXT_PUBLIC_ENV: process.env.NEXT_PUBLIC_ENV,
74
69
  NEXT_PUBLIC_OPERATION_MODE: process.env.NEXT_PUBLIC_OPERATION_MODE,
75
70
  APP_OPERATION_MODE: process.env.APP_OPERATION_MODE,
76
- RENDER_ENV: "csr"
77
- })
71
+ RENDER_ENV: "csr",
72
+ }),
78
73
  ];
79
- return config2;
74
+ return config;
80
75
  });
81
- var webpack_csr_default = config;
76
+
77
+ module.exports = config;
@@ -1,5 +0,0 @@
1
- import webpack from "webpack";
2
- declare const config: ((config: webpack.Configuration, ctx: import("@nx/webpack").NxWebpackExecutionContext) => Promise<webpack.Configuration>) & {
3
- nxWebpackComposablePlugin: boolean;
4
- };
5
- export default config;
@@ -1,74 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-call */
2
- import { composePlugins, withNx } from "@nx/webpack";
3
- import GeneratePackageJsonPlugin from "generate-package-json-webpack-plugin";
4
- import path from "path";
5
- import { RunScriptWebpackPlugin } from "run-script-webpack-plugin";
6
- import webpack from "webpack";
7
- import nodeExternals from "webpack-node-externals";
8
-
9
- interface WebpackConfig extends webpack.Configuration {
10
- module?: {
11
- rules?: webpack.RuleSetRule[];
12
- };
13
- plugins?: webpack.WebpackPluginInstance[];
14
- externals?: any[]; // Using any[] for externals as webpack types are complex and vary by version
15
- }
16
-
17
- interface PackageJson {
18
- [key: string]: unknown;
19
- name: string;
20
- version: string;
21
- main: string;
22
- engines: {
23
- node: string;
24
- };
25
- }
26
-
27
- const appName = process.env.NX_TASK_TARGET_PROJECT ?? "unknown";
28
-
29
- const config = composePlugins(withNx(), (config: WebpackConfig) => {
30
- const tsloaderRule = config.module?.rules?.find((rule) => rule.loader?.includes("ts-loader"));
31
- if (tsloaderRule) {
32
- tsloaderRule.exclude = [
33
- /\.tsx$/, // Explicitly exclude .tsx files
34
- /\/ui\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "ui" directory
35
- /\/client\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "client" directory
36
- /\/next\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "client" directory
37
- /\.store\.ts$/, // Exclude files ending with .store.ts
38
- ];
39
- }
40
-
41
- const basePackage: PackageJson = {
42
- name: `${appName}/backend`,
43
- version: "1.0.0",
44
- main: "./main.js",
45
- engines: { node: ">= 18" },
46
- };
47
-
48
- config.plugins ??= [];
49
- config.plugins.push(new GeneratePackageJsonPlugin(basePackage) as webpack.WebpackPluginInstance);
50
-
51
- if (process.env.NX_TASK_TARGET_TARGET !== "serve-backend") return config;
52
-
53
- const cwd = process.cwd();
54
- Object.assign(config, {
55
- entry: [path.join(cwd, "node_modules/webpack/hot/poll?100"), `./main.ts`],
56
- mode: "development" as webpack.Configuration["mode"],
57
- output: {
58
- path: path.join(cwd, `dist/apps/${appName}/backend`),
59
- filename: "main.js",
60
- },
61
- });
62
-
63
- config.plugins.push(
64
- new webpack.HotModuleReplacementPlugin(),
65
- new RunScriptWebpackPlugin({ name: "main.js", autoRestart: true })
66
- );
67
-
68
- config.externals ??= [];
69
- config.externals.push((nodeExternals as any)({ allowlist: ["webpack/hot/poll?100"] }));
70
-
71
- return config;
72
- });
73
-
74
- export default config;
@@ -1,5 +0,0 @@
1
- import webpack from "webpack";
2
- declare const config: ((config: webpack.Configuration, ctx: import("@nx/webpack").NxWebpackExecutionContext) => Promise<webpack.Configuration>) & {
3
- nxWebpackComposablePlugin: boolean;
4
- };
5
- export default config;
@@ -1,76 +0,0 @@
1
- import { withReact } from "@nx/react";
2
- import { composePlugins, withNx } from "@nx/webpack";
3
- import path from "path";
4
- import webpack, { EnvironmentPlugin } from "webpack";
5
-
6
- interface WebpackConfig extends webpack.Configuration {
7
- resolve?: {
8
- alias?: Record<string, string>;
9
- fallback?: Record<string, string | false>;
10
- };
11
- plugins?: webpack.WebpackPluginInstance[];
12
- }
13
-
14
- interface ProcessEnv {
15
- NX_TASK_TARGET_PROJECT?: string;
16
- NEXT_PUBLIC_REPO_NAME?: string;
17
- NEXT_PUBLIC_SERVE_DOMAIN?: string;
18
- NEXT_PUBLIC_APP_NAME?: string;
19
- NEXT_PUBLIC_ENV?: string;
20
- NEXT_PUBLIC_OPERATION_MODE?: string;
21
- APP_OPERATION_MODE?: string;
22
- }
23
-
24
- const config = composePlugins(withNx({ skipTypeChecking: true }), withReact(), (config: WebpackConfig) => {
25
- config.resolve = {
26
- ...(config.resolve ?? {}),
27
- alias: {
28
- ...(config.resolve?.alias ?? {}),
29
- "next/font/local": path.resolve(__dirname, "./createFont"),
30
- "next/font/google": path.resolve(__dirname, "./createFont"),
31
- "next/navigation": path.resolve(__dirname, "./router"),
32
- [`@${process.env.NX_TASK_TARGET_PROJECT}/lib`]: path.resolve(
33
- __dirname,
34
- `../../../${process.env.NX_TASK_TARGET_PROJECT}/lib/`
35
- ),
36
- },
37
- fallback: {
38
- ...(config.resolve?.fallback ?? {}),
39
- url: require.resolve("url"),
40
- fs: false,
41
- vm: require.resolve("vm-browserify"),
42
- process: require.resolve("process"),
43
- crypto: require.resolve("crypto-browserify"),
44
- http: require.resolve("stream-http"),
45
- https: require.resolve("https-browserify"),
46
- os: require.resolve("os-browserify/browser"),
47
- stream: require.resolve("stream-browserify"),
48
- },
49
- };
50
-
51
- // config.output = {
52
- // path: path.resolve(__dirname, "public"),
53
- // filename: "[name].js",
54
- // globalObject: "self",
55
- // };
56
- // config.target = "webworker";
57
- config.plugins = [
58
- ...(config.plugins?.filter((plugin) => plugin.constructor.name !== "ForkTsCheckerWebpackPlugin") ?? []),
59
- //add process plugin
60
- new webpack.ProvidePlugin({
61
- process: "process/browser",
62
- }),
63
- new EnvironmentPlugin({
64
- NEXT_PUBLIC_REPO_NAME: process.env.NEXT_PUBLIC_REPO_NAME,
65
- NEXT_PUBLIC_SERVE_DOMAIN: process.env.NEXT_PUBLIC_SERVE_DOMAIN,
66
- NEXT_PUBLIC_APP_NAME: process.env.NEXT_PUBLIC_APP_NAME ?? process.env.NX_TASK_TARGET_PROJECT,
67
- NEXT_PUBLIC_ENV: process.env.NEXT_PUBLIC_ENV,
68
- NEXT_PUBLIC_OPERATION_MODE: process.env.NEXT_PUBLIC_OPERATION_MODE,
69
- APP_OPERATION_MODE: process.env.APP_OPERATION_MODE,
70
- RENDER_ENV: "csr",
71
- }),
72
- ];
73
- return config;
74
- });
75
-
76
- export default config;