@uscreen.de/create-fastify-app 2.0.2 → 2.2.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/README.md +18 -5
- package/bin/cli.js +12 -9
- package/package.json +26 -19
- package/skeleton/package.json +3 -3
- package/.editorconfig +0 -13
- package/.eslintcache +0 -1
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -3
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/main.yml +0 -57
- package/.gitignore +0 -7
- package/.yarnrc +0 -2
- package/manifest.json +0 -3
- package/skeleton/.gitignore +0 -6
- package/test/cli.test.js +0 -82
- package/test/setup.js +0 -33
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
This package provides the cli skript to create a new `@uscreen.de/fastify-app` from scratch inside of a monorepo. No need to install any other prerequisites than node and pnpm. Features include:
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
- initialize new package.json
|
|
13
|
+
- setup **application skeleton**
|
|
14
|
+
- setup **dotfiles**
|
|
15
|
+
- setup **.env** for starting
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -70,6 +70,19 @@ $ pnpm dev
|
|
|
70
70
|
|
|
71
71
|
## Changelog
|
|
72
72
|
|
|
73
|
+
### 2.2.0
|
|
74
|
+
|
|
75
|
+
- upgraded outdated packages
|
|
76
|
+
- upgraded outdated packages in skeleton
|
|
77
|
+
|
|
78
|
+
### 2.1.0
|
|
79
|
+
|
|
80
|
+
#### Changed
|
|
81
|
+
|
|
82
|
+
- replaced deprecated packages
|
|
83
|
+
- upgraded outdated packages
|
|
84
|
+
- upgraded outdated packages in skeleton
|
|
85
|
+
|
|
73
86
|
### 2.0.0
|
|
74
87
|
|
|
75
88
|
#### Changed
|
|
@@ -115,7 +128,7 @@ $ pnpm dev
|
|
|
115
128
|
|
|
116
129
|
#### Changed
|
|
117
130
|
|
|
118
|
-
- switch skeleton to
|
|
131
|
+
- switch skeleton to **ESM only**
|
|
119
132
|
- upgrade skeleton to fastify@4.x
|
|
120
133
|
|
|
121
134
|
### v0.7.0
|
package/bin/cli.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
import { spawn } from 'node:child_process'
|
|
4
|
+
import { createRequire } from 'node:module'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import process from 'node:process'
|
|
6
7
|
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
7
9
|
import { program } from 'commander'
|
|
8
|
-
import { readPackageUpSync } from 'read-pkg-up'
|
|
9
|
-
import { writePackage } from 'write-pkg'
|
|
10
10
|
import fs from 'fs-extra'
|
|
11
|
+
import { readPackageUpSync } from 'read-package-up'
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
+
import { writePackage } from 'write-package'
|
|
13
14
|
|
|
14
15
|
const __filename = fileURLToPath(import.meta.url)
|
|
15
16
|
const __dirname = path.dirname(__filename)
|
|
@@ -22,19 +23,21 @@ let skeleton
|
|
|
22
23
|
/**
|
|
23
24
|
* ensure path of new app
|
|
24
25
|
*/
|
|
25
|
-
const ensurePath =
|
|
26
|
+
const ensurePath = path => fs.ensureDir(path)
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* init new pnpm project
|
|
29
30
|
*/
|
|
30
|
-
const initializePnpm =
|
|
31
|
+
const initializePnpm = path =>
|
|
31
32
|
new Promise((resolve, reject) => {
|
|
32
33
|
const pnpm = spawn('pnpm', ['init'], {
|
|
33
34
|
cwd: path,
|
|
34
35
|
stdio: [0, 1, 2]
|
|
35
36
|
})
|
|
36
37
|
pnpm.on('close', (code) => {
|
|
37
|
-
if (code === 0)
|
|
38
|
+
if (code === 0) {
|
|
39
|
+
return resolve(code)
|
|
40
|
+
}
|
|
38
41
|
/* c8 ignore next */
|
|
39
42
|
reject(code)
|
|
40
43
|
})
|
package/package.json
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uscreen.de/create-fastify-app",
|
|
3
|
-
"version": "2.0.2",
|
|
4
|
-
"description": "cli to create a new @uscreen.de/fastify-app",
|
|
5
|
-
"main": "index.js",
|
|
6
3
|
"type": "module",
|
|
4
|
+
"version": "2.2.0",
|
|
5
|
+
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264",
|
|
6
|
+
"description": "cli to create a new @uscreen.de/fastify-app",
|
|
7
|
+
"author": "Marcus Spiegel <spiegel@uscreen.de>",
|
|
8
|
+
"license": "MIT",
|
|
7
9
|
"homepage": "https://github.com/uscreen/create-fastify-app",
|
|
8
10
|
"repository": {
|
|
9
11
|
"type": "git",
|
|
10
12
|
"url": "git+https://github.com/uscreen/create-fastify-app.git"
|
|
11
13
|
},
|
|
12
|
-
"author": "Marcus Spiegel <spiegel@uscreen.de>",
|
|
13
|
-
"license": "MIT",
|
|
14
14
|
"bin": {
|
|
15
15
|
"create-fastify-app": "./bin/cli.js"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"write-pkg": "^7.0.0"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@uscreen.de/eslint-config-prettystandard-node": "^0.3.0",
|
|
25
|
-
"c8": "^10.1.3",
|
|
26
|
-
"strip-ansi": "^7.1.2"
|
|
27
|
-
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"skeleton"
|
|
20
|
+
],
|
|
28
21
|
"scripts": {
|
|
29
|
-
"lint": "eslint --fix",
|
|
30
22
|
"test": "node --test --test-reporter spec ./test",
|
|
31
23
|
"test:cov": "c8 --reporter=html --reporter=text node --test ./test",
|
|
32
|
-
"test:ci": "find ./test -name '*.test.js' | xargs c8 --reporter=lcov --reporter=text -- node --test"
|
|
24
|
+
"test:ci": "find ./test -name '*.test.js' | xargs c8 --reporter=lcov --reporter=text -- node --test",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"lint:fix": "eslint . --fix"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"commander": "^14.0.3",
|
|
30
|
+
"fs-extra": "^11.3.4",
|
|
31
|
+
"read-package-up": "^12.0.0",
|
|
32
|
+
"write-package": "^7.2.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@antfu/eslint-config": "^7.6.1",
|
|
36
|
+
"c8": "^11.0.0",
|
|
37
|
+
"eslint": "^9.39.3",
|
|
38
|
+
"eslint-plugin-format": "^2.0.1",
|
|
39
|
+
"strip-ansi": "^7.2.0"
|
|
33
40
|
}
|
|
34
|
-
}
|
|
41
|
+
}
|
package/skeleton/package.json
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"@fastify/one-line-logger": "^2.0.0",
|
|
14
14
|
"@uscreen.de/common-esm": "^1.0.0",
|
|
15
15
|
"@uscreen.de/fastify-app": "^3.0.0",
|
|
16
|
-
"env-schema": "^
|
|
16
|
+
"env-schema": "^7.0.0",
|
|
17
17
|
"fastify": "^5.0.0",
|
|
18
18
|
"fastify-plugin": "^5.0.0",
|
|
19
|
-
"fluent-json-schema": "^
|
|
19
|
+
"fluent-json-schema": "^6.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"c8": "^
|
|
22
|
+
"c8": "^11.0.0",
|
|
23
23
|
"nodemon": "^3.0.0"
|
|
24
24
|
}
|
|
25
25
|
}
|
package/.editorconfig
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
indent_style = space
|
|
6
|
-
indent_size = 2
|
|
7
|
-
end_of_line = lf
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[{Makefile,**.mk}]
|
|
12
|
-
# Use tabs for indentation (Makefiles require tabs)
|
|
13
|
-
indent_style = tab
|
package/.eslintcache
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"/Users/martin/repos/uscreen/npm/create-fastify-app/bin/cli.js":"1"},{"size":3451,"mtime":1744123221597,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1cjo6f4","/Users/martin/repos/uscreen/npm/create-fastify-app/bin/cli.js",[],[]]
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/skeleton/
|
package/.eslintrc.cjs
DELETED
package/.github/dependabot.yml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "npm"
|
|
9
|
-
directory: "/"
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "weekly"
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
-
|
|
4
|
-
name: Test CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: ["main"]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: ["main"]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
matrix:
|
|
17
|
-
node-version: [18, 20, 22]
|
|
18
|
-
steps:
|
|
19
|
-
- name: Checkout code
|
|
20
|
-
uses: actions/checkout@v4
|
|
21
|
-
|
|
22
|
-
- name: Install pnpm
|
|
23
|
-
uses: pnpm/action-setup@v4
|
|
24
|
-
with:
|
|
25
|
-
version: 9
|
|
26
|
-
run_install: false
|
|
27
|
-
|
|
28
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
29
|
-
uses: actions/setup-node@v4
|
|
30
|
-
with:
|
|
31
|
-
node-version: ${{ matrix.node-version }}
|
|
32
|
-
cache: "pnpm"
|
|
33
|
-
|
|
34
|
-
- name: Install packages
|
|
35
|
-
run: pnpm install
|
|
36
|
-
|
|
37
|
-
- name: Run tests
|
|
38
|
-
run: pnpm run test:ci
|
|
39
|
-
|
|
40
|
-
- name: Coveralls
|
|
41
|
-
uses: coverallsapp/github-action@master
|
|
42
|
-
with:
|
|
43
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
44
|
-
|
|
45
|
-
automerge:
|
|
46
|
-
if: >
|
|
47
|
-
github.event_name == 'pull_request' &&
|
|
48
|
-
github.event.pull_request.user.login == 'dependabot[bot]'
|
|
49
|
-
needs: test
|
|
50
|
-
runs-on: ubuntu-latest
|
|
51
|
-
permissions:
|
|
52
|
-
pull-requests: write
|
|
53
|
-
contents: write
|
|
54
|
-
steps:
|
|
55
|
-
- uses: fastify/github-action-merge-dependabot@v3
|
|
56
|
-
with:
|
|
57
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
package/.gitignore
DELETED
package/.yarnrc
DELETED
package/manifest.json
DELETED
package/skeleton/.gitignore
DELETED
package/test/cli.test.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import test from 'node:test'
|
|
2
|
-
import assert from 'node:assert/strict'
|
|
3
|
-
import fs from 'fs-extra'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { createRequire } from 'module'
|
|
6
|
-
import stripAnsi from 'strip-ansi'
|
|
7
|
-
import { before, after, cli, cwd } from './setup.js'
|
|
8
|
-
|
|
9
|
-
const require = createRequire(import.meta.url)
|
|
10
|
-
const { version } = require('../package.json')
|
|
11
|
-
|
|
12
|
-
test.before(before)
|
|
13
|
-
test.after(after)
|
|
14
|
-
|
|
15
|
-
test('`$ cli` should print error message', async (t) => {
|
|
16
|
-
const result = await cli([])
|
|
17
|
-
assert.equal(
|
|
18
|
-
true,
|
|
19
|
-
result.stderr.startsWith("error: missing required argument 'name'"),
|
|
20
|
-
'Should print error message'
|
|
21
|
-
)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
test('`$ cli -V` should show correct version', async (t) => {
|
|
25
|
-
const result = await cli(['--version'])
|
|
26
|
-
assert.equal(true, result.stdout.startsWith(version))
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test('`$ cli new-app` should succeed', async (t) => {
|
|
30
|
-
const result = await cli(['new-app'])
|
|
31
|
-
/**
|
|
32
|
-
* check output
|
|
33
|
-
*/
|
|
34
|
-
assert.equal(0, result.code, 'Should succeed')
|
|
35
|
-
|
|
36
|
-
await t.test('Check output', (t, done) => {
|
|
37
|
-
const appPath = path.resolve(cwd, 'new-app')
|
|
38
|
-
|
|
39
|
-
const expectedOut = [`Wrote to ${appPath}/package.json`]
|
|
40
|
-
|
|
41
|
-
const stdout = stripAnsi(result.stdout)
|
|
42
|
-
|
|
43
|
-
for (const e of expectedOut) {
|
|
44
|
-
assert.equal(true, stdout.includes(e), `"${e.substring(0, 36)}"`)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
done()
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* check files
|
|
52
|
-
*/
|
|
53
|
-
await t.test('Check files', (t, done) => {
|
|
54
|
-
const appPath = path.resolve(cwd, 'new-app')
|
|
55
|
-
|
|
56
|
-
assert.ok(
|
|
57
|
-
fs.existsSync(path.resolve(appPath, 'package.json')),
|
|
58
|
-
'package.json was created'
|
|
59
|
-
)
|
|
60
|
-
assert.ok(
|
|
61
|
-
fs.existsSync(path.resolve(appPath, 'README.md')),
|
|
62
|
-
'skeleton was copied'
|
|
63
|
-
)
|
|
64
|
-
assert.ok(fs.existsSync(path.resolve(appPath, '.env')), 'Env was copied')
|
|
65
|
-
|
|
66
|
-
const pack = JSON.parse(
|
|
67
|
-
fs.readFileSync(path.resolve(appPath, 'package.json'), {
|
|
68
|
-
encoding: 'utf-8'
|
|
69
|
-
})
|
|
70
|
-
)
|
|
71
|
-
assert.ok(
|
|
72
|
-
pack.name !== 'new-fastify-app',
|
|
73
|
-
'package.json was not just copied from skeleton'
|
|
74
|
-
)
|
|
75
|
-
assert.ok(
|
|
76
|
-
pack.main === 'app/server.js',
|
|
77
|
-
'package.json was correctly enriched with data'
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
done()
|
|
81
|
-
})
|
|
82
|
-
})
|
package/test/setup.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
import { exec } from 'child_process'
|
|
4
|
-
import { fileURLToPath } from 'url'
|
|
5
|
-
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
7
|
-
|
|
8
|
-
export const cwd = path.resolve(__dirname, './_arena/')
|
|
9
|
-
|
|
10
|
-
export const cli = (args) => {
|
|
11
|
-
return new Promise((resolve) => {
|
|
12
|
-
exec(
|
|
13
|
-
`node ${path.resolve(__dirname, '../bin/cli.js')} ${args.join(' ')}`,
|
|
14
|
-
{ cwd },
|
|
15
|
-
(error, stdout, stderr) => {
|
|
16
|
-
resolve({
|
|
17
|
-
code: error && error.code ? error.code : 0,
|
|
18
|
-
error,
|
|
19
|
-
stdout,
|
|
20
|
-
stderr
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const before = () => {
|
|
28
|
-
fs.ensureDirSync(cwd)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const after = () => {
|
|
32
|
-
fs.removeSync(cwd)
|
|
33
|
-
}
|