create-routify 1.5.0 → 1.5.2
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/CONTRIBUTORS.md +66 -0
- package/config.js +43 -0
- package/package.json +4 -2
- package/src/utils/patcher/test/index.js +3 -0
- package/src/versions/three/skeleton/index.html +0 -31
- package/src/versions/three/skeleton/package.json +0 -16
- package/src/versions/three/skeleton/src/App.svelte +0 -6
- package/src/versions/three/skeleton/src/main.js +0 -5
- package/src/versions/three/skeleton/src/routes/index.md +0 -1
- package/src/versions/three/skeleton/vite.config.js +0 -24
- package/src/versions/two.js +0 -18
- package/src/versions404/three/index.js +0 -29
- package/src/versions404/three/utils.js +0 -24
- package/src/versions404/two.js +0 -18
package/CONTRIBUTORS.md
ADDED
|
@@ -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.
|
|
3
|
+
"version": "1.5.2",
|
|
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"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
|
|
7
|
-
<title>Svelte app</title>
|
|
8
|
-
|
|
9
|
-
<!-- Google Fonts -->
|
|
10
|
-
<link
|
|
11
|
-
rel="stylesheet"
|
|
12
|
-
href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
<!-- CSS Reset -->
|
|
16
|
-
<link
|
|
17
|
-
rel="stylesheet"
|
|
18
|
-
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css"
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<!-- Milligram CSS -->
|
|
22
|
-
<link
|
|
23
|
-
rel="stylesheet"
|
|
24
|
-
href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.4.1/milligram.css"
|
|
25
|
-
/>
|
|
26
|
-
|
|
27
|
-
<script type="module" src="/src/main.js"></script>
|
|
28
|
-
</head>
|
|
29
|
-
|
|
30
|
-
<body></body>
|
|
31
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "starter",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"build": "vite build",
|
|
6
|
-
"preview": "vite preview",
|
|
7
|
-
"dev": "vite"
|
|
8
|
-
},
|
|
9
|
-
"devDependencies": {
|
|
10
|
-
"@roxi/routify": "^3.0.0-next.1",
|
|
11
|
-
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.13",
|
|
12
|
-
"mdsvex": "^0.9.3",
|
|
13
|
-
"svelte": "^3.39.0",
|
|
14
|
-
"vite": "^2.2.3"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Routify 3 App
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
|
2
|
-
import routify from '@roxi/routify/vite-plugin'
|
|
3
|
-
import { defineConfig } from 'vite'
|
|
4
|
-
import { mdsvex } from 'mdsvex'
|
|
5
|
-
|
|
6
|
-
const production = process.env.NODE_ENV === 'production'
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
clearScreen: false,
|
|
10
|
-
|
|
11
|
-
plugins: [
|
|
12
|
-
routify(),
|
|
13
|
-
svelte({
|
|
14
|
-
emitCss: true,
|
|
15
|
-
compilerOptions: {
|
|
16
|
-
dev: !production,
|
|
17
|
-
},
|
|
18
|
-
extensions: ['.md', '.svelte'],
|
|
19
|
-
preprocess: [mdsvex({ extension: 'md' })],
|
|
20
|
-
}),
|
|
21
|
-
],
|
|
22
|
-
|
|
23
|
-
server: { port: 1337 },
|
|
24
|
-
})
|
package/src/versions/two.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import logSymbols from 'log-symbols';
|
|
2
|
-
import simpleGit from 'simple-git';
|
|
3
|
-
import { rmSync } from 'fs';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import k from 'kleur';
|
|
6
|
-
|
|
7
|
-
export const run = async ({ projectDir, args }) => {
|
|
8
|
-
const git = simpleGit(projectDir);
|
|
9
|
-
|
|
10
|
-
console.log(k.blue(`\n${logSymbols.info} Cloning template...`));
|
|
11
|
-
|
|
12
|
-
await git.clone('https://github.com/roxiness/routify-starter', projectDir);
|
|
13
|
-
|
|
14
|
-
rmSync(join(projectDir, '.git'), {
|
|
15
|
-
recursive: true,
|
|
16
|
-
force: true,
|
|
17
|
-
});
|
|
18
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { getTemplate, onCancel } from '../../utils/prompts.js';
|
|
2
|
-
import { readdir, cp, rm } from 'fs/promises';
|
|
3
|
-
import { join, dirname } from 'path';
|
|
4
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
|
-
import prompts from 'prompts';
|
|
6
|
-
import k from 'kleur';
|
|
7
|
-
import { getRoutifyExamplesDir, routifyIntro } from './utils.js';
|
|
8
|
-
import { existsSync } from 'fs';
|
|
9
|
-
import { addTests } from '../../utils/patcher/test/index.js';
|
|
10
|
-
|
|
11
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
|
|
13
|
-
export const run = async (options) => {
|
|
14
|
-
const { dir, force, version, starter } = options;
|
|
15
|
-
console.log('options', options);
|
|
16
|
-
routifyIntro();
|
|
17
|
-
|
|
18
|
-
const routifyExamplesDir = getRoutifyExamplesDir();
|
|
19
|
-
const project = await getTemplate(routifyExamplesDir, starter);
|
|
20
|
-
console.log('project', project);
|
|
21
|
-
if (project.test) {
|
|
22
|
-
const { tests } = project.test;
|
|
23
|
-
console.log(tests);
|
|
24
|
-
addTests(projectDir, project.test);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// await cp(exampleDir, projectDir, { recursive: true });
|
|
28
|
-
// await rm(join(projectDir, 'manifest.js'));
|
|
29
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import k from 'kleur';
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
-
|
|
6
|
-
export function routifyIntro() {
|
|
7
|
-
console.log();
|
|
8
|
-
console.log(
|
|
9
|
-
` ${k.underline(
|
|
10
|
-
`${k.bold().magenta('Routify')} ${k.bold('3')} beta`,
|
|
11
|
-
)}`,
|
|
12
|
-
);
|
|
13
|
-
console.log(
|
|
14
|
-
` - Follow our twitter to get updates: ${k.blue(
|
|
15
|
-
'https://twitter.com/routifyjs',
|
|
16
|
-
)}`,
|
|
17
|
-
);
|
|
18
|
-
console.log(
|
|
19
|
-
` - Or join our discord: ${k.blue(
|
|
20
|
-
'https://discord.com/invite/ntKJD5B',
|
|
21
|
-
)}`,
|
|
22
|
-
);
|
|
23
|
-
console.log();
|
|
24
|
-
}
|
package/src/versions404/two.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import logSymbols from 'log-symbols';
|
|
2
|
-
import simpleGit from 'simple-git';
|
|
3
|
-
import { rmSync } from 'fs';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import k from 'kleur';
|
|
6
|
-
|
|
7
|
-
export const run = async ({ projectDir, args }) => {
|
|
8
|
-
const git = simpleGit(projectDir);
|
|
9
|
-
|
|
10
|
-
console.log(k.blue(`\n${logSymbols.info} Cloning template...`));
|
|
11
|
-
|
|
12
|
-
await git.clone('https://github.com/roxiness/routify-starter', projectDir);
|
|
13
|
-
|
|
14
|
-
rmSync(join(projectDir, '.git'), {
|
|
15
|
-
recursive: true,
|
|
16
|
-
force: true,
|
|
17
|
-
});
|
|
18
|
-
};
|