skeleton 0.1.1 → 1.0.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/package.json CHANGED
@@ -1,26 +1,55 @@
1
1
  {
2
2
  "name": "skeleton",
3
- "description": "Express 3.0 framework-less app structure generator",
4
- "version": "0.1.1",
5
- "author": "Etienne Lemay",
3
+ "description": "The CLI for Skeleton related tooling.",
4
+ "version": "1.0.0",
6
5
  "repository": {
7
6
  "type": "git",
8
- "url": "git://github.com/EtienneLem/skeleton.git"
7
+ "url": "https://github.com/skeletonlabs/skeleton",
8
+ "directory": "packages/skeleton-cli"
9
9
  },
10
- "engines": {"node": "*"},
11
- "dependencies": {
12
- "coffee-script": "1.3.x",
13
- "mkdirp": "0.3.x",
14
- "colors": "0.6.x"
10
+ "sideEffects": false,
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.mjs"
15
+ }
15
16
  },
17
+ "bin": "./dist/index.mjs",
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist"
21
+ ],
16
22
  "devDependencies": {
17
- "should": "0.6.x",
18
- "mocha": "1.3.x",
19
- "rimraf": "2.0.x"
23
+ "@types/estree": "^1.0.7",
24
+ "@types/node": "^22.13.14",
25
+ "@types/semver": "^7.7.0",
26
+ "type-fest": "^4.38.0",
27
+ "typescript": "^5.8.2",
28
+ "unbuild": "^3.5.0",
29
+ "vitest": "^3.1.1"
30
+ },
31
+ "license": "MIT",
32
+ "dependencies": {
33
+ "@clack/prompts": "^0.10.0",
34
+ "colorette": "^2.0.20",
35
+ "commander": "^13.1.0",
36
+ "detect-indent": "^7.0.1",
37
+ "latest-version": "^9.0.0",
38
+ "magic-string": "^0.30.17",
39
+ "nanoid": "^5.1.5",
40
+ "node-html-parser": "^7.0.1",
41
+ "package-manager-detector": "^1.1.0",
42
+ "postcss": "^8.5.3",
43
+ "semver": "^7.7.1",
44
+ "svelte": "^5.25.3",
45
+ "tinyglobby": "^0.2.12",
46
+ "ts-morph": "^25.0.1",
47
+ "zimmerframe": "^1.1.2"
20
48
  },
21
- "keywords": ["skeleton", "express", "structure", "generator"],
22
- "bin": { "skeleton": "./bin/skeleton" },
23
49
  "scripts": {
24
- "test": "cake test"
50
+ "build": "unbuild",
51
+ "dev": "unbuild --watch",
52
+ "test": "vitest run",
53
+ "test:watch": "vitest watch"
25
54
  }
26
- }
55
+ }
package/.npmignore DELETED
@@ -1,5 +0,0 @@
1
- .git*
2
- example/
3
- test/
4
- Cakefile
5
- .DS_Store
package/TODO.md DELETED
@@ -1 +0,0 @@
1
- # TODO
package/bin/skeleton DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- var path = require('path')
4
- var fs = require('fs')
5
- var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib')
6
-
7
- require('coffee-script')
8
-
9
- Skeleton = require(lib + '/skeleton')
10
- new Skeleton
@@ -1,22 +0,0 @@
1
- ###
2
- * Return last item of an array
3
-
4
- * ['a', 'b', 'c'].last() => 'c'
5
- ###
6
- Array::last = ->
7
- this[this.length - 1]
8
-
9
- ###
10
- * Return a new copy of an array
11
-
12
- * a = [1,2,3]
13
- * b = a
14
- * c = a.clone()
15
-
16
- * a == b => true
17
- * a == c => false
18
- * c => [1,2,3]
19
- ###
20
- Array::clone = ->
21
- for elem in this
22
- elem
@@ -1,180 +0,0 @@
1
- # Node.js dependencies
2
- fs = require 'fs'
3
- path = require 'path'
4
- util = require 'util'
5
- mkdirp = require 'mkdirp'
6
- colors = require 'colors'
7
-
8
- # Helpers
9
- require './helpers'
10
-
11
- # Local dependencies
12
- Template = require './template'
13
- OptionParser = require './option_parser'
14
-
15
- # Main class
16
- class Skeleton
17
-
18
- @VERSION = '0.1.1'
19
-
20
- @OPTIONS = [
21
- # Short Long Description Choices
22
- ['-h', '--help', 'display this help message' ]
23
- ['-v', '--version', 'display the version number' ]
24
- ['-f', '--force', 'force on non-empty directory' ]
25
- ['-n', '--nolog', 'do not print any message to process.stdout' ]
26
- ['-d', '--directory', 'the output directory (default: ./)', [''] ]
27
- ['-r', '--renderer', 'template engine', ['ejs', 'jade'] ]
28
- ['-c', '--css', 'stylesheet engine', ['stylus', 'less', 'css'] ]
29
- ['-j', '--js', 'javascript engine', ['coffee', 'js'] ]
30
- ]
31
-
32
- constructor: (args=null, callback=null) ->
33
- @folderCache = {}
34
-
35
- args ||= process.argv.splice(2)
36
- @options = new OptionParser(args.clone(), Skeleton.OPTIONS)
37
-
38
- # Display help message and exit process
39
- if @options.help || args.length == 0
40
- this.displayHelp()
41
- return
42
-
43
- # Display current version and exit process
44
- if @options.version
45
- this.displayVersion()
46
- return
47
-
48
- if @options.appName
49
- files = fs.readdir "#{@options.directory || '.'}/#{@options.appName}", (err, files) =>
50
- throw err if err && 'ENOENT' != err.code
51
- empty = !files?.length > 0
52
-
53
- if empty || !empty && @options.force
54
- this.createProject @options.appName
55
- callback() if callback
56
- else
57
- this.displayLine 'Folder not empty. Use the --force flag to overrite'.grey
58
- this.displayLine "#{'$'.cyan} skeleton -f #{@options.directory || '.'}/#{@options.appName}"
59
- callback() if callback
60
-
61
- ###
62
- * Create a project in appName folder
63
-
64
- * @param {String} appName
65
- ###
66
-
67
- createProject: (appName) =>
68
- template = new Template(appName, @options)
69
- this.displayLine ''
70
-
71
- for filename, content of template.files
72
- this.write filename, "#{content}\n"
73
-
74
- this.displayLine ''
75
- this.displayLine ' ============================================='.cyan
76
- this.displayLine " #{'template engine:'.cyan} #{@options.renderer}"
77
- this.displayLine " #{'stylesheet engine:'.cyan} #{@options.css}"
78
- this.displayLine " #{'javascript engine:'.cyan} #{@options.js}"
79
- this.displayLine ''
80
- this.displayLine " #{'$'.cyan} cd #{@options.appName} && npm install"
81
- this.displayLine " #{'$'.cyan} node server.js"
82
- this.displayLine ' ============================================='.cyan
83
-
84
- ###*
85
- * Echo content > path
86
- * Will recursively create its parent directories
87
-
88
- * @param {String} path
89
- * @param {String} content
90
- ###
91
-
92
- write: (path, content) ->
93
- # Remove useless leading ./ from path
94
- path = path.replace /^\.\//, ''
95
-
96
- this.mkdir path, (spaces) =>
97
- return if path.split('/').pop() == 'empty'
98
-
99
- fs.writeFileSync path, content
100
- this.displayLine " #{spaces}create: #{path}"
101
-
102
-
103
- ###
104
- * Mkdir recusrive (-p)
105
- * Doesn’t create already created directory
106
-
107
- * @param {String} filename
108
- * @param {Function} callback
109
- ###
110
-
111
- mkdir: (filename, callback=null) ->
112
- dirname = path.dirname(filename)
113
- depth = dirname.split('/').length
114
- spaces = new Array(depth).join('')
115
-
116
- if @folderCache[dirname]
117
- callback(spaces) if callback
118
- return
119
-
120
- mkdirp.sync dirname, '0755'
121
- @folderCache[dirname] = true
122
-
123
- this.displayLine " #{spaces}create: #{dirname}".magenta
124
- callback(spaces) if callback
125
-
126
- ###
127
- * Display help message
128
- ###
129
-
130
- displayHelp: ->
131
- rules = []
132
- longest = 0
133
-
134
- for option in Skeleton.OPTIONS
135
- short = option[0]
136
- long = option[1]
137
- desc = option[2]
138
- choices = option[3]
139
-
140
- length = short.length + long.length
141
- longest = length if length > longest
142
-
143
- rules.push
144
- short: short
145
- long: long
146
- desc: desc
147
- choices: choices
148
- length: length
149
-
150
- this.displayLine '\n Usage: skeleton [options] myapp\n'
151
-
152
- for rule in rules
153
- spaces = new Array(longest - rule.length + 3).join(' ')
154
- this.displayLine " #{rule.short}, #{rule.long}#{spaces}#{rule.desc} #{this.printChoices rule.choices}"
155
-
156
- printChoices: (choices) ->
157
- return '' if !choices || choices[0] == ''
158
-
159
- "[#{choices.join(', ')}] (default: #{choices[0]})"
160
-
161
- ###
162
- * Display current Skeleton version
163
- ###
164
-
165
- displayVersion: ->
166
- this.displayLine "Skeleton version #{Skeleton.VERSION}"
167
-
168
- ###
169
- * Print a line to process.stdout
170
- * Will always add a newline after
171
-
172
- * @param {String} line
173
- ###
174
-
175
- displayLine: (line) ->
176
- process.stdout.write "#{line}\n" if !@options.nolog
177
-
178
-
179
- # Export the class
180
- module.exports = Skeleton
@@ -1,61 +0,0 @@
1
- class OptionParser
2
-
3
- ###
4
- * Parse command-line options
5
-
6
- * @param {Array} @args
7
- * @param {Object} opts
8
- ###
9
-
10
- constructor: (@args, opts) ->
11
- options = {}
12
-
13
- for opt in opts
14
- short = opt[0]
15
- long = opt[1]
16
- choices = if opt[3]? then opt[3] else null
17
- optName = long.replace('--', '')
18
- options[optName] = this.getOption [short, long], choices
19
-
20
- options.appName = @args.last()
21
- return options
22
-
23
- ###
24
- * Return given flags value if the option has choices
25
- * else return a boolean whether the flag if found or not
26
-
27
- * @param {Array} flags
28
- * @param {Array} choices
29
- ###
30
-
31
- getOption: (flags, choices) ->
32
- for flag in flags
33
- index = @args.indexOf(flag)
34
- if index > -1
35
- if choices?
36
- value = @args[index + 1]
37
- if choices.indexOf(value) == -1 && choices[0] != ''
38
- throw new Error "Invalid value “#{value}” for #{flag} option"
39
- else
40
- value = true
41
-
42
- this.spliceArgs index, choices?
43
- return value
44
-
45
- if choices? then choices[0] else false
46
-
47
- ###
48
- * When a flag if parsed, it is removed from the @args array
49
- * Last option remaining is the appName
50
-
51
- * @param {Int} index
52
- * @param {Boolean} hasValue (default: false)
53
- ###
54
-
55
- spliceArgs: (index, hasValue=false) ->
56
- nbr = if hasValue then 2 else 1
57
- @args.splice(index, nbr)
58
-
59
-
60
- # Export the class
61
- module.exports = OptionParser