@pixpilot/scaffoldfy-configs 0.31.0 → 0.32.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,11 @@
1
1
  # @pixpilot/scaffoldfy-configs
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - support JSONC template files
8
+
3
9
  ## 0.31.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -104,6 +104,16 @@ Usage:
104
104
  npx @pixpilot/scaffoldfy@latest --config https://unpkg.com/@pixpilot/scaffoldfy-configs@latest/update-root-package-json/scaffoldfy.json
105
105
  ```
106
106
 
107
+ ### workspace-generator
108
+
109
+ Generate workspace with apps and packages
110
+
111
+ Usage:
112
+
113
+ ```sh
114
+ npx @pixpilot/scaffoldfy@latest --config https://unpkg.com/@pixpilot/scaffoldfy-configs@latest/workspace-generator/scaffoldfy.jsonc
115
+ ```
116
+
107
117
  ### workspace-initializer
108
118
 
109
119
  Initial setup for a pnpm + Turbo monorepo template, including project info, license, and initial package generation.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/scaffoldfy-configs",
3
3
  "type": "module",
4
- "version": "0.31.0",
4
+ "version": "0.32.0",
5
5
  "author": "PixPilot <m.doaie@hotmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -20,14 +20,17 @@
20
20
  "files": [
21
21
  "*"
22
22
  ],
23
+ "dependencies": {
24
+ "jsonc-parser": "^3.3.1"
25
+ },
23
26
  "devDependencies": {
24
27
  "@types/node": "^22.18.11",
25
28
  "eslint": "^9.38.0",
26
29
  "@internal/eslint-config": "0.3.0",
27
- "@internal/prettier-config": "0.0.1",
28
- "@internal/vitest-config": "0.1.0",
29
30
  "@internal/tsdown-config": "0.1.0",
30
- "@pixpilot/scaffoldfy": "0.51.0"
31
+ "@internal/vitest-config": "0.1.0",
32
+ "@pixpilot/scaffoldfy": "0.52.0",
33
+ "@internal/prettier-config": "0.0.1"
31
34
  },
32
35
  "prettier": "@internal/prettier-config",
33
36
  "publishConfig": {
@@ -1,6 +1,7 @@
1
1
  import { readdir, readFile, writeFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
+ import { parse, printParseErrorCode } from 'jsonc-parser';
4
5
 
5
6
  const packageDirectory = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
6
7
  const readmePath = path.join(packageDirectory, 'README.md');
@@ -16,7 +17,10 @@ async function findConfigPaths(directory) {
16
17
  if (entry.isDirectory() && !ignoredDirectories.has(entry.name)) {
17
18
  return findConfigPaths(path.join(directory, entry.name));
18
19
  }
19
- if (entry.isFile() && entry.name === 'scaffoldfy.json') {
20
+ if (
21
+ entry.isFile() &&
22
+ (entry.name === 'scaffoldfy.json' || entry.name === 'scaffoldfy.jsonc')
23
+ ) {
20
24
  return [path.join(directory, entry.name)];
21
25
  }
22
26
  return [];
@@ -31,10 +35,21 @@ async function readTemplate(configPath) {
31
35
  .relative(packageDirectory, path.dirname(configPath))
32
36
  .split(path.sep)
33
37
  .join('/');
34
- const relativeConfigPath = relativeDirectory
35
- ? `${relativeDirectory}/scaffoldfy.json`
36
- : 'scaffoldfy.json';
37
- const config = JSON.parse(await readFile(configPath, 'utf8'));
38
+ const relativeConfigPath = path
39
+ .relative(packageDirectory, configPath)
40
+ .split(path.sep)
41
+ .join('/');
42
+ const errors = [];
43
+ const config = parse(await readFile(configPath, 'utf8'), errors, {
44
+ allowTrailingComma: true,
45
+ });
46
+
47
+ if (errors.length > 0) {
48
+ const details = errors
49
+ .map((error) => `${printParseErrorCode(error.error)} at offset ${error.offset}`)
50
+ .join(', ');
51
+ throw new Error(`${relativeConfigPath} is not valid JSON or JSONC: ${details}`);
52
+ }
38
53
 
39
54
  if (typeof config.description !== 'string' || !config.description.trim()) {
40
55
  throw new Error(`${relativeConfigPath} has no description`);
@@ -26,25 +26,25 @@
26
26
  "value": "expo"
27
27
  }
28
28
  ]
29
- },
30
- {
31
- "id": "nextjsVisualTest",
32
- "type": "input",
33
- "message": "Next.js visual-test value:",
34
- "enabled": {
35
- "type": "condition",
36
- "value": "workspaceApps.includes('nextjs')"
37
- }
38
- },
39
- {
40
- "id": "expoVisualTest",
41
- "type": "input",
42
- "message": "Expo visual-test value:",
43
- "enabled": {
44
- "type": "condition",
45
- "value": "workspaceApps.includes('expo')"
46
- }
47
29
  }
30
+ // {
31
+ // "id": "nextjsVisualTest",
32
+ // "type": "input",
33
+ // "message": "Next.js visual-test value:",
34
+ // "enabled": {
35
+ // "type": "condition",
36
+ // "value": "workspaceApps.includes('nextjs')"
37
+ // }
38
+ // },
39
+ // {
40
+ // "id": "expoVisualTest",
41
+ // "type": "input",
42
+ // "message": "Expo visual-test value:",
43
+ // "enabled": {
44
+ // "type": "condition",
45
+ // "value": "workspaceApps.includes('expo')"
46
+ // }
47
+ // }
48
48
  ],
49
49
  "tasks": [
50
50
  {
@@ -53,7 +53,7 @@
53
53
  "description": "Clone the monorepo template",
54
54
  "type": "exec",
55
55
  "config": {
56
- "command": "git clone https://github.com/pixpilot/pnpm-turbo-monorepo-template.git"
56
+ "command": "git clone https://github.com/pixpilot/pnpm-turbo-monorepo-template.git ."
57
57
  }
58
58
  }
59
59
  ]