create-routify 1.5.0 → 1.5.1

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.
@@ -0,0 +1,66 @@
1
+ # Contributors
2
+
3
+ ## Adding your own template repo
4
+ To contribute new templates to the project, you need to create a configuration for it that matches our TemplateRepoConfig type. The configuration is added to `config.js`.
5
+
6
+ You can contribute two types of template repositories: `single` and `directory`. `single` contains one main template. `directory`, on the other hand, houses multiple templates, each in its own subdirectory.
7
+
8
+ Here are examples of TemplateRepoConfig objects for each type:
9
+
10
+ ### Single template repo
11
+ ```javascript
12
+ {
13
+ "url": "github:user/repo",
14
+ "path": "optional/path/inside/repo",
15
+ "name": "My Custom Template",
16
+ "description": "This is a custom template contributed to the project.",
17
+ "templateType": "single",
18
+ "author": "Your Name",
19
+ }
20
+ ```
21
+
22
+ ### Directory templates repo
23
+ ```javascript
24
+ {
25
+ "url": "github:user/repo",
26
+ "path": "optional/path/inside/repo",
27
+ "templateType": "directory",
28
+ "author": "Your Name",
29
+ "requireManifest": false // folders without a manifest will be skipped
30
+ }
31
+ ```
32
+
33
+ ## Template Manifest
34
+ Manifests are optional and located at `<template>/manifest.js`. They enhance the template with extra information and features.
35
+
36
+ Here's a Template manifest example
37
+ ```javascript
38
+ {
39
+ name: 'my starter template',
40
+ description: 'description of my template',
41
+ test: {
42
+ // adding tests will enable the `test` feature option
43
+ // if users enable tests, this will automatically install vitest to the project
44
+ tests: [{ page: '/', contains: 'Welcome to my starter template' }],
45
+ },
46
+ // features are selectable by the user after selecting the template
47
+ features: [
48
+ {
49
+ label: 'My Super Feature',
50
+ value: 'my-super-feature',
51
+ hint: 'This adds a super feature to the projet',
52
+ initial: true, // should the user opt in or opt out
53
+ },
54
+ ],
55
+ // runs after `npm install`, whether install is skipped or not
56
+ // options contains the options selected by the user
57
+ postInstall: async (options)=>{
58
+ // it's often easier to remove a feature than add a feature
59
+ if (!options.features.includes('my-super-feature')) {
60
+ const { rm } = await import('fs/promises');
61
+ await rm(`${options.projectDir}/src/components/superFeature.js`);
62
+ }
63
+ }
64
+ // same as postInstall, but runs before `npm install`
65
+ // preInstall: (options)=>{}
66
+ }
package/config.js ADDED
@@ -0,0 +1,43 @@
1
+ const features = {
2
+ prettier: {
3
+ label: 'prettier',
4
+ value: 'prettier',
5
+ hint: 'Add prettier config',
6
+ initial: true,
7
+ },
8
+ };
9
+
10
+ /** @type {TemplateConfig} */
11
+ export default {
12
+ versions: {
13
+ 2: {
14
+ defaultTemplate: 'v2 starter template',
15
+ templatesRepos: [
16
+ {
17
+ url: 'roxiness/routify-starter',
18
+ name: 'v2 starter template',
19
+ description: 'Routify v2 starter template',
20
+ templateType: 'single',
21
+ author: 'Roxi (official)',
22
+ includeByDefault: true,
23
+ },
24
+ ],
25
+ features: [features.prettier],
26
+ },
27
+ 3: {
28
+ defaultTemplate: 'basic-starter',
29
+ templatesRepos: [
30
+ {
31
+ url: 'roxiness/routify#next',
32
+ // url: 'local:../routify',
33
+ path: 'examples',
34
+ templateType: 'directory',
35
+ author: 'Roxi (official)',
36
+ includeByDefault: true,
37
+ requireManifest: true,
38
+ },
39
+ ],
40
+ features: [features.prettier],
41
+ },
42
+ },
43
+ };
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "create-routify",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A powerful cli for super-powering your routify development experience",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "src",
9
+ "config.js",
9
10
  "LICENSE",
10
- "README.md"
11
+ "README.md",
12
+ "CONTRIBUTORS.md"
11
13
  ],
12
14
  "bin": {
13
15
  "create-routify": "./src/bin.js"