configre 1.1.6 → 1.1.8
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
|
@@ -7,7 +7,7 @@ Welcome to Configre, the coolest way to manage your project's configuration with
|
|
|
7
7
|
- **Environment-Specific Configurations**: Automatically loads configurations based on the hostname or a custom profile passed via command line arguments.
|
|
8
8
|
- **Fallback to Defaults**: Uses a default configuration as a baseline, ensuring your application always has the necessary settings.
|
|
9
9
|
- **Easy Integration**: A simple setup process that integrates effortlessly into any project.
|
|
10
|
-
- **Support for `.
|
|
10
|
+
- **Support for `.cjs` Config Files**: Config files must use the `.cjs` extension. This allows dynamic configuration values and comments, and works the same in both CommonJS and ESM projects.
|
|
11
11
|
|
|
12
12
|
## 🌟 Getting Started
|
|
13
13
|
|
|
@@ -30,17 +30,11 @@ To get started with Configre, follow these steps:
|
|
|
30
30
|
|
|
31
31
|
Organize your configuration files within a directory (e.g., `config`). Create a default configuration file and environment-specific files as needed.
|
|
32
32
|
|
|
33
|
-
- `index.
|
|
34
|
-
- `[hostname].
|
|
35
|
-
- `[hostname].dev.
|
|
33
|
+
- `index.cjs`: Your default configuration.
|
|
34
|
+
- `[hostname].cjs`: Override configurations for specific hosts.
|
|
35
|
+
- `[hostname].dev.cjs`: Development-specific configurations.
|
|
36
36
|
|
|
37
|
-
> **Note:**
|
|
38
|
-
>
|
|
39
|
-
> ```json
|
|
40
|
-
> {
|
|
41
|
-
> "type": "commonjs"
|
|
42
|
-
> }
|
|
43
|
-
> ```
|
|
37
|
+
> **Note:** Config files must always use the `.cjs` extension. That way they work in both CommonJS and ESM projects and you can use `module.exports` in them.
|
|
44
38
|
|
|
45
39
|
3. **Use Configre in Your Project**
|
|
46
40
|
|
|
@@ -55,10 +49,10 @@ To get started with Configre, follow these steps:
|
|
|
55
49
|
|
|
56
50
|
Imagine you have the following structure in your `config` directory:
|
|
57
51
|
|
|
58
|
-
- `index.
|
|
59
|
-
- `myhostname.
|
|
52
|
+
- `index.cjs`: Contains default settings.
|
|
53
|
+
- `myhostname.cjs`: Contains overrides for the host named `myhostname`.
|
|
60
54
|
|
|
61
|
-
Your `index.
|
|
55
|
+
Your `index.cjs` might look like this:
|
|
62
56
|
|
|
63
57
|
```javascript
|
|
64
58
|
module.exports = {
|
|
@@ -73,7 +67,7 @@ module.exports = {
|
|
|
73
67
|
}
|
|
74
68
|
```
|
|
75
69
|
|
|
76
|
-
And your `myhostname.
|
|
70
|
+
And your `myhostname.cjs`:
|
|
77
71
|
|
|
78
72
|
```javascript
|
|
79
73
|
module.exports = {
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|