sv 0.4.3 → 0.5.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/LICENSE +7 -0
- package/README.md +20 -128
- package/dist/bin.js +13085 -0
- package/dist/bin.js.map +1 -0
- package/dist/index-CfDBZLMZ.js +137 -0
- package/dist/index-CfDBZLMZ.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/shared.json +138 -0
- package/dist/templates/demo/assets/DOT-gitignore +21 -0
- package/dist/templates/demo/assets/DOT-npmrc +1 -0
- package/dist/templates/demo/assets/src/app.css +107 -0
- package/dist/templates/demo/assets/src/app.html +12 -0
- package/dist/templates/demo/assets/src/lib/images/github.svg +16 -0
- package/dist/templates/demo/assets/src/lib/images/svelte-logo.svg +1 -0
- package/dist/templates/demo/assets/src/lib/images/svelte-welcome.png +0 -0
- package/dist/templates/demo/assets/src/lib/images/svelte-welcome.webp +0 -0
- package/dist/templates/demo/assets/static/favicon.png +0 -0
- package/dist/templates/demo/assets/static/robots.txt +3 -0
- package/dist/templates/demo/files.types=checkjs.json +62 -0
- package/dist/templates/demo/files.types=none.json +58 -0
- package/dist/templates/demo/files.types=typescript.json +62 -0
- package/dist/templates/demo/meta.json +4 -0
- package/dist/templates/demo/package.json +19 -0
- package/dist/templates/skeleton/assets/DOT-gitignore +21 -0
- package/dist/templates/skeleton/assets/DOT-npmrc +1 -0
- package/dist/templates/skeleton/assets/src/app.html +12 -0
- package/dist/templates/skeleton/assets/static/favicon.png +0 -0
- package/dist/templates/skeleton/files.types=checkjs.json +14 -0
- package/dist/templates/skeleton/files.types=none.json +10 -0
- package/dist/templates/skeleton/files.types=typescript.json +14 -0
- package/dist/templates/skeleton/meta.json +4 -0
- package/dist/templates/skeleton/package.json +18 -0
- package/dist/templates/skeletonlib/assets/DOT-gitignore +22 -0
- package/dist/templates/skeletonlib/assets/DOT-npmrc +1 -0
- package/dist/templates/skeletonlib/assets/src/app.html +12 -0
- package/dist/templates/skeletonlib/assets/static/favicon.png +0 -0
- package/dist/templates/skeletonlib/files.types=checkjs.json +14 -0
- package/dist/templates/skeletonlib/files.types=none.json +10 -0
- package/dist/templates/skeletonlib/files.types=typescript.json +14 -0
- package/dist/templates/skeletonlib/meta.json +4 -0
- package/dist/templates/skeletonlib/package.json +34 -0
- package/dist/unocss-Dk7i15rK.js +11 -0
- package/dist/unocss-Dk7i15rK.js.map +1 -0
- package/dist/unplugin-icons-DkNLYvBs.js +11 -0
- package/dist/unplugin-icons-DkNLYvBs.js.map +1 -0
- package/package.json +42 -29
- package/bin/sv.d.ts +0 -2
- package/bin/sv.js +0 -126
- package/common.d.ts +0 -39
- package/common.js +0 -29
- package/docs/example.js +0 -57
- package/index.d.ts +0 -13
- package/index.js +0 -31
- package/parser.d.ts +0 -31
- package/parser.js +0 -209
- package/stringifier.d.ts +0 -44
- package/stringifier.js +0 -174
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2024 [these people](https://github.com/sveltejs/cli/graphs/contributors)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,142 +1,34 @@
|
|
|
1
|
-
# sv
|
|
1
|
+
# sv - the Svelte CLI
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[](https://travis-ci.org/chbrown/sv)
|
|
5
|
-
[](https://coveralls.io/github/chbrown/sv)
|
|
3
|
+
A CLI for creating new [SvelteKit](https://kit.svelte.dev) projects and adding functionality to existing ones. Just run...
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
```bash
|
|
6
|
+
npx sv
|
|
7
|
+
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
* `sv.Parser` is a [Writable stream](http://nodejs.org/api/stream.html#stream_class_stream_writable).
|
|
9
|
+
...and follow the prompts.
|
|
11
10
|
|
|
12
|
-
##
|
|
11
|
+
## API
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
You can also use `sv` programmatically:
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
```js
|
|
16
|
+
import { create } from 'sv';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
await create('my-new-app', {
|
|
19
|
+
name: 'my-new-app',
|
|
20
|
+
template: 'default' // or 'skeleton' or 'skeletonlib'
|
|
21
|
+
});
|
|
22
|
+
```
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
`checkjs` means your project will use TypeScript to typecheck JavaScript via [JSDoc comments](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
## Acknowledgements
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
index name time
|
|
27
|
-
1 chris 1:18
|
|
28
|
-
2 daniel 1:17
|
|
29
|
-
3 lewis 1:30
|
|
30
|
-
4 stephen 1:16
|
|
31
|
-
5 larry 1:32
|
|
32
|
-
|
|
33
|
-
And in node:
|
|
34
|
-
|
|
35
|
-
var sv = require('sv');
|
|
36
|
-
var parser = new sv.Parser();
|
|
37
|
-
parser.on('data', function(obj) {
|
|
38
|
-
console.log('sprinter ->', obj);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
var fs = require('fs');
|
|
42
|
-
var sprints = fs.createReadStream('sprints.csv', {encoding: 'utf8'});
|
|
43
|
-
sprints.pipe(parser);
|
|
44
|
-
|
|
45
|
-
### Stringifying
|
|
46
|
-
|
|
47
|
-
var expenses = [
|
|
48
|
-
{name: 'Tip' },
|
|
49
|
-
{name: 'Lunch', amount: 5.90},
|
|
50
|
-
{name: 'Latte', amount: 3.15},
|
|
51
|
-
{name: 'Paper', amount: 2.10},
|
|
52
|
-
{name: 'Pens' , amount: 4.59},
|
|
53
|
-
{ amount: 9.16}
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
var sv = require('sv');
|
|
57
|
-
var stringifier = new sv.Stringifier({peek: 2, missing: 'n/a'});
|
|
58
|
-
stringifier.pipe(process.stdout);
|
|
59
|
-
expenses.forEach(function(expense) {
|
|
60
|
-
stringifier.write(expense);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// if you write set 'peek' to more rows than you have in your data,
|
|
64
|
-
// you'll need to call stringifier end so that they get flushed.
|
|
65
|
-
stringifier.end();
|
|
66
|
-
|
|
67
|
-
* N.b.: If you pipe a buffer or (i.e., with a stringifier) into a parser, the
|
|
68
|
-
parser will not receive any encoding. You _must_ set the encoding on the
|
|
69
|
-
parser in those cases.
|
|
70
|
-
|
|
71
|
-
### Stringifier features:
|
|
72
|
-
|
|
73
|
-
1. Infer column names from a list of objects.
|
|
74
|
-
2. Convert from objects to csv / tsv plaintext.
|
|
75
|
-
* Also allows writing arrays / strings directly.
|
|
76
|
-
3. Write header automatically.
|
|
77
|
-
|
|
78
|
-
### Parser features:
|
|
79
|
-
|
|
80
|
-
1. Infer delimiter from input.
|
|
81
|
-
2. Infer column names from first line of input.
|
|
82
|
-
3. Handle universal newlines (`\r`, `\r\n`, or `\n`).
|
|
83
|
-
|
|
84
|
-
## CLI usage
|
|
85
|
-
|
|
86
|
-
shopt -s globstar
|
|
87
|
-
for csv in ~/corpora/testsheets/**/*.csv; do
|
|
88
|
-
echo
|
|
89
|
-
file "$csv"
|
|
90
|
-
echo "Tunneling through multiple 'sv' calls should be transparent."
|
|
91
|
-
cat "$csv" | sv -j | wc -l
|
|
92
|
-
cat "$csv" | sv | sv -j | wc -l
|
|
93
|
-
done
|
|
94
|
-
|
|
95
|
-
## TODO
|
|
96
|
-
|
|
97
|
-
* Decide how to encode a field like {id: 1, name: '"chris'},
|
|
98
|
-
when the delimiter is `,` and quotechar is `"`.
|
|
99
|
-
- This is weird because it doesn't *need* quoting, but without, the
|
|
100
|
-
quotechar marker will trigger an `inside` state, but there's no end quote.)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# Development notes
|
|
104
|
-
|
|
105
|
-
## Characters codes
|
|
106
|
-
|
|
107
|
-
Line separators:
|
|
108
|
-
|
|
109
|
-
* `\n` = 10 (newline)
|
|
110
|
-
* `\r` = 13 (return)
|
|
111
|
-
|
|
112
|
-
Field separators:
|
|
113
|
-
|
|
114
|
-
* `\t` = 9 (tab)
|
|
115
|
-
* ` ` = 32 (space)
|
|
116
|
-
* `,` = 44 (comma)
|
|
117
|
-
* `;` = 59 (semicolon)
|
|
118
|
-
|
|
119
|
-
Field quotations:
|
|
120
|
-
|
|
121
|
-
* `"` = 34 (double quote)
|
|
122
|
-
* `'` = 39 (single quote)
|
|
123
|
-
* <code>`</code> = 96 (backtick)
|
|
124
|
-
|
|
125
|
-
Escapes:
|
|
126
|
-
|
|
127
|
-
* `\` = 92 (backslash)
|
|
128
|
-
|
|
129
|
-
## Debugging helper:
|
|
130
|
-
|
|
131
|
-
function logEvents(emitter, prefix, names) {
|
|
132
|
-
names.forEach(function(name) {
|
|
133
|
-
emitter.on(name, function(/*...*/) {
|
|
134
|
-
console.error(prefix + ':' + name, arguments);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
28
|
+
Thank you to [Christopher Brown](https://github.com/chbrown) who originally owned the `sv` name on npm for graciously allowing it to be used for this package. You can find the original `sv` package at [`@chbrown/sv`](https://www.npmjs.com/package/@chbrown/sv).
|
|
138
29
|
|
|
30
|
+
This project was formed by merging the `create-svelte` and `svelte-add` CLIs. Thank you to [J](https://github.com/babichjacob) for starting the community-led `svelte-add` project and to the [`svelte-add` contributors](https://github.com/svelte-add/svelte-add/graphs/contributors).
|
|
139
31
|
|
|
140
32
|
## License
|
|
141
33
|
|
|
142
|
-
|
|
34
|
+
[MIT](../../LICENSE).
|