@temir.ra/create-template 0.5.4 → 0.6.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.
@@ -1,94 +1,163 @@
1
- # Introduction
2
-
3
- This template scaffolds a ...
4
-
5
- ## Table of Contents
6
-
7
- 1. [Quick Start](#quick-start)
8
- 2. [Documentation](#documentation)
9
- 3. [DevOps](#devops)
10
- 1. [Change Management](#change-management)
11
- 2. [Publish](#publish)
12
-
13
- # Quick Start
14
-
15
- ```bash
16
- # placeholder:
17
- # <TEMPLATE_PACKAGE_NAME: <TEMPLATE_PACKAGE_NAME>
18
- # <TEMPLATE_NAME: <TEMPLATE_NAME>
19
-
20
- # print the latest version
21
- npm info "<TEMPLATE_PACKAGE_NAME>" version
22
-
23
- # create/update a package from the template in the current directory
24
- npm create --no-install --no-git "<TEMPLATE_NAME>@latest" .
25
-
26
- # set metadata in package.json
27
-
28
- npm update
29
- ```
30
-
31
- # Documentation
32
-
33
- The following sections explain the configurations and conventions baked into the generated package. Useful when adapting it to fit specific needs.
34
-
35
- *&lt;DOCUMENTATION&gt;*
36
-
37
- # DevOps
38
-
39
- ```bash
40
- npm install
41
- npm update
42
-
43
- npm run clean
44
- npm run build
45
- npm run tests
46
-
47
- npx tsx dist/cli.bundle.js -- example/
48
- ```
49
-
50
- ## Change Management
51
-
52
- 1. Create a new branch for the change.
53
- 2. Make the changes and commit.
54
- 3. Bump the version in [`package.json`](package.json).
55
- 4. Add an entry for the new version in [`CHANGELOG.md`](CHANGELOG.md).
56
- 5. Pull-request the branch.
57
- 6. Ensure package artifacts are current.
58
- 7. Publish.
59
-
60
- ## Publish
61
-
62
- ```bash
63
- # placeholder:
64
- # <SCOPE_WITHOUT_AT: <SCOPE_WITHOUT_AT>
65
- # <REGISTRY_ORIGIN_AND_PATH: <REGISTRY_ORIGIN_AND_PATH>
66
- # e.g.
67
- # registry.npmjs.org/
68
- # forgejo.example.com/api/packages/<SCOPE_WITHOUT_AT>/npm/
69
- # <REGISTRY_AUTH_TOKEN_ENV_VAR: <REGISTRY_AUTH_TOKEN_ENV_VAR>
70
- ```
71
-
72
- `~/.npmrc` or `.npmrc`:
73
-
74
- ```ini
75
- @<SCOPE_WITHOUT_AT>:registry=https://<REGISTRY_ORIGIN_AND_PATH>
76
- //<REGISTRY_ORIGIN_AND_PATH>:_authToken=${<REGISTRY_AUTH_TOKEN_ENV_VAR>}
77
- ```
78
-
79
- `~/.bunfig.toml` or `bunfig.toml`:
80
-
81
- ```toml
82
- [install.scopes]
83
- "<SCOPE_WITHOUT_AT>" = { url = "https://<REGISTRY_ORIGIN_AND_PATH>", token = "$<REGISTRY_AUTH_TOKEN_ENV_VAR>" }
84
- ```
85
-
86
- ```bash
87
- # registry.npmjs.org/
88
- npm login
89
- # or custom registry
90
- export <REGISTRY_AUTH_TOKEN_ENV_VAR>=<AUTH_TOKEN>
91
- # or
92
- $env:<REGISTRY_AUTH_TOKEN_ENV_VAR> = "<AUTH_TOKEN>"
93
- npm publish
94
- ```
1
+ # Introduction
2
+
3
+ This template scaffolds a ...
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Quick Start](#quick-start)
8
+ 2. [Documentation](#documentation)
9
+ 3. [DevOps](#devops)
10
+ 1. [Change Management](#change-management)
11
+ 2. [Registry](#registry)
12
+ 3. [CI/CD Workflows](#cicd-workflows)
13
+
14
+ # Quick Start
15
+
16
+ ```bash
17
+ # placeholder:
18
+ # <TEMPLATE_PACKAGE_NAME: <TEMPLATE_PACKAGE_NAME>
19
+ # <TEMPLATE_NAME: <TEMPLATE_NAME>
20
+
21
+ # print the latest version
22
+ npm info "<TEMPLATE_PACKAGE_NAME>" version
23
+
24
+ # create/update a package from the template in the current directory
25
+ npm create --no-install --no-git "<TEMPLATE_NAME>@latest" .
26
+
27
+ # set metadata in package.json
28
+
29
+ npm update
30
+ ```
31
+
32
+ # Documentation
33
+
34
+ The following sections explain the configurations and conventions baked into the generated package. Useful when adapting it to fit specific needs.
35
+
36
+ *&lt;DOCUMENTATION&gt;*
37
+
38
+ # DevOps
39
+
40
+ ```bash
41
+ npm install
42
+ npm update
43
+
44
+ npm run clean
45
+ npm run build
46
+ npm run tests
47
+
48
+ npx tsx dist/cli.bundle.js -- example/
49
+ ```
50
+
51
+ ```bash
52
+ git fetch upstream
53
+ git fetch origin
54
+ git fetch . upstream/main:origin/main
55
+ git fetch . origin/main:main
56
+ git push origin main
57
+ git merge --ff-only main
58
+ git push
59
+ ```
60
+
61
+ ## Change Management
62
+
63
+ 1. Create a new branch for the change.
64
+ 2. Make the changes and commit.
65
+ 3. Bump the version in [`package.json`](package.json).
66
+ 4. Add an entry for the new version in [`CHANGELOG.md`](CHANGELOG.md).
67
+ 5. Pull-request the branch.
68
+ 6. Ensure package artifacts are current.
69
+ 7. Publish.
70
+
71
+ ## Registry
72
+
73
+ ```bash
74
+ # placeholder:
75
+ # <SCOPE_WITHOUT_AT: <SCOPE_WITHOUT_AT>
76
+ # <REGISTRY_ORIGIN_AND_PATH: <REGISTRY_ORIGIN_AND_PATH>
77
+ # e.g.
78
+ # registry.npmjs.org/
79
+ # forgejo.example.com/api/packages/<SCOPE_WITHOUT_AT>/npm/
80
+ # <REGISTRY_AUTH_TOKEN_ENV_VAR: <REGISTRY_AUTH_TOKEN_ENV_VAR>
81
+ ```
82
+
83
+ `.npmrc`:
84
+
85
+ ```ini
86
+ @<SCOPE_WITHOUT_AT>:registry=https://<REGISTRY_ORIGIN_AND_PATH>
87
+ //<REGISTRY_ORIGIN_AND_PATH>:_authToken=${<REGISTRY_AUTH_TOKEN_ENV_VAR>}
88
+ ```
89
+
90
+ or `bunfig.toml`:
91
+
92
+ ```toml
93
+ [install.scopes]
94
+ "<SCOPE_WITHOUT_AT>" = { url = "https://<REGISTRY_ORIGIN_AND_PATH>", token = "$<REGISTRY_AUTH_TOKEN_ENV_VAR>" }
95
+ ```
96
+
97
+ ```bash
98
+ # <REGISTRY_ORIGIN_AND_PATH>
99
+ export <REGISTRY_AUTH_TOKEN_ENV_VAR>=<AUTH_TOKEN>
100
+ # or
101
+ $env:<REGISTRY_AUTH_TOKEN_ENV_VAR> = "<AUTH_TOKEN>"
102
+ npm publish
103
+ ```
104
+
105
+ ## CI/CD Workflows
106
+
107
+ ### Build and Publish
108
+
109
+ ⚠️ `.npmrc` configuring the package registry and its authentication token is required for the workflow to work.
110
+
111
+ |Parameter|Type|Description|
112
+ |-----|-----|-----|
113
+ |`RUNNER_LABEL`|Variable|The label of the runner to use for the workflow.|
114
+ |`ACCESS_TOKEN`|Secret|The authentication token for the package registry.|
115
+
116
+ ```bash
117
+ # placeholder:
118
+ # <REGISTRY_AUTH_TOKEN_ENV_VAR: <REGISTRY_AUTH_TOKEN_ENV_VAR>
119
+ ```
120
+
121
+ `.github/workflows/build-publish.yml`:
122
+
123
+ ```yaml
124
+ name: Build and Publish
125
+
126
+ on:
127
+ push:
128
+ branches:
129
+ - main
130
+
131
+ jobs:
132
+ publish:
133
+ runs-on: ${{ vars.RUNNER_LABEL }}
134
+ steps:
135
+ - uses: actions/checkout@v4
136
+
137
+ - name: Install
138
+ env:
139
+ <REGISTRY_AUTH_TOKEN_ENV_VAR>: ${{ secrets.ACCESS_TOKEN }}
140
+ run: npm ci
141
+
142
+ - name: Build
143
+ run: npm run build
144
+
145
+ - name: Test
146
+ run: npm run tests
147
+
148
+ - name: Publish
149
+ env:
150
+ <REGISTRY_AUTH_TOKEN_ENV_VAR>: ${{ secrets.ACCESS_TOKEN }}
151
+ run: |
152
+ PKG_NAME=$(node -p "require('./package.json').name")
153
+ PKG_VERSION=$(node -p "require('./package.json').version")
154
+ NPM_TAG="latest"
155
+ if echo "$PKG_VERSION" | grep -q -- '-'; then
156
+ NPM_TAG="next"
157
+ fi
158
+ if npm view "$PKG_NAME@$PKG_VERSION" version >/dev/null 2>&1; then
159
+ echo "$PKG_NAME@$PKG_VERSION already published, skipping."
160
+ else
161
+ npm publish --tag "$NPM_TAG"
162
+ fi
163
+ ```
@@ -1,8 +1,8 @@
1
- node_modules
2
- buildinfo.txt
3
- buildinfo-template.txt
4
- CHANGELOG-template.md
5
- README-template.md
6
- *.tsbuildinfo
7
- dist/
8
- example/
1
+ node_modules
2
+ buildinfo.txt
3
+ buildinfo-template.txt
4
+ CHANGELOG-template.md
5
+ README-template.md
6
+ *.tsbuildinfo
7
+ dist/
8
+ example/
@@ -1,47 +1,52 @@
1
- {
2
- "name": "",
3
- "version": "0.0.0",
4
- "description": "A template for ...",
5
- "private": false,
6
- "keywords": [
7
- "typescript",
8
- "template"
9
- ],
10
- "author": "",
11
- "license": "",
12
- "repository": {
13
- "type": "git",
14
- "url": ""
15
- },
16
- "type": "module",
17
- "files": [
18
- "dist/"
19
- ],
20
- "bin": "./dist/cli.bundle.js",
21
- "exports": {
22
- ".": {
23
- "entrypoint": "./src/cli.ts"
24
- }
25
- },
26
- "imports": {
27
- "#src/*.js": "./src/*.ts"
28
- },
29
- "scripts": {
30
- "reinstall": "rm -rf node_modules && rm -f package-lock.json bun.lock yarn.lock pnpm-lock.yaml && npm install",
31
- "typecheck": "tsc --noEmit",
32
- "buildinfo": "tsx scripts/buildinfo.ts",
33
- "clean:dist": "rm -rf dist/",
34
- "clean:tsbuildinfo": "rm -f tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
35
- "clean": "npm run clean:dist && npm run clean:tsbuildinfo",
36
- "tests": "node --import tsx --test tests/**/*.test.ts",
37
- "prebuild": "npm run buildinfo",
38
- "build": "npm run build:bundle",
39
- "build:bundle": "tsx scripts/build-bundle.ts -- --omit-iife"
40
- },
41
- "devDependencies": {
42
- "@types/node": "latest",
43
- "esbuild": "latest",
44
- "tsx": "latest",
45
- "typescript": "^6.0.3"
46
- }
1
+ {
2
+ "name": "",
3
+ "version": "0.0.0",
4
+ "description": "A template for ...",
5
+ "private": false,
6
+ "keywords": [
7
+ "typescript",
8
+ "template"
9
+ ],
10
+ "author": "",
11
+ "license": "",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": ""
15
+ },
16
+ "type": "module",
17
+ "files": [
18
+ "dist/"
19
+ ],
20
+ "bin": {
21
+ "create-template": "dist/cli.bundle.js"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "entrypoint": "./src/cli.ts"
26
+ }
27
+ },
28
+ "imports": {
29
+ "#src/*.js": "./src/*.ts"
30
+ },
31
+ "scripts": {
32
+ "reinstall": "rm -rf node_modules && rm -f package-lock.json bun.lock yarn.lock pnpm-lock.yaml && npm install",
33
+ "typecheck": "tsc --noEmit",
34
+ "buildinfo": "tsx scripts/buildinfo.ts",
35
+ "clean:dist": "rm -rf dist/",
36
+ "clean:tsbuildinfo": "rm -f tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
37
+ "clean": "npm run clean:dist && npm run clean:tsbuildinfo",
38
+ "tests": "node --import tsx --test \"tests/**/*.test.ts\"",
39
+ "prebuild": "npm run buildinfo",
40
+ "build": "npm run build:bundle",
41
+ "build:bundle": "tsx scripts/build-bundle.ts -- --omit-iife"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "latest",
45
+ "esbuild": "latest",
46
+ "tsx": "latest",
47
+ "typescript": "^6.0.3"
48
+ },
49
+ "allowScripts": {
50
+ "esbuild": true
51
+ }
47
52
  }