@jxsuite/create 1.6.0 → 1.7.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/generate.ts CHANGED
@@ -205,7 +205,10 @@ async function populateProject(destPath: string, opts: ProjectOptions) {
205
205
  const packageJson = buildPackageJson({ adapter, description, name });
206
206
 
207
207
  const writes = [
208
- writeFile(join(destPath, NEW_PROJECT_FILE_NAME), serializeProjectFile(projectJson, null)),
208
+ writeFile(
209
+ join(destPath, NEW_PROJECT_FILE_NAME),
210
+ withExtensionsNote(serializeProjectFile(projectJson, null)),
211
+ ),
209
212
  writeFile(join(destPath, "package.json"), `${JSON.stringify(packageJson, null, " ")}\n`),
210
213
  cp(join(TEMPLATE_DIR, "gitignore"), join(destPath, ".gitignore")),
211
214
  cp(join(TEMPLATE_DIR, "layouts"), join(destPath, "layouts"), { recursive: true }),
@@ -218,6 +221,7 @@ async function populateProject(destPath: string, opts: ProjectOptions) {
218
221
  }
219
222
 
220
223
  await Promise.all(writes);
224
+ await writeEditorSupport(destPath);
221
225
 
222
226
  // The .gitignore, layouts/ and pages/ above are copies too, carrying the template's modes.
223
227
  // The overlay below would otherwise fail to `force` over a file that came across read-only.
@@ -298,6 +302,9 @@ async function scaffoldFromStarter(
298
302
  applyDesign(project, design, { starter: true });
299
303
  }
300
304
  await writeFile(projectPath, serializeProjectFile(project, starterText, projectPath));
305
+ await writeEditorSupport(destPath);
306
+ // Copied from a read-only install as the rest was, so made writable as the rest was.
307
+ await makeWritable(destPath);
301
308
 
302
309
  // Rebuild package.json so scaffolded projects get current dep ranges and scripts regardless of
303
310
  // What the in-repo starter pinned.
@@ -314,6 +321,36 @@ async function scaffoldFromStarter(
314
321
  }
315
322
  }
316
323
 
324
+ /**
325
+ * A new project file, with one comment in it saying what `extensions` is for: the line a new user
326
+ * most needs explained, and the format's main advantage shown rather than described
327
+ * (`site-architecture.md` §2.4). The canonical form has no comments, so it goes in after.
328
+ *
329
+ * @param text The project file in its canonical form.
330
+ */
331
+ function withExtensionsNote(text: string): string {
332
+ return text.replace(
333
+ /^extensions\b/m,
334
+ "// Extensions add what Jx does not do on its own. @jxsuite/parser reads pages/index.md and\n" +
335
+ "// every Markdown collection; turn others on in Studio, under Project Settings > Extensions.\n" +
336
+ "extensions",
337
+ );
338
+ }
339
+
340
+ /**
341
+ * What lets an editor and GitHub read `.jxn` from the first commit: Linguist knows KDL only as
342
+ * `.kdl`, and VS Code needs telling too. Both cost nothing, and an existing file is kept.
343
+ *
344
+ * @param destPath The project's root.
345
+ */
346
+ async function writeEditorSupport(destPath: string): Promise<void> {
347
+ await mkdir(join(destPath, ".vscode"), { recursive: true });
348
+ await Promise.all([
349
+ cp(join(TEMPLATE_DIR, "gitattributes"), join(destPath, ".gitattributes"), { force: false }),
350
+ cp(join(TEMPLATE_DIR, "vscode"), join(destPath, ".vscode"), { force: false, recursive: true }),
351
+ ]);
352
+ }
353
+
317
354
  /**
318
355
  * Apply the design quickstart (colors, fonts, breakpoints) to a project.json object, in place.
319
356
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/create",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Scaffold a new Jx project",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "test:coverage": "bun test --isolate --coverage"
38
38
  },
39
39
  "dependencies": {
40
- "@jxsuite/schema": "^5.4.0",
41
- "@jxsuite/starters": "^3.3.2"
40
+ "@jxsuite/schema": "^5.5.0",
41
+ "@jxsuite/starters": "^3.4.0"
42
42
  }
43
43
  }
@@ -0,0 +1,2 @@
1
+ # Jx Notation is KDL 2, which GitHub highlights only as .kdl
2
+ *.jxn linguist-language=KDL
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["kdl-org.kdl"]
3
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "files.associations": {
3
+ "*.jxn": "kdl"
4
+ }
5
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "parser": "^4.3.2",
3
- "compiler": "^8.4.0",
4
- "runtime": "^6.2.1",
5
- "server": "^8.5.0"
2
+ "parser": "^4.3.3",
3
+ "compiler": "^8.5.0",
4
+ "runtime": "^6.2.2",
5
+ "server": "^8.6.0"
6
6
  }