@plumeria/init 19.10.0 → 19.10.2

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
@@ -62,9 +62,9 @@ the `build` script is prefixed with `plumerialint --` instead.
62
62
  plugin joins the `plugins` array. A Next config has its default export
63
63
  wrapped in `withPlumeria`.
64
64
  - `eslint.config.ts` — `plumeria.configs.recommended` plus the rules that were
65
- asked for. An existing flat config is extended rather than replaced.
65
+ asked for, and `settings.plumeria.styleProp` when the styling prop was renamed. An existing flat config is extended rather than replaced.
66
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
67
+ script, with `--style-prop` when the styling prop was renamed, and on Next.js `rimraf .next` before `dev` and before `build`, so a version change is
68
68
  not read as a compile error. A `pre` script is added only for a script the
69
69
  project actually has, and one it already wrote is left alone. Clearing the
70
70
  cache is a Next.js concern rather than a lint one, so `--no-eslint` keeps it.
package/dist/setup.d.ts CHANGED
@@ -51,7 +51,7 @@ export declare const eslintSource: (answers: Answers, typescript: boolean) => st
51
51
  export declare const eslintEntries: (answers: Answers, typescript: boolean) => string[];
52
52
  export declare const packages: (detected: Detected, answers: Answers) => string[];
53
53
  export declare const installCommand: (manager: PackageManager, names: readonly string[]) => string;
54
- export declare const buildScript: (existing: string) => string;
54
+ export declare const buildScript: (existing: string, styleProp: string) => string;
55
55
  export declare const plan: (detected: Detected, answers: Answers) => Action[];
56
56
  export declare const CLEAN_SCRIPT = "rimraf .next";
57
57
  export declare const cleanScripts: (scripts: Record<string, string>) => Record<string, string>;
package/dist/setup.js CHANGED
@@ -144,6 +144,13 @@ export default defineConfig({
144
144
  return undefined;
145
145
  };
146
146
  exports.bundlerSource = bundlerSource;
147
+ const settingsLines = (answers) => answers.styleProp === exports.DEFAULT_STYLE_PROP
148
+ ? []
149
+ : [
150
+ `settings: {`,
151
+ ` plumeria: { styleProp: '${answers.styleProp}' },`,
152
+ `},`,
153
+ ];
147
154
  const eslintSource = (answers, typescript) => {
148
155
  const rules = [(0, exports.spellingRule)(answers)].filter((rule) => rule !== undefined);
149
156
  const block = [
@@ -155,6 +162,7 @@ const eslintSource = (answers, typescript) => {
155
162
  rules.length > 0 ? ` rules: {` : undefined,
156
163
  ...rules.map((rule) => ` ${rule},`),
157
164
  rules.length > 0 ? ` },` : undefined,
165
+ ...settingsLines(answers).map((line) => ` ${line}`),
158
166
  ` },`,
159
167
  ].filter((line) => line !== undefined);
160
168
  const head = [
@@ -179,16 +187,20 @@ ${block.join('\n')}
179
187
  exports.eslintSource = eslintSource;
180
188
  const eslintEntries = (answers, typescript) => {
181
189
  const rules = [(0, exports.spellingRule)(answers)].filter((rule) => rule !== undefined);
190
+ const settings = settingsLines(answers);
182
191
  const entries = ['plumeria.configs.recommended'];
183
- if (rules.length > 0) {
192
+ if (rules.length > 0 || settings.length > 0) {
184
193
  entries.push([
185
194
  `{`,
186
195
  ` files: ['**/*.{${typescript ? 'ts,tsx' : 'js,jsx'}}'],`,
187
- ` rules: {`,
196
+ rules.length > 0 ? ` rules: {` : undefined,
188
197
  ...rules.map((rule) => ` ${rule},`),
189
- ` },`,
198
+ rules.length > 0 ? ` },` : undefined,
199
+ ...settings.map((line) => ` ${line}`),
190
200
  `}`,
191
- ].join('\n'));
201
+ ]
202
+ .filter((line) => line !== undefined)
203
+ .join('\n'));
192
204
  }
193
205
  return entries;
194
206
  };
@@ -223,7 +235,9 @@ const indentOfJson = (source) => {
223
235
  const match = /\n(\s+)"/.exec(source);
224
236
  return match ? match[1].length : 2;
225
237
  };
226
- const buildScript = (existing) => `plumerialint -- ${existing}`;
238
+ const buildScript = (existing, styleProp) => styleProp === exports.DEFAULT_STYLE_PROP
239
+ ? `plumerialint -- ${existing}`
240
+ : `plumerialint --style-prop ${styleProp} -- ${existing}`;
227
241
  exports.buildScript = buildScript;
228
242
  const plan = (detected, answers) => {
229
243
  const actions = [];
@@ -457,7 +471,7 @@ const scriptAction = (detected, answers) => {
457
471
  const existing = scripts.build;
458
472
  const guard = answers.eslint && guardsByScript(detected);
459
473
  if (guard && existing && !existing.includes('plumerialint')) {
460
- scripts.build = (0, exports.buildScript)(existing);
474
+ scripts.build = (0, exports.buildScript)(existing, answers.styleProp);
461
475
  notes.push(`build: ${scripts.build}`);
462
476
  }
463
477
  if (detected.bundler === 'next') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/init",
3
- "version": "19.10.0",
3
+ "version": "19.10.2",
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",