create-smbls 3.1.2 → 3.2.7
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/index.js +4 -34
- package/package.json +17 -2
package/index.js
CHANGED
|
@@ -1,38 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import execa from 'execa'
|
|
3
|
+
// Invoked via: npx create-smbls [dest] [options]
|
|
4
|
+
// Delegates to: smbls create [dest] [options]
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
// Step 1: Add npm script to package.json
|
|
10
|
-
const packageJsonPath = './package.json'
|
|
11
|
-
const packageJson = require(packageJsonPath)
|
|
6
|
+
process.argv.splice(2, 0, 'create')
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
if (packageJson.scripts && packageJson.scripts[scriptName]) {
|
|
15
|
-
console.log(`Script "${scriptName}" already exists in package.json.`)
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
packageJson.scripts = packageJson.scripts || {}
|
|
20
|
-
packageJson.scripts[scriptName] = `git clone ${repoUrl} .`
|
|
21
|
-
|
|
22
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
23
|
-
console.log(`Added npm script "${scriptName}" to package.json`)
|
|
24
|
-
|
|
25
|
-
// Step 2: Clone repository
|
|
26
|
-
await execa('npm', ['install']) // Install dependencies (optional)
|
|
27
|
-
await execa('npm', ['run', scriptName]) // Run the script
|
|
28
|
-
console.log('Repository cloned successfully.')
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error('Error:', error)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Example usage:
|
|
35
|
-
const repoUrl = 'https://github.com/symbo.ls/starter-kit.git'
|
|
36
|
-
const scriptName = 'smbls'
|
|
37
|
-
|
|
38
|
-
createScriptAndClone(repoUrl, scriptName)
|
|
8
|
+
await import('@symbo.ls/cli/bin/index.js')
|
package/package.json
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-smbls",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"
|
|
3
|
+
"version": "3.2.7",
|
|
4
|
+
"description": "Create a new Symbols project",
|
|
5
|
+
"author": "Symbols",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-smbls": "index.js"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@symbo.ls/cli": "^3.2.3"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"vpush": "git add . && git commit -am 'version update' && git push",
|
|
16
|
+
"vpatch": "npm version patch && npm publish"
|
|
17
|
+
},
|
|
18
|
+
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
19
|
+
"source": "index.js"
|
|
5
20
|
}
|