@best-shot/preset-mini 0.0.0 → 0.1.0

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.
Files changed (2) hide show
  1. package/index.mjs +15 -10
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
 
3
3
  import { getAllPages, readYAML } from './helper.mjs';
4
4
 
5
- export function apply() {
5
+ export function apply({ config: { appConfig } }) {
6
6
  return (chain) => {
7
7
  chain.module
8
8
  .rule('vue')
@@ -14,17 +14,19 @@ export function apply() {
14
14
 
15
15
  const context = chain.get('context');
16
16
 
17
- const io = readYAML('app.yaml', context);
18
- const allPages = getAllPages(io);
17
+ if (appConfig) {
18
+ const io = readYAML('app.yaml', context);
19
+ const allPages = getAllPages(io);
19
20
 
20
- chain
21
- .entry('app')
22
- .add('./app.js')
23
- .add('./app.css')
24
- .add('./app.yaml?to-url');
21
+ chain
22
+ .entry('app')
23
+ .add('./app.js')
24
+ .add('./app.css')
25
+ .add('./app.yaml?to-url');
25
26
 
26
- for (const page of allPages) {
27
- chain.entry(page).add(`./${page}.vue`);
27
+ for (const page of allPages) {
28
+ chain.entry(page).add(`./${page}.vue`);
29
+ }
28
30
  }
29
31
  };
30
32
  }
@@ -32,6 +34,9 @@ export function apply() {
32
34
  export const name = 'preset-mini';
33
35
 
34
36
  export const schema = {
37
+ appConfig: {
38
+ default: false,
39
+ },
35
40
  target: {
36
41
  default: 'es2024',
37
42
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@best-shot/preset-mini",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "A `best-shot` preset for mini program project",
5
5
  "license": "MIT",
6
6
  "author": {