File tree 5 files changed +191
-0
lines changed
5 files changed +191
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ This table summarizes each block and which base levels they're included in:
33
33
| Knip | ` --exclude-knip ` | | | 💯 |
34
34
| Markdownlint | ` --exclude-markdownlint ` | | | 💯 |
35
35
| MIT License | ` --exclude-mit-license ` | ✔️ | ✅ | 💯 |
36
+ | ncc | ` --exclude-ncc ` | | | |
36
37
| nvmrc | ` --exclude-nvmrc ` | | | 💯 |
37
38
| Package JSON | ` --exclude-package-json ` | ✔️ | ✅ | 💯 |
38
39
| pnpm Dedupe | ` --exclude-pnpm-dedupe ` | | | 💯 |
Original file line number Diff line number Diff line change
1
+ import { testBlock } from "bingo-stratum-testers" ;
2
+ import { describe , expect , test } from "vitest" ;
3
+
4
+ import { blockNcc } from "./blockNcc.js" ;
5
+ import { optionsBase } from "./options.fakes.js" ;
6
+
7
+ describe ( "blockNcc" , ( ) => {
8
+ test ( "production" , ( ) => {
9
+ const creation = testBlock ( blockNcc , {
10
+ options : optionsBase ,
11
+ } ) ;
12
+
13
+ expect ( creation ) . toMatchInlineSnapshot ( `
14
+ {
15
+ "addons": [
16
+ {
17
+ "addons": {
18
+ "ignores": [
19
+ "dist",
20
+ ],
21
+ },
22
+ "block": [Function],
23
+ },
24
+ {
25
+ "addons": {
26
+ "sections": {
27
+ "Building": {
28
+ "contents": "
29
+ Run [TypeScript](https://typescriptlang.org) locally to type check and build source files from \`src/\` into output files in \`lib/\`:
30
+
31
+ \`\`\`shell
32
+ pnpm build
33
+ \`\`\`
34
+
35
+ Add \`--watch\` to run the builder in a watch mode that continuously cleans and recreates \`lib/\` as you save files:
36
+
37
+ \`\`\`shell
38
+ pnpm build --watch
39
+ \`\`\`
40
+ ",
41
+ "innerSections": [
42
+ {
43
+ "contents": "
44
+ Run [\`@vercel/ncc\`](https://github.com/vercel/ncc) to create an output \`dist/\` to be used in production.
45
+
46
+ \`\`\`shell
47
+ pnpm build:release
48
+ \`\`\`
49
+ ",
50
+ "heading": "Building for Release",
51
+ },
52
+ ],
53
+ },
54
+ },
55
+ },
56
+ "block": [Function],
57
+ },
58
+ {
59
+ "addons": {
60
+ "ignores": [
61
+ "dist",
62
+ ],
63
+ },
64
+ "block": [Function],
65
+ },
66
+ {
67
+ "addons": {
68
+ "jobs": [
69
+ {
70
+ "name": "Build",
71
+ "steps": [
72
+ {
73
+ "run": "pnpm build",
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ "name": "Build (Release)",
79
+ "steps": [
80
+ {
81
+ "run": "pnpm build:release",
82
+ },
83
+ ],
84
+ },
85
+ ],
86
+ },
87
+ "block": [Function],
88
+ },
89
+ {
90
+ "addons": {
91
+ "properties": {
92
+ "devDependencies": {
93
+ "@vercel/ncc": "^0.38.3",
94
+ },
95
+ "scripts": {
96
+ "build": "tsc",
97
+ "build:release": "ncc build src/index.ts -o dist",
98
+ },
99
+ },
100
+ },
101
+ "block": [Function],
102
+ },
103
+ ],
104
+ }
105
+ ` ) ;
106
+ } ) ;
107
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { base } from "../base.js" ;
2
+ import { blockCSpell } from "./blockCSpell.js" ;
3
+ import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js" ;
4
+ import { blockESLint } from "./blockESLint.js" ;
5
+ import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js" ;
6
+ import { blockPackageJson } from "./blockPackageJson.js" ;
7
+
8
+ export const blockNcc = base . createBlock ( {
9
+ about : {
10
+ name : "ncc" ,
11
+ } ,
12
+ produce ( ) {
13
+ return {
14
+ addons : [
15
+ blockCSpell ( {
16
+ ignores : [ "dist" ] ,
17
+ } ) ,
18
+ blockDevelopmentDocs ( {
19
+ sections : {
20
+ Building : {
21
+ contents : `
22
+ Run [TypeScript](https://typescriptlang.org) locally to type check and build source files from \`src/\` into output files in \`lib/\`:
23
+
24
+ \`\`\`shell
25
+ pnpm build
26
+ \`\`\`
27
+
28
+ Add \`--watch\` to run the builder in a watch mode that continuously cleans and recreates \`lib/\` as you save files:
29
+
30
+ \`\`\`shell
31
+ pnpm build --watch
32
+ \`\`\`
33
+ ` ,
34
+ innerSections : [
35
+ {
36
+ contents : `
37
+ Run [\`@vercel/ncc\`](https://github.com/vercel/ncc) to create an output \`dist/\` to be used in production.
38
+
39
+ \`\`\`shell
40
+ pnpm build:release
41
+ \`\`\`
42
+ ` ,
43
+ heading : "Building for Release" ,
44
+ } ,
45
+ ] ,
46
+ } ,
47
+ } ,
48
+ } ) ,
49
+ blockESLint ( {
50
+ ignores : [ "dist" ] ,
51
+ } ) ,
52
+ blockGitHubActionsCI ( {
53
+ jobs : [
54
+ {
55
+ name : "Build" ,
56
+ steps : [ { run : "pnpm build" } ] ,
57
+ } ,
58
+ {
59
+ name : "Build (Release)" ,
60
+ steps : [ { run : "pnpm build:release" } ] ,
61
+ } ,
62
+ ] ,
63
+ } ) ,
64
+ blockPackageJson ( {
65
+ properties : {
66
+ devDependencies : {
67
+ "@vercel/ncc" : "^0.38.3" ,
68
+ } ,
69
+ scripts : {
70
+ build : "tsc" ,
71
+ "build:release" : "ncc build src/index.ts -o dist" ,
72
+ } ,
73
+ } ,
74
+ } ) ,
75
+ ] ,
76
+ } ;
77
+ } ,
78
+ } ) ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import { blockGitignore } from "./blockGitignore.js";
24
24
import { blockKnip } from "./blockKnip.js" ;
25
25
import { blockMarkdownlint } from "./blockMarkdownlint.js" ;
26
26
import { blockMITLicense } from "./blockMITLicense.js" ;
27
+ import { blockNcc } from "./blockNcc.js" ;
27
28
import { blockNvmrc } from "./blockNvmrc.js" ;
28
29
import { blockPackageJson } from "./blockPackageJson.js" ;
29
30
import { blockPnpmDedupe } from "./blockPnpmDedupe.js" ;
@@ -69,6 +70,7 @@ export const blocks = {
69
70
blockKnip,
70
71
blockMarkdownlint,
71
72
blockMITLicense,
73
+ blockNcc,
72
74
blockNvmrc,
73
75
blockPackageJson,
74
76
blockPnpmDedupe,
@@ -115,6 +117,7 @@ export { blockGitignore } from "./blockGitignore.js";
115
117
export { blockKnip } from "./blockKnip.js" ;
116
118
export { blockMarkdownlint } from "./blockMarkdownlint.js" ;
117
119
export { blockMITLicense } from "./blockMITLicense.js" ;
120
+ export { blockNcc } from "./blockNcc.js" ;
118
121
export { blockNvmrc } from "./blockNvmrc.js" ;
119
122
export { blockPackageJson } from "./blockPackageJson.js" ;
120
123
export { blockPnpmDedupe } from "./blockPnpmDedupe.js" ;
Original file line number Diff line number Diff line change 1
1
import { base } from "./base.js" ;
2
2
import { blockAreTheTypesWrong } from "./blocks/blockAreTheTypesWrong.js" ;
3
3
import { blockCTATransitions } from "./blocks/blockCTATransitions.js" ;
4
+ import { blockNcc } from "./blocks/blockNcc.js" ;
4
5
import { blockRemoveDependencies } from "./blocks/blockRemoveDependencies.js" ;
5
6
import { blockRemoveFiles } from "./blocks/blockRemoveFiles.js" ;
6
7
import { presetCommon } from "./presets/common.js" ;
@@ -18,6 +19,7 @@ export const template = base.createStratumTemplate({
18
19
blocks : [
19
20
blockAreTheTypesWrong ,
20
21
blockCTATransitions ,
22
+ blockNcc ,
21
23
blockRemoveDependencies ,
22
24
blockRemoveFiles ,
23
25
] ,
You can’t perform that action at this time.
0 commit comments