@reflex-stack/tsp 0.1.7 → 0.1.9
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 +1 -1
- package/package.json +1 -1
- package/src/commands/init.js +10 -8
- package/tests/example-package/LICENCE +21 -0
- package/tests/example-package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ This will ask some questions and create those files. It contains 1 **submodule**
|
|
|
39
39
|
│ └─ tsconfig.json ( to have correct typings in test.js )
|
|
40
40
|
├─ .gitignore
|
|
41
41
|
├─ .npmignore
|
|
42
|
-
├─
|
|
42
|
+
├─ LICENSE ( if MIT )
|
|
43
43
|
├─ package.json
|
|
44
44
|
├─ package-lock.json
|
|
45
45
|
├─ README.md
|
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -6,9 +6,9 @@ import { Stach } from "stach";
|
|
|
6
6
|
import { mkdirSync } from "fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const licenseTemplate = `MIT License
|
|
10
10
|
|
|
11
|
-
Copyright (c)
|
|
11
|
+
Copyright (c) {{ year }} {{ authorName }}
|
|
12
12
|
|
|
13
13
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
14
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -110,7 +110,7 @@ dist
|
|
|
110
110
|
|
|
111
111
|
const npmIgnoreTemplate = `.DS_Store
|
|
112
112
|
.idea
|
|
113
|
-
|
|
113
|
+
LICENSE
|
|
114
114
|
tmp/
|
|
115
115
|
src/
|
|
116
116
|
.github/
|
|
@@ -193,9 +193,9 @@ export async function init () {
|
|
|
193
193
|
options.packageTextName = await askInput(`Package name, in plain text {d}ex : My Package`, { notEmpty: true })
|
|
194
194
|
options.packageNPMName = await askInput(`Package name, for NPM, with namespace {d}ex : @mynamespace/mypackage`, { notEmpty: true })
|
|
195
195
|
options.authorName = await askInput(`Author name`, { notEmpty: true })
|
|
196
|
-
options.
|
|
196
|
+
options.licenseName = await askInput(`License name`, { defaultValue: "MIT" })
|
|
197
197
|
options.esLevel = await askInput(`ES Level for tsconfig`, { defaultValue: "es2023" })
|
|
198
|
-
options.tsStrict = await askList(`Use strict Typescript?`, ["Yes", "No"], { defaultIndex:
|
|
198
|
+
options.tsStrict = await askList(`Use strict Typescript?`, ["Yes", "No"], { defaultIndex: 0, returnType: "index" })
|
|
199
199
|
options.domAccess = await askList(`Will it have access to DOM?`, ["Yes", "No"], { defaultIndex: 0, returnType: "index" })
|
|
200
200
|
options.svgReport = await askList(`Export SVG size report on build for README.md?`, ["Yes", "No"], { defaultIndex: 0, returnType: "index" })
|
|
201
201
|
options.jsonReport = await askList(`Export JSON size report on build?`, ["Yes", "No"], { defaultIndex: 1, returnType: "index" })
|
|
@@ -213,7 +213,7 @@ export async function init () {
|
|
|
213
213
|
version: "0.1.0",
|
|
214
214
|
type: "module",
|
|
215
215
|
author: options.authorName,
|
|
216
|
-
|
|
216
|
+
license: options.licenseName,
|
|
217
217
|
main: "./dist/index.js",
|
|
218
218
|
types: "./dist/index.d.ts",
|
|
219
219
|
exports: {
|
|
@@ -257,13 +257,15 @@ export async function init () {
|
|
|
257
257
|
packageJson.repository.directory = options.relativeGitSubDirectory
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
+
// Inject year
|
|
261
|
+
options.year = new Date().getFullYear()
|
|
260
262
|
// Create directories
|
|
261
263
|
mkdirSync(config.tests, { recursive: true })
|
|
262
264
|
mkdirSync(config.dist, { recursive: true })
|
|
263
265
|
mkdirSync(join(config.src, "submodule"), { recursive: true })
|
|
264
266
|
// Generate root files
|
|
265
|
-
if ( options.
|
|
266
|
-
writeFileSync("
|
|
267
|
+
if ( options.licenseName === "MIT" )
|
|
268
|
+
writeFileSync("LICENSE", Stach(licenseTemplate, options))
|
|
267
269
|
writeFileSync("README.md", Stach(readmeTemplate, options))
|
|
268
270
|
writeFileSync(".gitignore", Stach(gitIgnoreTemplate, options))
|
|
269
271
|
writeFileSync(".npmignore", Stach(npmIgnoreTemplate, options))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Alexis Bouhet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|