@pixpilot/scaffoldfy-configs 0.23.0 → 0.24.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @pixpilot/scaffoldfy-configs
2
2
 
3
+ ## 0.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - add sideEffects and platform configuration for npm packages
8
+ - add support for configuration files hosted on URLs
9
+
3
10
  ## 0.23.0
4
11
 
5
12
  ### Minor Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/scaffoldfy-configs",
3
3
  "type": "module",
4
- "version": "0.23.0",
4
+ "version": "0.24.0",
5
5
  "author": "PixPilot <m.doaie@hotmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,11 +23,11 @@
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.18.11",
25
25
  "eslint": "^9.38.0",
26
- "@internal/tsdown-config": "0.1.0",
27
- "@internal/prettier-config": "0.0.1",
26
+ "@internal/eslint-config": "0.3.0",
28
27
  "@internal/vitest-config": "0.1.0",
29
- "@pixpilot/scaffoldfy": "0.48.0",
30
- "@internal/eslint-config": "0.3.0"
28
+ "@internal/tsdown-config": "0.1.0",
29
+ "@pixpilot/scaffoldfy": "0.49.0",
30
+ "@internal/prettier-config": "0.0.1"
31
31
  },
32
32
  "prettier": "@internal/prettier-config",
33
33
  "publishConfig": {
@@ -198,6 +198,7 @@ describe('workspace-package-generator – package.json.hbs rendering', () => {
198
198
 
199
199
  expect(pkg.name).toBe('@internal/my-package');
200
200
  expect(pkg.private).toBe(true);
201
+ expect(pkg.sideEffects).toBeUndefined();
201
202
  expect(pkg.publishConfig).toBeUndefined();
202
203
  expect(pkg.files).toBeUndefined();
203
204
  expect(pkg.scripts?.['test:ui']).toBe('vitest --ui --watch');
@@ -233,6 +234,7 @@ describe('workspace-package-generator – package.json.hbs rendering', () => {
233
234
 
234
235
  expect(pkg.name).toBe('@myorg/my-package');
235
236
  expect(pkg.private).toBeUndefined();
237
+ expect(pkg.sideEffects).toBe(false);
236
238
  expect(pkg.publishConfig?.access).toBe('public');
237
239
  expect(pkg.files).toContain('dist');
238
240
  expect(pkg.scripts?.build).toBe('tsdown');
@@ -321,6 +323,26 @@ describe('workspace-package-generator – tsdown.config.ts.hbs rendering', () =>
321
323
  expect(rendered).toContain('MAX_BUNDLE_SIZE_KB = 50');
322
324
  expect(rendered).toContain('bundleSize: MAX_BUNDLE_SIZE_KB * KB');
323
325
  });
326
+
327
+ it("should add platform: 'neutral' for an npm package", () => {
328
+ const ctx = {
329
+ tsdownConfigPackage: '@pixpilot/tsdown-config',
330
+ isNpmPackage: true,
331
+ };
332
+ const rendered = renderHbs(tplPath, ctx);
333
+
334
+ expect(rendered).toContain("platform: 'neutral'");
335
+ });
336
+
337
+ it("should not add platform: 'neutral' when not an npm package", () => {
338
+ const ctx = {
339
+ tsdownConfigPackage: '@pixpilot/tsdown-config',
340
+ isNpmPackage: false,
341
+ };
342
+ const rendered = renderHbs(tplPath, ctx);
343
+
344
+ expect(rendered).not.toContain('platform');
345
+ });
324
346
  });
325
347
 
326
348
  describe('workspace-package-generator – src/index.ts.hbs rendering', () => {
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "{{#if isNpmPackage}}{{#if packageOrgName}}@{{packageOrgName}}/{{packageBaseName}}{{else}}{{packageBaseName}}{{/if}}{{else}}@internal/{{packageBaseName}}{{/if}}",
3
3
  "type": "module",
4
+ {{#if isNpmPackage}}
5
+ "sideEffects": false,
6
+ {{/if}}
4
7
  "version": "0.0.0",
5
8
  {{#unless isNpmPackage}}
6
9
  "private": true,
@@ -78,10 +81,22 @@
78
81
  "@internal/eslint-config": "workspace:*",
79
82
  "@internal/prettier-config": "workspace:*",
80
83
  "@internal/tsconfig": "workspace:*",
84
+ {{#if isNpmPackage}}
85
+ {{#if isBundlerTsdown}}
86
+ {{#if hasTsdownConfig}}
87
+ "{{tsdownConfigPackage}}": "workspace:*",
88
+ {{/if}}
89
+ {{/if}}
90
+ {{/if}}
81
91
  "@internal/vitest-config": "workspace:*",
92
+ {{#if isNpmPackage}}
93
+ {{#if isBundlerTsdown}}
94
+ {{#unless hasTsdownConfig}}
95
+ "{{tsdownConfigPackage}}": "^1.0.0",
96
+ {{/unless}}
97
+ {{/if}}
98
+ {{/if}}
82
99
  "@types/node": "catalog:dev",
83
- "@vitest/coverage-v8": "catalog:dev",
84
- "@vitest/ui": "catalog:dev",
85
100
  {{#if isReactPackage}}
86
101
  {{#if isNpmPackage}}
87
102
  "@types/react": "^19.0.0",
@@ -91,6 +106,8 @@
91
106
  "@types/react-dom": "catalog:",
92
107
  {{/if}}
93
108
  {{/if}}
109
+ "@vitest/coverage-v8": "catalog:dev",
110
+ "@vitest/ui": "catalog:dev",
94
111
  "eslint": "catalog:dev",
95
112
  {{#if isReactPackage}}
96
113
  {{#if isNpmPackage}}
@@ -103,11 +120,6 @@
103
120
  {{/if}}
104
121
  {{#if isNpmPackage}}
105
122
  {{#if isBundlerTsdown}}
106
- "{{tsdownConfigPackage}}": "{{#if hasTsdownConfig}}workspace:*{{else}}^1.0.0{{/if}}",
107
- {{/if}}
108
- {{/if}}
109
- {{#if isNpmPackage}}
110
- {{#if isBundlerTsdown}}
111
123
  "tsdown": "catalog:dev",
112
124
  {{/if}}
113
125
  {{/if}}
@@ -13,4 +13,11 @@ export default defineConfig({
13
13
  dts: true,
14
14
  minify: false,
15
15
  clean: true,
16
+ {{#if isNpmPackage}}
17
+ // Keep `process.env.NODE_ENV` intact in the output so each consumer's bundler
18
+ // (Next.js, Vite, etc.) can dead-code-eliminate dev-only guards in production.
19
+ // A `browser` platform would inline it at build time, making dev-only code run
20
+ // unconditionally in shipped bundles.
21
+ platform: 'neutral',
22
+ {{/if}}
16
23
  });