@temir.ra/create-oci-compose 0.1.0-pre.2
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/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/CHANGELOG.md +5 -0
- package/dist/buildinfo-template.txt +1 -0
- package/dist/buildinfo.txt +1 -0
- package/dist/cli.bundle.js +2 -0
- package/dist/cli.bundle.js.map +7 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Temir Ra
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
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: @temir.ra/create-oci-compose
|
|
19
|
+
# <TEMPLATE_NAME: @temir.ra/oci-compose
|
|
20
|
+
|
|
21
|
+
# print the latest version
|
|
22
|
+
npm info "@temir.ra/create-oci-compose" version
|
|
23
|
+
|
|
24
|
+
# create/update a package from the template in the current directory
|
|
25
|
+
npm create --no-install --no-git "@temir.ra/oci-compose@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
|
+
*<DOCUMENTATION>*
|
|
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
|
+
`.npmrc`:
|
|
74
|
+
|
|
75
|
+
```ini
|
|
76
|
+
@temir.ra:registry=https://registry.npmjs.org/
|
|
77
|
+
//registry.npmjs.org/:_authToken=${NPMJSORG_REGISTRY_AUTH_TOKEN}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
or `bunfig.toml`:
|
|
81
|
+
|
|
82
|
+
```toml
|
|
83
|
+
[install.scopes]
|
|
84
|
+
"temir.ra" = { url = "https://registry.npmjs.org/", token = "$NPMJSORG_REGISTRY_AUTH_TOKEN" }
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# registry.npmjs.org/
|
|
89
|
+
export NPMJSORG_REGISTRY_AUTH_TOKEN=<AUTH_TOKEN>
|
|
90
|
+
# or
|
|
91
|
+
$env:NPMJSORG_REGISTRY_AUTH_TOKEN = "<AUTH_TOKEN>"
|
|
92
|
+
npm publish
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## CI/CD Workflows
|
|
96
|
+
|
|
97
|
+
### Build and Publish
|
|
98
|
+
|
|
99
|
+
⚠️ `.npmrc` configuring the package registry and its authentication token is required for the workflow to work.
|
|
100
|
+
|
|
101
|
+
|Parameter|Type|Description|
|
|
102
|
+
|-----|-----|-----|
|
|
103
|
+
|`RUNNER_LABEL`|Variable|The label of the runner to use for the workflow.|
|
|
104
|
+
|`ACCESS_TOKEN`|Secret|The authentication token for the package registry.|
|
|
105
|
+
|
|
106
|
+
`.github/workflows/build-publish.yml`:
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
name: Build and Publish
|
|
110
|
+
|
|
111
|
+
on:
|
|
112
|
+
push:
|
|
113
|
+
branches:
|
|
114
|
+
- main
|
|
115
|
+
|
|
116
|
+
jobs:
|
|
117
|
+
publish:
|
|
118
|
+
runs-on: ${{ vars.RUNNER_LABEL }}
|
|
119
|
+
steps:
|
|
120
|
+
- uses: actions/checkout@v4
|
|
121
|
+
|
|
122
|
+
- name: Install
|
|
123
|
+
env:
|
|
124
|
+
NPMJSORG_REGISTRY_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
125
|
+
run: npm ci
|
|
126
|
+
|
|
127
|
+
- name: Build
|
|
128
|
+
run: npm run build
|
|
129
|
+
|
|
130
|
+
- name: Test
|
|
131
|
+
run: npm run tests
|
|
132
|
+
|
|
133
|
+
- name: Publish
|
|
134
|
+
env:
|
|
135
|
+
NPMJSORG_REGISTRY_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
136
|
+
run: |
|
|
137
|
+
PKG_NAME=$(node -p "require('./package.json').name")
|
|
138
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
139
|
+
NPM_TAG="latest"
|
|
140
|
+
if echo "$PKG_VERSION" | grep -q -- '-'; then
|
|
141
|
+
NPM_TAG="next"
|
|
142
|
+
fi
|
|
143
|
+
if npm view "$PKG_NAME@$PKG_VERSION" version >/dev/null 2>&1; then
|
|
144
|
+
echo "$PKG_NAME@$PKG_VERSION already published, skipping."
|
|
145
|
+
else
|
|
146
|
+
npm publish --tag "$NPM_TAG"
|
|
147
|
+
fi
|
|
148
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.6.0+35a0356
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0-pre.2+81de98f
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{cpSync as n,readFileSync as U,renameSync as d,writeFileSync as u}from"node:fs";import{resolve as r}from"node:path";var i=new URL("../",import.meta.url),a=new URL("dist/",i),l=new URL("buildinfo.txt",a),m=new URL("CHANGELOG.md",a),p=new URL("README.md",i),g=new URL("template/",a);try{let t=process.argv[2];if(!t)throw new Error('First argument must be the package name (e.g. "my-package" or "@my-scope/my-package").');let o=t.replace(/\\/g,"/"),e=r(process.cwd(),o);n(g,e,{recursive:!0}),n(m,r(e,"CHANGELOG-template.md")),n(l,r(e,"buildinfo-template.txt")),n(p,r(e,"README-template.md"));let c=r(e,"package.json"),s=JSON.parse(U(c,"utf-8"));s.name=o,u(c,JSON.stringify(s,null,2)),d(r(e,"gitignore"),r(e,".gitignore")),console.log(`Template has been successfully instantiated at '${e}' with package name '${o}'.`)}catch(t){let o=t instanceof Error?t:new Error(String(t));console.error("Error:",o.message),process.exit(1)}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli.ts", "../src/package-urls.ts"],
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport {\n templateUrl,\n changelogUrl,\n buildinfoUrl,\n readmeUrl\n} from './package-urls.js';\n\n\ntry {\n\n const packageNameArgument = process.argv[2];\n if (!packageNameArgument)\n throw new Error('First argument must be the package name (e.g. \"my-package\" or \"@my-scope/my-package\").');\n const packageName = packageNameArgument.replace(/\\\\/g, '/');\n\n const destinationPath = resolve(process.cwd(), packageName);\n\n cpSync(templateUrl, destinationPath, { recursive: true });\n cpSync(changelogUrl, resolve(destinationPath, 'CHANGELOG-template.md'));\n cpSync(buildinfoUrl, resolve(destinationPath, 'buildinfo-template.txt'));\n cpSync(readmeUrl, resolve(destinationPath, 'README-template.md'));\n\n const packageJsonPath = resolve(destinationPath, 'package.json');\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n packageJson.name = packageName;\n writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));\n\n renameSync(resolve(destinationPath, 'gitignore'), resolve(destinationPath, '.gitignore'));\n\n console.log(`Template has been successfully instantiated at '${destinationPath}' with package name '${packageName}'.`);\n\n}\ncatch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n console.error('Error:', err.message);\n process.exit(1);\n}\n", "export const packageUrl: URL = new URL('../', import.meta.url);\n\nexport const distUrl: URL = new URL('dist/', packageUrl);\nexport const buildinfoUrl: URL = new URL('buildinfo.txt', distUrl);\nexport const changelogUrl: URL = new URL('CHANGELOG.md', distUrl);\nexport const readmeUrl: URL = new URL('README.md', packageUrl);\n\nexport const templateUrl: URL = new URL('template/', distUrl);\n"],
|
|
5
|
+
"mappings": ";AAEA,OAAS,UAAAA,EAAQ,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,UAChE,OAAS,WAAAC,MAAe,YCHjB,IAAMC,EAAkB,IAAI,IAAI,MAAO,YAAY,GAAG,EAEhDC,EAAe,IAAI,IAAI,QAASD,CAAU,EAC1CE,EAAoB,IAAI,IAAI,gBAAiBD,CAAO,EACpDE,EAAoB,IAAI,IAAI,eAAgBF,CAAO,EACnDG,EAAiB,IAAI,IAAI,YAAaJ,CAAU,EAEhDK,EAAmB,IAAI,IAAI,YAAaJ,CAAO,EDK5D,GAAI,CAEA,IAAMK,EAAsB,QAAQ,KAAK,CAAC,EAC1C,GAAI,CAACA,EACD,MAAM,IAAI,MAAM,wFAAwF,EAC5G,IAAMC,EAAcD,EAAoB,QAAQ,MAAO,GAAG,EAEpDE,EAAkBC,EAAQ,QAAQ,IAAI,EAAGF,CAAW,EAE1DG,EAAOC,EAAaH,EAAiB,CAAE,UAAW,EAAK,CAAC,EACxDE,EAAOE,EAAcH,EAAQD,EAAiB,uBAAuB,CAAC,EACtEE,EAAOG,EAAcJ,EAAQD,EAAiB,wBAAwB,CAAC,EACvEE,EAAOI,EAAWL,EAAQD,EAAiB,oBAAoB,CAAC,EAEhE,IAAMO,EAAkBN,EAAQD,EAAiB,cAAc,EACzDQ,EAAc,KAAK,MAAMC,EAAaF,EAAiB,OAAO,CAAC,EACrEC,EAAY,KAAOT,EACnBW,EAAcH,EAAiB,KAAK,UAAUC,EAAa,KAAM,CAAC,CAAC,EAEnEG,EAAWV,EAAQD,EAAiB,WAAW,EAAGC,EAAQD,EAAiB,YAAY,CAAC,EAExF,QAAQ,IAAI,mDAAmDA,CAAe,wBAAwBD,CAAW,IAAI,CAEzH,OACOa,EAAO,CACV,IAAMC,EAAMD,aAAiB,MAAQA,EAAQ,IAAI,MAAM,OAAOA,CAAK,CAAC,EACpE,QAAQ,MAAM,SAAUC,EAAI,OAAO,EACnC,QAAQ,KAAK,CAAC,CAClB",
|
|
6
|
+
"names": ["cpSync", "readFileSync", "renameSync", "writeFileSync", "resolve", "packageUrl", "distUrl", "buildinfoUrl", "changelogUrl", "readmeUrl", "templateUrl", "packageNameArgument", "packageName", "destinationPath", "resolve", "cpSync", "templateUrl", "changelogUrl", "buildinfoUrl", "readmeUrl", "packageJsonPath", "packageJson", "readFileSync", "writeFileSync", "renameSync", "error", "err"]
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@temir.ra/create-oci-compose",
|
|
3
|
+
"version": "0.1.0-pre.2",
|
|
4
|
+
"description": "A template for an OCI Compose package.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"keywords": [
|
|
7
|
+
"typescript",
|
|
8
|
+
"template",
|
|
9
|
+
"oci",
|
|
10
|
+
"compose"
|
|
11
|
+
],
|
|
12
|
+
"author": "temir.ra",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://git.chimps.quest/trs/create-oci-compose.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"create-oci-compose": "dist/cli.bundle.js"
|
|
24
|
+
},
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"entrypoint": "./src/cli.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"imports": {
|
|
31
|
+
"#src/*.js": "./src/*.ts"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"reinstall": "rm -rf node_modules && rm -f package-lock.json bun.lock yarn.lock pnpm-lock.yaml && npm install",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"buildinfo": "tsx scripts/buildinfo.ts",
|
|
37
|
+
"clean:dist": "rm -rf dist/",
|
|
38
|
+
"clean:tsbuildinfo": "rm -f tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
|
|
39
|
+
"clean": "npm run clean:dist && npm run clean:tsbuildinfo",
|
|
40
|
+
"tests": "node --import tsx --test \"tests/**/*.test.ts\"",
|
|
41
|
+
"prebuild": "npm run buildinfo",
|
|
42
|
+
"build": "npm run build:bundle",
|
|
43
|
+
"build:bundle": "tsx scripts/build-bundle.ts -- --omit-iife"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "latest",
|
|
47
|
+
"esbuild": "latest",
|
|
48
|
+
"tsx": "latest",
|
|
49
|
+
"typescript": "^6.0.3"
|
|
50
|
+
},
|
|
51
|
+
"allowScripts": {
|
|
52
|
+
"esbuild": true
|
|
53
|
+
}
|
|
54
|
+
}
|