frosty 0.0.72 → 0.0.73

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/README.md CHANGED
@@ -73,19 +73,43 @@ npx frosty run --port 3000 --configuration my.config.js app.js
73
73
 
74
74
  See `npx frosty run --help` for the full list of options.
75
75
 
76
- ### Configuration File
76
+ ### Configuration File (Optional)
77
77
 
78
- You can customize the build and server behavior by providing a `server.config.js` file in your project root. This file can export an object or a function that returns configuration options for Frosty’s CLI and build process. Common settings include specifying source/output directories, custom plugins, module rules, and server options.
78
+ Customize build and server behavior with a `server.config.js` file in your project root.
79
79
 
80
- Example `server.config.js`:
80
+ - You may export an object or a function `(env, argv) => config`.
81
+ - All fields are optional.
81
82
 
82
83
  ```js
83
84
  module.exports = {
84
- src: 'src',
85
- output: 'dist',
86
- serverEntry: 'server.js',
87
- options: {
88
- // custom webpack or build options
85
+ src: 'src', // Source directory
86
+ output: 'dist', // Output directory
87
+ serverEntry: 'server.js', // Server entry file
88
+ client: { // (Optional) Client entry points
89
+ main: {
90
+ entry: 'src/app.js', // Path to client entry file
91
+ uri: '/', // (Optional) URI path
92
+ basename: '/' // (Optional) Basename
93
+ }
94
+ },
95
+ moduleSuffixes: { // (Optional) Custom module resolution suffixes
96
+ client: ['.browser', '.web', ''],
97
+ server: ['.node', '.server', '.web', '']
98
+ },
99
+ polyfills: {}, // (Optional) Polyfill options for Babel
100
+ options: { // (Optional) Webpack and build options
101
+ resolve: {}, // Custom resolve options (e.g., alias)
102
+ externals: {}, // Webpack externals
103
+ plugins: [], // Additional Webpack plugins
104
+ module: {
105
+ rules: [] // Additional Webpack module rules
106
+ },
107
+ server: {
108
+ plugins: [], // Server-specific plugins
109
+ module: {
110
+ rules: [] // Server-specific module rules
111
+ }
112
+ }
89
113
  }
90
114
  };
91
115
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frosty",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "main": "dist/index",
5
5
  "module": "dist/index",
6
6
  "types": "dist/index",
@@ -77,7 +77,7 @@ done
77
77
  set -- "${POSITIONAL_ARGS[@]}"
78
78
 
79
79
  if [ $# -gt 0 ]; then
80
- INPUT_FILE="$1"
80
+ INPUT_FILE="$1"; shift ;
81
81
  fi
82
82
 
83
83
  CONFIG_FILE="${CONFIG_FILE:-"$PROJECT_ROOT/server.config.js"}"
@@ -101,12 +101,15 @@ if [ "$NO_BUILD" != "true" ]; then
101
101
  fi
102
102
 
103
103
  if [ "$BUILD_ONLY" != "true" ] && [ "$WATCH_MODE" = "true" ]; then
104
- until [ -f "$OUTPUT_DIR/server.js" ]; do sleep 1; done && npx nodemon --watch "$OUTPUT_DIR" "$OUTPUT_DIR/server.js" &
104
+ until [ -f "$OUTPUT_DIR/server.js" ]; do sleep 1; done && npx nodemon --watch "$OUTPUT_DIR" "$OUTPUT_DIR/server.js" $@ &
105
105
  fi
106
106
 
107
107
  if [ "$NO_BUILD" != "true" ]; then
108
108
  yarn install --cwd "$FROSTY_CLI_ROOT"
109
- BUILD_OPTS="-c "$FROSTY_CLI_ROOT/webpack.mjs" --env CONFIG_FILE="$CONFIG_FILE" --env OUTPUT_DIR="$OUTPUT_DIR""
109
+ BUILD_OPTS=""$FROSTY_CLI_ROOT/node_modules/.bin/webpack""
110
+ BUILD_OPTS="$BUILD_OPTS -c "$FROSTY_CLI_ROOT/webpack.mjs""
111
+ BUILD_OPTS="$BUILD_OPTS --env CONFIG_FILE="$CONFIG_FILE""
112
+ BUILD_OPTS="$BUILD_OPTS --env OUTPUT_DIR="$OUTPUT_DIR""
110
113
  if [ "$DEBUG_MODE" = "true" ]; then
111
114
  BUILD_OPTS="$BUILD_OPTS --mode development"
112
115
  else
@@ -116,14 +119,14 @@ if [ "$NO_BUILD" != "true" ]; then
116
119
  [ -n "$SRCROOT" ] && BUILD_OPTS="$BUILD_OPTS --env SRCROOT="$SRCROOT""
117
120
  [ -n "$PORT" ] && BUILD_OPTS="$BUILD_OPTS --env PORT="$PORT""
118
121
  if [ "$WATCH_MODE" = "true" ]; then
119
- npx webpack $BUILD_OPTS --watch &
122
+ npx -c "$BUILD_OPTS --watch" &
120
123
  else
121
- npx webpack $BUILD_OPTS
124
+ npx -c "$BUILD_OPTS --watch"
122
125
  fi
123
126
  fi
124
127
 
125
128
  if [ "$WATCH_MODE" = "true" ]; then
126
129
  wait
127
130
  elif [ ! $BUILD_ONLY ]; then
128
- node "$OUTPUT_DIR/server.js"
131
+ node "$OUTPUT_DIR/server.js" $@
129
132
  fi
@@ -82,7 +82,7 @@ export default async (env, argv) => {
82
82
  const babelLoaderConfiguration = ({ server }) => ({
83
83
  test: /\.(ts|tsx|m?js)?$/i,
84
84
  use: {
85
- loader: path.resolve(__dirname, 'node_modules/babel-loader'),
85
+ loader: 'babel-loader',
86
86
  options: {
87
87
  compact: IS_PRODUCTION,
88
88
  cacheDirectory: true,
@@ -118,9 +118,9 @@ export default async (env, argv) => {
118
118
  test: /\.(css|sass|scss)$/,
119
119
  use: [
120
120
  !server && MiniCssExtractPlugin.loader,
121
- path.resolve(__dirname, 'node_modules/css-loader'),
121
+ 'css-loader',
122
122
  {
123
- loader: path.resolve(__dirname, 'node_modules/postcss-loader'),
123
+ loader: 'postcss-loader',
124
124
  options: {
125
125
  postcssOptions: {
126
126
  plugins: [
@@ -129,14 +129,14 @@ export default async (env, argv) => {
129
129
  }
130
130
  }
131
131
  },
132
- path.resolve(__dirname, 'node_modules/sass-loader'),
132
+ 'sass-loader',
133
133
  ].filter(Boolean),
134
134
  });
135
135
 
136
136
  const imageLoaderConfiguration = ({ server }) => ({
137
137
  test: /\.(gif|jpe?g|a?png|svg)$/i,
138
138
  use: {
139
- loader: path.resolve(__dirname, 'node_modules/file-loader'),
139
+ loader: 'file-loader',
140
140
  options: {
141
141
  name: '[name].[contenthash].[ext]',
142
142
  publicPath: '/images',
@@ -149,7 +149,7 @@ export default async (env, argv) => {
149
149
  const fontLoaderConfiguration = ({ server }) => ({
150
150
  test: /\.ttf$/i,
151
151
  use: {
152
- loader: path.resolve(__dirname, 'node_modules/file-loader'),
152
+ loader: 'file-loader',
153
153
  options: {
154
154
  name: '[name].[contenthash].[ext]',
155
155
  publicPath: '/fonts',