@pixpilot/scaffoldfy-configs 0.24.0 → 0.25.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,18 @@
1
1
  # @pixpilot/scaffoldfy-configs
2
2
 
3
+ ## 0.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - add README generation script and update README content
8
+ - add scaffoldfy configuration and README template
9
+
10
+ ## 0.24.1
11
+
12
+ ### Patch Changes
13
+
14
+ - move "sideEffects" property to correct location
15
+
3
16
  ## 0.24.0
4
17
 
5
18
  ### Minor Changes
package/README.md CHANGED
@@ -12,41 +12,129 @@ npm install @pixpilot/scaffoldfy @pixpilot/scaffoldfy-configs
12
12
 
13
13
  This package provides the following scaffoldfy templates:
14
14
 
15
+ <!-- scaffoldfy-templates:start -->
16
+
15
17
  ### license-file
16
18
 
17
- Generate a LICENSE file with common open-source licenses (MIT, Apache 2.0, GPL, BSD, etc.)
19
+ Generate a LICENSE file with common open-source licenses
18
20
 
19
- ### project-info
21
+ Usage:
22
+
23
+ ```sh
24
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/license-file/scaffoldfy.json
25
+ ```
26
+
27
+ ### monorepo-generate-packages-section
20
28
 
21
- Collect and manage project information prompts for consistent project setup
29
+ Generates packages section in monorepo README by reading package.json files
22
30
 
23
- ### turbo-workspace-package-generator
31
+ Usage:
24
32
 
25
- Generate packages for pnpm + Turbo monorepos with customizable bundler options
33
+ ```sh
34
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/monorepo-generate-packages-section/scaffoldfy.json
35
+ ```
26
36
 
27
37
  ### pixpilot-changesets-release
28
38
 
29
- Configure changesets for automated package publishing
39
+ Pixpilot workspace package generator template for pnpm + Turbo monorepo. Provides project info prompts and config tasks.
40
+
41
+ Usage:
42
+
43
+ ```sh
44
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/pixpilot-changesets-release/scaffoldfy.json
45
+ ```
30
46
 
31
47
  ### pixpilot-copilot-instructions
32
48
 
33
- Generate GitHub Copilot instructions for your project
49
+ GitHub Copilot instructions template for Pixpilot projects
50
+
51
+ Usage:
52
+
53
+ ```sh
54
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/pixpilot-copilot-instructions/scaffoldfy.json
55
+ ```
34
56
 
35
57
  ### pixpilot-info
36
58
 
37
- Project information and metadata management
59
+ Project information prompts for pnpm-turbo-monorepo-template
60
+
61
+ Usage:
62
+
63
+ ```sh
64
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/pixpilot-info/scaffoldfy.json
65
+ ```
66
+
67
+ ### project-info
68
+
69
+ Project information prompts for pnpm-turbo-monorepo-template
70
+
71
+ Usage:
72
+
73
+ ```sh
74
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/project-info/scaffoldfy.json
75
+ ```
38
76
 
39
77
  ### security-policy
40
78
 
41
- Generate security policy documentation
79
+ Security policy template with configurable contact email
42
80
 
43
- ### monorepo-generate-packages-section
81
+ Usage:
82
+
83
+ ```sh
84
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/security-policy/scaffoldfy.json
85
+ ```
86
+
87
+ ### turbo-workspace-package-generator
44
88
 
45
- Configure package generation for monorepo setups
89
+ Pixpilot workspace package generator template for pnpm + Turbo monorepo. Provides project info prompts and config tasks.
90
+
91
+ Usage:
92
+
93
+ ```sh
94
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/turbo-workspace-package-generator/scaffoldfy.json
95
+ ```
46
96
 
47
97
  ### update-root-package-json
48
98
 
49
- Update root package.json with common configurations
99
+ Update root package.json with repository information
100
+
101
+ Usage:
102
+
103
+ ```sh
104
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/update-root-package-json/scaffoldfy.json
105
+ ```
106
+
107
+ ### workspace-initializer
108
+
109
+ Initial setup for a pnpm + Turbo monorepo template, including project info, license, and initial package generation.
110
+
111
+ Usage:
112
+
113
+ ```sh
114
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/workspace-initializer/scaffoldfy.json
115
+ ```
116
+
117
+ ### workspace-package-generator
118
+
119
+ Generate a new package for a pnpm + Turbo monorepo workspace
120
+
121
+ Usage:
122
+
123
+ ```sh
124
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/workspace-package-generator/scaffoldfy.json
125
+ ```
126
+
127
+ ### workspace-package-generator/experiment
128
+
129
+ Generate a new package for a pnpm + Turbo monorepo workspace
130
+
131
+ Usage:
132
+
133
+ ```sh
134
+ npx @pixpilot/scaffoldfy --config https://unpkg.com/@pixpilot/scaffoldfy-configs/workspace-package-generator/experiment/scaffoldfy.json
135
+ ```
136
+
137
+ <!-- scaffoldfy-templates:end -->
50
138
 
51
139
  ## Usage
52
140
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/scaffoldfy-configs",
3
3
  "type": "module",
4
- "version": "0.24.0",
4
+ "version": "0.25.0",
5
5
  "author": "PixPilot <m.doaie@hotmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,17 +23,18 @@
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.18.11",
25
25
  "eslint": "^9.38.0",
26
- "@internal/eslint-config": "0.3.0",
27
26
  "@internal/vitest-config": "0.1.0",
28
- "@internal/tsdown-config": "0.1.0",
29
27
  "@pixpilot/scaffoldfy": "0.49.0",
30
- "@internal/prettier-config": "0.0.1"
28
+ "@internal/tsdown-config": "0.1.0",
29
+ "@internal/prettier-config": "0.0.1",
30
+ "@internal/eslint-config": "0.3.0"
31
31
  },
32
32
  "prettier": "@internal/prettier-config",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "scripts": {
37
+ "generate:readme": "node scripts/generate-readme.mjs",
37
38
  "test": "vitest --run --passWithNoTests",
38
39
  "test:watch": "vitest --watch",
39
40
  "test:ui": "vitest --ui",
@@ -0,0 +1,88 @@
1
+ import { readdir, readFile, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const packageDirectory = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
6
+ const readmePath = path.join(packageDirectory, 'README.md');
7
+ const packageUrl = 'https://unpkg.com/@pixpilot/scaffoldfy-configs';
8
+ const startMarker = '<!-- scaffoldfy-templates:start -->';
9
+ const endMarker = '<!-- scaffoldfy-templates:end -->';
10
+ const ignoredDirectories = new Set(['.cache', '.turbo', 'node_modules']);
11
+
12
+ async function findConfigPaths(directory) {
13
+ const entries = await readdir(directory, { withFileTypes: true });
14
+ const paths = await Promise.all(
15
+ entries.map((entry) => {
16
+ if (entry.isDirectory() && !ignoredDirectories.has(entry.name)) {
17
+ return findConfigPaths(path.join(directory, entry.name));
18
+ }
19
+ if (entry.isFile() && entry.name === 'scaffoldfy.json') {
20
+ return [path.join(directory, entry.name)];
21
+ }
22
+ return [];
23
+ }),
24
+ );
25
+
26
+ return paths.flat();
27
+ }
28
+
29
+ async function readTemplate(configPath) {
30
+ const relativeDirectory = path
31
+ .relative(packageDirectory, path.dirname(configPath))
32
+ .split(path.sep)
33
+ .join('/');
34
+ const relativeConfigPath = relativeDirectory
35
+ ? `${relativeDirectory}/scaffoldfy.json`
36
+ : 'scaffoldfy.json';
37
+ const config = JSON.parse(await readFile(configPath, 'utf8'));
38
+
39
+ if (typeof config.description !== 'string' || !config.description.trim()) {
40
+ throw new Error(`${relativeConfigPath} has no description`);
41
+ }
42
+
43
+ return {
44
+ configUrl: `${packageUrl}/${relativeConfigPath}`,
45
+ description: config.description.trim(),
46
+ name: relativeDirectory || config.name,
47
+ };
48
+ }
49
+
50
+ function compareTemplates(left, right) {
51
+ if (left.name === right.name) {
52
+ return 0;
53
+ }
54
+ return left.name < right.name ? -1 : 1;
55
+ }
56
+
57
+ async function generateReadme() {
58
+ const configPaths = await findConfigPaths(packageDirectory);
59
+ const templates = await Promise.all(configPaths.map(readTemplate));
60
+ templates.sort(compareTemplates);
61
+
62
+ const generatedSection = templates
63
+ .map(
64
+ ({ configUrl, description, name }) =>
65
+ `### ${name}\n\n${description}\n\nUsage:\n\n\`\`\`sh\nnpx @pixpilot/scaffoldfy --config ${configUrl}\n\`\`\``,
66
+ )
67
+ .join('\n\n');
68
+ const readme = await readFile(readmePath, 'utf8');
69
+ const startIndex = readme.indexOf(startMarker);
70
+ const endIndex = readme.indexOf(endMarker);
71
+
72
+ if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) {
73
+ throw new Error('README.md is missing the template section markers');
74
+ }
75
+
76
+ const before = readme.slice(0, startIndex + startMarker.length);
77
+ const after = readme.slice(endIndex);
78
+ const generatedReadme = `${before}\n\n${generatedSection}\n\n${after}`;
79
+
80
+ if (generatedReadme !== readme) {
81
+ await writeFile(readmePath, generatedReadme);
82
+ console.log(`Updated README.md with ${templates.length} templates.`);
83
+ } else {
84
+ console.log(`README.md is current (${templates.length} templates).`);
85
+ }
86
+ }
87
+
88
+ await generateReadme();
@@ -0,0 +1,107 @@
1
+ {
2
+ "$schema": "../node_modules/@pixpilot/scaffoldfy/schema/scaffoldfy.schema.json",
3
+ "extends": [
4
+ "../project-info/scaffoldfy.json",
5
+ "../pixpilot-info/scaffoldfy.json",
6
+ "../turbo-workspace-package-generator/scaffoldfy.json",
7
+ "../pixpilot-changesets-release/scaffoldfy.json",
8
+ "../license-file/scaffoldfy.json",
9
+ "../update-root-package-json/scaffoldfy.json",
10
+ "../security-policy/scaffoldfy.json",
11
+ "../pixpilot-copilot-instructions/scaffoldfy.json",
12
+ "../monorepo-generate-packages-section/scaffoldfy.json"
13
+ ],
14
+ "name": "pnpm-turbo-monorepo-template-setup",
15
+ "description": "Initial setup for a pnpm + Turbo monorepo template, including project info, license, and initial package generation.",
16
+ "prompts": [
17
+ {
18
+ "id": "keepExamplePackages",
19
+ "type": "confirm",
20
+ "message": "Keep example packages? (helpful for reference)",
21
+ "default": false
22
+ },
23
+ {
24
+ "id": "createFirstPackagePrompt",
25
+ "type": "confirm",
26
+ "message": "Create the first package now?",
27
+ "default": true
28
+ }
29
+ ],
30
+ "tasks": [
31
+ {
32
+ "id": "clean-readme",
33
+ "name": "Clean README",
34
+ "description": "Create a fresh README for the new project",
35
+ "type": "write",
36
+ "config": {
37
+ "file": "README.md",
38
+ "templateFile": "./templates/clean-readme.hbs"
39
+ }
40
+ },
41
+ {
42
+ "id": "update-contributing",
43
+ "name": "Update CONTRIBUTING.md",
44
+ "description": "Update contributing guidelines with project info",
45
+ "type": "replace-in-file",
46
+ "config": {
47
+ "file": "CONTRIBUTING.md",
48
+ "replacements": [
49
+ {
50
+ "find": "<projectName>",
51
+ "replace": "{{projectName}}"
52
+ }
53
+ ]
54
+ }
55
+ },
56
+ {
57
+ "id": "handle-example-packages",
58
+ "name": "Handle example packages",
59
+ "description": "Prompt user about keeping example packages and remove if not wanted",
60
+ "type": "delete",
61
+ "config": {
62
+ "condition": "!keepExamplePackages",
63
+ "paths": ["packages/example-package"]
64
+ }
65
+ },
66
+ {
67
+ "id": "remove-setup-script",
68
+ "name": "Remove setup script",
69
+ "description": "Remove the setup script from package.json after setup is complete",
70
+ "type": "regex-replace",
71
+ "config": {
72
+ "file": "package.json",
73
+ "pattern": "\\n\\s*\"setup\":\\s*\"npx @pixpilot/scaffoldfy --config \\./setup/scaffoldfy\\.json\",",
74
+ "flags": "",
75
+ "replacement": ""
76
+ }
77
+ },
78
+ {
79
+ "id": "delete-setup-tasks",
80
+ "name": "Delete setup tasks file",
81
+ "description": "Remove the setup-tasks.json file after setup is complete",
82
+ "type": "delete",
83
+ "config": {
84
+ "paths": ["setup"]
85
+ }
86
+ },
87
+ {
88
+ "id": "create-first-package",
89
+ "name": "Create first package",
90
+ "description": "Generate the first package in the monorepo using the package generator",
91
+ "type": "exec",
92
+ "config": {
93
+ "command": "pnpm run gen:package",
94
+ "condition": "createFirstPackagePrompt"
95
+ }
96
+ },
97
+ {
98
+ "id": "reinstall-dependencies",
99
+ "name": "Reinstall dependencies",
100
+ "description": "Reinstall dependencies after cleanup",
101
+ "type": "exec",
102
+ "config": {
103
+ "command": "pnpm install"
104
+ }
105
+ }
106
+ ]
107
+ }
@@ -0,0 +1,46 @@
1
+ # {{projectName}}
2
+
3
+ > A modern TypeScript monorepo managed with pnpm and TurboRepo.
4
+
5
+ ## 🚀 Getting Started
6
+
7
+ ### Development
8
+
9
+ Build all packages:
10
+
11
+ ```sh
12
+ pnpm build
13
+ ```
14
+
15
+ Run tests:
16
+
17
+ ```sh
18
+ pnpm test
19
+ ```
20
+
21
+ Lint and format:
22
+
23
+ ```sh
24
+ pnpm lint
25
+ pnpm format
26
+ ```
27
+
28
+ ### Create a New Package
29
+
30
+ Generate a new package in the monorepo:
31
+
32
+ ```sh
33
+ pnpm run gen:package
34
+ ```
35
+
36
+ ## 📦 Packages
37
+
38
+ <!-- List your packages here -->
39
+
40
+ ## 🚢 Releases
41
+
42
+ This project uses [Changesets](https://github.com/changesets/changesets) for version management and publishing.
43
+
44
+ ## 📄 License
45
+
46
+ [{{licenseType}}](LICENSE)
@@ -1,9 +1,6 @@
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}}
7
4
  "version": "0.0.0",
8
5
  {{#unless isNpmPackage}}
9
6
  "private": true,
@@ -22,6 +19,9 @@
22
19
  "url": "{{repoUrl}}",
23
20
  "directory": "{{repoDirectory}}"
24
21
  },
22
+ {{#if isNpmPackage}}
23
+ "sideEffects": false,
24
+ {{/if}}
25
25
  "bugs": {
26
26
  "url": "{{baseRepoUrl}}/issues"
27
27
  },