create-smcgateway-sv 0.0.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.
- package/README.md +9 -0
- package/index.js +48 -0
- package/package.json +24 -0
- package/template/README.md +3 -0
- package/template/gitignore +2 -0
- package/template/package.json +26 -0
package/README.md
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const spawn = require('cross-spawn');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
// The first argument will be the project name.
|
|
8
|
+
const projectName = process.argv[2];
|
|
9
|
+
|
|
10
|
+
// Create a project directory with the project name.
|
|
11
|
+
const currentDir = process.cwd();
|
|
12
|
+
const projectDir = path.resolve(currentDir, projectName);
|
|
13
|
+
fs.mkdirSync(projectDir, { recursive: true });
|
|
14
|
+
|
|
15
|
+
// A common approach to building a starter template is to
|
|
16
|
+
// create a `template` folder which will house the template
|
|
17
|
+
// and the files we want to create.
|
|
18
|
+
const templateDir = path.resolve(__dirname, 'template');
|
|
19
|
+
fs.cpSync(templateDir, projectDir, { recursive: true });
|
|
20
|
+
|
|
21
|
+
// It is good practice to have dotfiles stored in the
|
|
22
|
+
// template without the dot (so they do not get picked
|
|
23
|
+
// up by the starter template repository). We can rename
|
|
24
|
+
// the dotfiles after we have copied them over to the
|
|
25
|
+
// new project directory.
|
|
26
|
+
fs.renameSync(
|
|
27
|
+
path.join(projectDir, 'gitignore'),
|
|
28
|
+
path.join(projectDir, '.gitignore')
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const projectPackageJson = require(path.join(projectDir, 'package.json'));
|
|
32
|
+
|
|
33
|
+
// Update the project's package.json with the new project name
|
|
34
|
+
projectPackageJson.name = projectName;
|
|
35
|
+
|
|
36
|
+
fs.writeFileSync(
|
|
37
|
+
path.join(projectDir, 'package.json'),
|
|
38
|
+
JSON.stringify(projectPackageJson, null, 2)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Run `npm install` in the project directory to install
|
|
42
|
+
// the dependencies. We are using a third-party library
|
|
43
|
+
// called `cross-spawn` for cross-platform support.
|
|
44
|
+
// (Node has issues spawning child processes in Windows).
|
|
45
|
+
spawn.sync('npm', ['install'], { stdio: 'inherit' });
|
|
46
|
+
|
|
47
|
+
console.log('Success! Your new project is ready.');
|
|
48
|
+
console.log(`Created ${projectName} at ${projectDir}`);
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-smcgateway-sv",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "SMC Gateway Svelte Webapp template",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-my-template": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/petermekhaeil/create-my-template.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"template"
|
|
14
|
+
],
|
|
15
|
+
"author": "Peter Mekhaeil <4616064+petermekhaeil@users.noreply.github.com>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/petermekhaeil/create-my-template/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/petermekhaeil/create-my-template#readme",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"cross-spawn": "^7.0.3"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "project-name",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
|
14
|
+
"@tsconfig/svelte": "^5.0.4",
|
|
15
|
+
"svelte": "^5.34.3",
|
|
16
|
+
"svelte-check": "^4.2.1",
|
|
17
|
+
"typescript": "~5.8.3",
|
|
18
|
+
"vite": "^6.3.5"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@tabler/icons-svelte": "^3.34.0",
|
|
22
|
+
"bootstrap": "^5.3.6",
|
|
23
|
+
"smcgateway-sv": "^0.0.8",
|
|
24
|
+
"svelte-spa-router": "^4.0.1"
|
|
25
|
+
}
|
|
26
|
+
}
|