@plumeria/init 19.9.1 → 19.10.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.
package/README.md CHANGED
@@ -13,11 +13,11 @@ writes. Nothing is installed or patched before you say so.
13
13
  ```
14
14
  ✔ detected next pnpm typescript
15
15
 
16
- ➡︎ install @plumeria/core @plumeria/next-plugin @plumeria/eslint-plugin oxlint
16
+ ➡︎ install @plumeria/core @plumeria/next-plugin @plumeria/eslint-plugin rimraf
17
17
  + write plumeria.d.ts classStyle
18
18
  ~ patch next.config.ts withPlumeria(...)
19
19
  ~ patch eslint.config.ts plumeria.configs.recommended
20
- ~ patch package.json build: plumerialint -- next build
20
+ ~ patch package.json predev: rimraf .next, prebuild: rimraf .next
21
21
  ```
22
22
 
23
23
  ## What it detects
@@ -42,20 +42,17 @@ so the counterpart cannot compile, and ESLint gets
42
42
  is reported while you type. Answering "none" sets neither. `--sizes` extends
43
43
  the answer to the size axis, where `width` and `inlineSize` are the pair.
44
44
 
45
- **Expand a border shorthand into the three declarations it sets?** — turns on
46
- `@plumeria/expand-border-shorthands`. A `border` shorthand crosses the axis
47
- shorthands without either containing the other, so leaving it whole makes the
48
- outcome depend on order.
49
-
50
45
  **Which JSX prop carries styles?** — `classStyle` by default. A renamed prop is
51
46
  written into the plugin as `styleProp` and declared in `plumeria.d.ts`, so the
52
47
  two cannot disagree. It has to be an identifier TypeScript can declare, and a
53
48
  name React leaves free; `className`, `style`, `key`, `ref` and `children` are
54
49
  refused, from the prompt and from `--style-prop` alike.
55
50
 
56
- **Set up `@plumeria/eslint-plugin` and the `plumerialint` build guard?** — adds
57
- the plugin and `oxlint`, writes or extends the flat config, and prefixes the
58
- `build` script with `plumerialint --`, so a style error stops the build.
51
+ **Set up `@plumeria/eslint-plugin` for ESLint?** — adds the plugin and writes or
52
+ extends the flat config, so a style error is reported while you type. The build
53
+ lints either way: the bundler plugin runs the same rules alongside the build and
54
+ stops it on a style error. On esbuild and Bun, which the plugin cannot lint,
55
+ the `build` script is prefixed with `plumerialint --` instead.
59
56
 
60
57
  ## What it writes
61
58
 
@@ -66,8 +63,8 @@ the plugin and `oxlint`, writes or extends the flat config, and prefixes the
66
63
  wrapped in `withPlumeria`.
67
64
  - `eslint.config.ts` — `plumeria.configs.recommended` plus the rules that were
68
65
  asked for. An existing flat config is extended rather than replaced.
69
- - `package.json` — `plumerialint --` in front of the `build` script, and on
70
- Next.js `rimraf .next` before `dev` and before `build`, so a version change is
66
+ - `package.json` — on esbuild and Bun, `plumerialint --` in front of the `build`
67
+ script, and on Next.js `rimraf .next` before `dev` and before `build`, so a version change is
71
68
  not read as a compile error. A `pre` script is added only for a script the
72
69
  project actually has, and one it already wrote is left alone. Clearing the
73
70
  cache is a Next.js concern rather than a lint one, so `--no-eslint` keeps it.
@@ -94,7 +91,7 @@ npx @plumeria/init --yes # take every default, ask nothing
94
91
  npx @plumeria/init --physical --sizes # answer the spelling question up front
95
92
  npx @plumeria/init --style-prop sx
96
93
  npx @plumeria/init --bundler rollup
97
- npx @plumeria/init --no-eslint # leave ESLint and the plumerialint guard out
94
+ npx @plumeria/init --no-eslint # leave ESLint out
98
95
  npx @plumeria/init --no-install # write the configs, print the command
99
96
  npx @plumeria/init --cwd packages/app
100
97
  ```
package/dist/cli.js CHANGED
@@ -29,7 +29,7 @@ Options
29
29
  --logical this project writes logical properties
30
30
  --physical this project writes physical properties
31
31
  --sizes extend the spelling policy to the size axis
32
- --no-eslint leave ESLint and the plumerialint guard out
32
+ --no-eslint leave ESLint out
33
33
  --no-install write the configs, print the install command
34
34
  --cwd <dir> run against another directory
35
35
  -h, --help show this message
package/dist/prompt.js CHANGED
@@ -67,9 +67,6 @@ const ask = async (asker, preset) => {
67
67
  if (answers.spelling !== 'none' && preset.sizes === undefined) {
68
68
  answers.sizes = await confirm(asker, 'Reject the size axis too (width/height ↔ inlineSize/blockSize)?', false);
69
69
  }
70
- if (preset.expandBorderShorthands === undefined) {
71
- answers.expandBorderShorthands = await confirm(asker, 'Expand a border shorthand into the three declarations it sets?', true);
72
- }
73
70
  if (preset.styleProp === undefined) {
74
71
  const answer = (await asker.question(`Which JSX prop carries styles? ${style_1.style.faint(`[${setup_1.DEFAULT_STYLE_PROP}]`)} `)).trim();
75
72
  if (answer !== '') {
@@ -77,7 +74,7 @@ const ask = async (asker, preset) => {
77
74
  }
78
75
  }
79
76
  if (preset.eslint === undefined) {
80
- answers.eslint = await confirm(asker, 'Set up @plumeria/eslint-plugin and the plumerialint build guard?', true);
77
+ answers.eslint = await confirm(asker, 'Set up @plumeria/eslint-plugin for ESLint?', true);
81
78
  }
82
79
  return answers;
83
80
  };
package/dist/setup.d.ts CHANGED
@@ -4,7 +4,6 @@ export interface Answers {
4
4
  spelling: Spelling;
5
5
  sizes: boolean;
6
6
  styleProp: string;
7
- expandBorderShorthands: boolean;
8
7
  eslint: boolean;
9
8
  install: boolean;
10
9
  }
package/dist/setup.js CHANGED
@@ -23,7 +23,6 @@ exports.DEFAULT_ANSWERS = {
23
23
  spelling: 'none',
24
24
  sizes: false,
25
25
  styleProp: exports.DEFAULT_STYLE_PROP,
26
- expandBorderShorthands: true,
27
26
  eslint: true,
28
27
  install: true,
29
28
  };
@@ -146,12 +145,7 @@ export default defineConfig({
146
145
  };
147
146
  exports.bundlerSource = bundlerSource;
148
147
  const eslintSource = (answers, typescript) => {
149
- const rules = [
150
- answers.expandBorderShorthands
151
- ? `'@plumeria/expand-border-shorthands': 'warn'`
152
- : undefined,
153
- (0, exports.spellingRule)(answers),
154
- ].filter((rule) => rule !== undefined);
148
+ const rules = [(0, exports.spellingRule)(answers)].filter((rule) => rule !== undefined);
155
149
  const block = [
156
150
  ` {`,
157
151
  ` files: ['**/*.{${typescript ? 'ts,tsx' : 'js,jsx'}}'],`,
@@ -184,12 +178,7 @@ ${block.join('\n')}
184
178
  };
185
179
  exports.eslintSource = eslintSource;
186
180
  const eslintEntries = (answers, typescript) => {
187
- const rules = [
188
- answers.expandBorderShorthands
189
- ? `'@plumeria/expand-border-shorthands': 'warn'`
190
- : undefined,
191
- (0, exports.spellingRule)(answers),
192
- ].filter((rule) => rule !== undefined);
181
+ const rules = [(0, exports.spellingRule)(answers)].filter((rule) => rule !== undefined);
193
182
  const entries = ['plumeria.configs.recommended'];
194
183
  if (rules.length > 0) {
195
184
  entries.push([
@@ -204,6 +193,7 @@ const eslintEntries = (answers, typescript) => {
204
193
  return entries;
205
194
  };
206
195
  exports.eslintEntries = eslintEntries;
196
+ const guardsByScript = (detected) => detected.bundler === 'esbuild' || detected.bundler === 'bun';
207
197
  const packages = (detected, answers) => {
208
198
  const present = (0, detect_1.installed)(detected.manifest);
209
199
  const wanted = [
@@ -213,7 +203,7 @@ const packages = (detected, answers) => {
213
203
  : '@plumeria/unplugin',
214
204
  ];
215
205
  if (answers.eslint) {
216
- wanted.push('@plumeria/eslint-plugin', 'oxlint');
206
+ wanted.push('@plumeria/eslint-plugin');
217
207
  if (!detected.eslintConfig) {
218
208
  wanted.push('eslint', '@eslint/js');
219
209
  if (detected.typescript)
@@ -267,7 +257,8 @@ const plan = (detected, answers) => {
267
257
  actions.push(bundlerAction(detected, answers));
268
258
  if (answers.eslint)
269
259
  actions.push(eslintAction(detected, answers));
270
- if (answers.eslint || detected.bundler === 'next')
260
+ if ((answers.eslint && guardsByScript(detected)) ||
261
+ detected.bundler === 'next')
271
262
  actions.push(scriptAction(detected, answers));
272
263
  return actions;
273
264
  };
@@ -464,7 +455,8 @@ const scriptAction = (detected, answers) => {
464
455
  const scripts = { ...manifest.scripts };
465
456
  const notes = [];
466
457
  const existing = scripts.build;
467
- if (answers.eslint && existing && !existing.includes('plumerialint')) {
458
+ const guard = answers.eslint && guardsByScript(detected);
459
+ if (guard && existing && !existing.includes('plumerialint')) {
468
460
  scripts.build = (0, exports.buildScript)(existing);
469
461
  notes.push(`build: ${scripts.build}`);
470
462
  }
@@ -479,7 +471,7 @@ const scriptAction = (detected, answers) => {
479
471
  return {
480
472
  kind: 'skip',
481
473
  label: 'skip',
482
- note: answers.eslint && !existing
474
+ note: guard && !existing
483
475
  ? 'no build script to guard'
484
476
  : 'the scripts already carry it',
485
477
  file: 'package.json',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/init",
3
- "version": "19.9.1",
3
+ "version": "19.10.0",
4
4
  "description": "One command that sets up Plumeria: detects the bundler, installs the packages, writes the configs",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",