Skip to content

Commit 62dbcae

Browse files
committed
feat: new vulcan.config and entry reading pattern
BREAKING CHANGE: Introduced vulcan.config.js and changing the way to read the entry point of the preset files and the application entrypoint. No longer use the "main()" function as input, but the function that is exported as default "export default foo()".
1 parent a85457e commit 62dbcae

File tree

2 files changed

+94
-2
lines changed

2 files changed

+94
-2
lines changed

README.md

+93-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,98 @@ See some examples below:
8181
vulcan dev
8282
```
8383

84+
## Vulcan.config.js
85+
86+
The `vulcan.config.js` file offers a robust configuration system for Vulcan. This file is not mandatory but acts as an override mechanism. If you define properties in this file, they will supersede the preset configurations. Properties not defined will rely on the preset.
87+
88+
Here's a detailed breakdown of the configuration properties available in `vulcan.config.js`:
89+
90+
### Entry
91+
92+
**Type:** String
93+
94+
**Description:**
95+
This represents the primary entry point for your application, where the building process begins.
96+
97+
**Note:** `Entry` will be ignored for jamstack solutions.
98+
99+
### Builder
100+
101+
**Type:** String ('esbuild' or 'webpack')
102+
103+
**Description:**
104+
Defines which build tool to use. The available options are `esbuild` and `webpack`.
105+
106+
### UseNodePolyfills
107+
108+
**Type:** Boolean
109+
110+
**Description:**
111+
Determines if Node.js polyfills should be applied. This is useful for projects that leverage Node.js specific functionalities but are targeting environments without such built-in capabilities.
112+
113+
### UseOwnWorker
114+
115+
**Type:** Boolean
116+
117+
**Description:**
118+
This flag indicates that the constructed code inserts its own worker expression, such as `addEventListener("fetch")` or similar, without the need to inject a provider.
119+
120+
### Preset
121+
122+
**Type:** Object
123+
124+
**Description:**
125+
Provides preset-specific configurations.
126+
127+
- **Name (Type: String):** Refers to the preset name, e.g., "vue" or "next".
128+
- **Mode (Type: String):** Specifies the mode for the preset, e.g., "compute" or "deliver".
129+
130+
### MemoryFS
131+
132+
**Type:** Object
133+
134+
**Description:**
135+
Configurations related to the in-memory filesystem.
136+
137+
- **InjectionDirs (Type: Array of Strings):** Directories to be injected into memory for runtime access via the fs API.
138+
139+
- **RemovePathPrefix (Type: String):** A prefix path to be removed from files before injecting into memory.
140+
141+
### Custom
142+
143+
**Type:** Object
144+
145+
**Description:**
146+
Allows you to extend the capabilities of the chosen bundler (either `webpack` or `esbuild`) with custom plugins or configurations.
147+
148+
- **Plugins (Type: Object):** Add your custom plugins for your chosen bundler here.
149+
150+
### Example Configuration
151+
152+
For a Vue-based project:
153+
154+
```javascript
155+
module.exports = {
156+
entry: 'src/index.js',
157+
builder: 'webpack',
158+
useNodePolyfills: true,
159+
useOwnWorker: false,
160+
preset: {
161+
name: 'vue',
162+
mode: 'compute',
163+
},
164+
memoryFS: {
165+
injectionDirs: ['.faststore/@generated/graphql'],
166+
removePathPrefix: '.faststore/',
167+
},
168+
custom: {
169+
plugins: {},
170+
},
171+
};
172+
```
173+
174+
**Note:** Adapting `vulcan.config.js` to your setup allows a personalized development experience, catering to the specific needs of your JavaScript applications and frameworks.
175+
84176
## Docs
85177

86178
- [Overview](docs/overview.md)
@@ -92,7 +184,7 @@ Check the [Contributing doc](CONTRIBUTING.md).
92184

93185
## Code of Conduct
94186

95-
Check the [Code of Conduct ](CODE_OF_CONDUCT.md).
187+
Check the [Code of Conduct](CODE_OF_CONDUCT.md).
96188

97189
## License
98190

docs/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ An external call to run a build.
2525

2626
Custom prebuild module that runs actions to generate entrypoint and necessary files.
2727

28-
The user is free to run any action in this step. All actions must be called in a exported `main` function.
28+
The user is free to run any action in this step. All actions must be called in a `exported default` function.
2929

3030
### Common Build
3131

0 commit comments

Comments
 (0)