@temir.ra/create-template 0.5.5 → 0.6.1

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,166 +1,162 @@
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
- `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.npmjs.org/
99
- npm login
100
- # or custom registry
101
- export <REGISTRY_AUTH_TOKEN_ENV_VAR>=<AUTH_TOKEN>
102
- # or
103
- $env:<REGISTRY_AUTH_TOKEN_ENV_VAR> = "<AUTH_TOKEN>"
104
- npm publish
105
- ```
106
-
107
- ## CI/CD Workflows
108
-
109
- ## Build and Publish to a custom registry
110
-
111
- ⚠️ `.npmrc` configuring the custom registry and its authentication token must be present in the repository for the workflow to work.
112
-
113
- |Parameter|Type|Description|
114
- |-----|-----|-----|
115
- |`RUNNER_LABEL`|Variable|The label of the runner to use for the workflow.|
116
- |`ACCESS_TOKEN`|Secret|The authentication token for the custom registry.|
117
-
118
- ```bash
119
- # placeholder:
120
- # <REGISTRY_AUTH_TOKEN_ENV_VAR: <REGISTRY_AUTH_TOKEN_ENV_VAR>
121
- ```
122
-
123
- `.github/workflows/build-publish.yml`:
124
-
125
- ```yaml
126
- name: Build and Publish
127
-
128
- on:
129
- push:
130
- branches:
131
- - main
132
-
133
- jobs:
134
- publish:
135
- runs-on: ${{ vars.RUNNER_LABEL }}
136
- steps:
137
- - uses: actions/checkout@v4
138
-
139
- - name: Install
140
- env:
141
- <REGISTRY_AUTH_TOKEN_ENV_VAR>: ${{ secrets.ACCESS_TOKEN }}
142
- # run: npm ci
143
- run: npm install
144
-
145
- - name: Build
146
- run: npm run build
147
-
148
- - name: Test
149
- run: npm run tests
150
-
151
- - name: Publish
152
- env:
153
- <REGISTRY_AUTH_TOKEN_ENV_VAR>: ${{ secrets.ACCESS_TOKEN }}
154
- run: |
155
- PKG_NAME=$(node -p "require('./package.json').name")
156
- PKG_VERSION=$(node -p "require('./package.json').version")
157
- NPM_TAG="latest"
158
- if echo "$PKG_VERSION" | grep -q -- '-'; then
159
- NPM_TAG="next"
160
- fi
161
- if npm view "$PKG_NAME@$PKG_VERSION" version >/dev/null 2>&1; then
162
- echo "$PKG_NAME@$PKG_VERSION already published, skipping."
163
- else
164
- npm publish --tag "$NPM_TAG"
165
- fi
166
- ```
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
+ # registry.npmjs.org/
78
+ # forgejo.example.com/api/packages/<SCOPE_WITHOUT_AT>/npm/
79
+ # <REGISTRY_AUTH_TOKEN_ENV_VAR: <REGISTRY_AUTH_TOKEN_ENV_VAR>
80
+ ```
81
+
82
+ `.npmrc`:
83
+
84
+ ```ini
85
+ @<SCOPE_WITHOUT_AT>:registry=https://<REGISTRY_ORIGIN_AND_PATH>
86
+ //<REGISTRY_ORIGIN_AND_PATH>:_authToken=${<REGISTRY_AUTH_TOKEN_ENV_VAR>}
87
+ ```
88
+
89
+ or `bunfig.toml`:
90
+
91
+ ```toml
92
+ [install.scopes]
93
+ "<SCOPE_WITHOUT_AT>" = { url = "https://<REGISTRY_ORIGIN_AND_PATH>", token = "$<REGISTRY_AUTH_TOKEN_ENV_VAR>" }
94
+ ```
95
+
96
+ ```bash
97
+ # <REGISTRY_ORIGIN_AND_PATH>
98
+ export <REGISTRY_AUTH_TOKEN_ENV_VAR>=<AUTH_TOKEN>
99
+ # or
100
+ $env:<REGISTRY_AUTH_TOKEN_ENV_VAR> = "<AUTH_TOKEN>"
101
+ npm publish
102
+ ```
103
+
104
+ ## CI/CD Workflows
105
+
106
+ ### NPM Build and Publish
107
+
108
+ ⚠️ `.npmrc` configuring the package registry and its authentication token is required for the workflow to work.
109
+
110
+ |Parameter|Type|Description|
111
+ |-----|-----|-----|
112
+ |`NPM_RUNNER_LABEL`|Variable|The label of the runner to use for the workflow.|
113
+ |`NPM_ACCESS_TOKEN`|Secret|The authentication token for the package registry.|
114
+
115
+ ```bash
116
+ # placeholder:
117
+ # <REGISTRY_AUTH_TOKEN_ENV_VAR: <REGISTRY_AUTH_TOKEN_ENV_VAR>
118
+ ```
119
+
120
+ `.github/workflows/npm-build-publish.yml`:
121
+
122
+ ```yaml
123
+ name: NPM Build and Publish
124
+
125
+ on:
126
+ push:
127
+ branches:
128
+ - main
129
+
130
+ jobs:
131
+ publish:
132
+ runs-on: ${{ vars.NPM_RUNNER_LABEL }}
133
+ steps:
134
+ - uses: actions/checkout@v4
135
+
136
+ - name: Install
137
+ env:
138
+ <REGISTRY_AUTH_TOKEN_ENV_VAR>: ${{ secrets.NPM_ACCESS_TOKEN }}
139
+ run: npm ci
140
+
141
+ - name: Build
142
+ run: npm run build
143
+
144
+ - name: Test
145
+ run: npm run tests
146
+
147
+ - name: Publish
148
+ env:
149
+ <REGISTRY_AUTH_TOKEN_ENV_VAR>: ${{ secrets.NPM_ACCESS_TOKEN }}
150
+ run: |
151
+ PKG_NAME=$(node -p "require('./package.json').name")
152
+ PKG_VERSION=$(node -p "require('./package.json').version")
153
+ NPM_TAG="latest"
154
+ if echo "$PKG_VERSION" | grep -q -- '-'; then
155
+ NPM_TAG="next"
156
+ fi
157
+ if npm view "$PKG_NAME@$PKG_VERSION" version >/dev/null 2>&1; then
158
+ echo "$PKG_NAME@$PKG_VERSION already published, skipping."
159
+ else
160
+ npm publish --tag "$NPM_TAG"
161
+ fi
162
+ ```
@@ -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
+ "<BINARY_NAME>": "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
  }