create-m2m-bo-template-react 1.0.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/LICENSE +21 -0
- package/README.md +54 -0
- package/index.js +42 -0
- package/package.json +49 -0
- package/template/_gitignore +7 -0
- package/template/package.json +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 leemheeje
|
|
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,54 @@
|
|
|
1
|
+
# create-m2m-bo-template-react
|
|
2
|
+
|
|
3
|
+
Scaffolding CLI for the M2M back-office React template.
|
|
4
|
+
|
|
5
|
+
> Status: **work in progress.** CI/CD and the semantic-release pipeline are in
|
|
6
|
+
> place. `template/` currently holds only a placeholder — the real React project
|
|
7
|
+
> is filled in later.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm create m2m-bo-template-react@latest my-app
|
|
13
|
+
# or
|
|
14
|
+
npx create-m2m-bo-template-react my-app
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Copies everything under `template/` into the target directory (`_gitignore` is
|
|
18
|
+
written as `.gitignore`).
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
Requires Node.js >= 20 (see `.nvmrc`).
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install
|
|
26
|
+
npm test # smoke-test.mjs — scaffolds into ./__smoke and checks the output
|
|
27
|
+
npm run lint
|
|
28
|
+
npm run format
|
|
29
|
+
npm start -- my-app
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Releasing
|
|
33
|
+
|
|
34
|
+
Fully automated via [semantic-release](https://semantic-release.gitbook.io/) in
|
|
35
|
+
GitLab CI. There is no manual `npm version` / tagging.
|
|
36
|
+
|
|
37
|
+
- Commit with [Conventional Commits](https://www.conventionalcommits.org/):
|
|
38
|
+
`fix:` → patch, `feat:` → minor, `feat!:` / `BREAKING CHANGE:` → major.
|
|
39
|
+
- On every push to `main`, the `release` job runs `semantic-release`, which
|
|
40
|
+
bumps the version, publishes to npmjs.com, creates a GitLab release + tag, and
|
|
41
|
+
commits the bumped `package.json` back to `main`.
|
|
42
|
+
|
|
43
|
+
### Required CI/CD variables
|
|
44
|
+
|
|
45
|
+
| Key | Value | Flags |
|
|
46
|
+
| -------------- | ------------------------------------------------------ | ----------------- |
|
|
47
|
+
| `NPM_TOKEN` | npm **automation** access token | Masked |
|
|
48
|
+
| `GITLAB_TOKEN` | GitLab access token, scopes: `api`, `write_repository` | Masked, Protected |
|
|
49
|
+
|
|
50
|
+
`@semantic-release/npm` writes `NPM_TOKEN` into `.npmrc` automatically.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Scaffolding CLI for the M2M back-office React template.
|
|
3
|
+
//
|
|
4
|
+
// Usage:
|
|
5
|
+
// npm create m2m-bo-template-react@latest <target-dir>
|
|
6
|
+
// npx create-m2m-bo-template-react <target-dir>
|
|
7
|
+
//
|
|
8
|
+
// Copies everything under ./template into <target-dir>. Files named `_gitignore`
|
|
9
|
+
// (etc.) are written with the leading underscore replaced by a dot, because npm
|
|
10
|
+
// strips real dotfiles from published packages.
|
|
11
|
+
|
|
12
|
+
import { cpSync, existsSync, readdirSync, renameSync, statSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
|
|
16
|
+
const templateDir = fileURLToPath(new URL("./template", import.meta.url));
|
|
17
|
+
const targetDir = process.argv[2] ?? ".";
|
|
18
|
+
|
|
19
|
+
if (!existsSync(templateDir)) {
|
|
20
|
+
console.error(`template directory not found: ${templateDir}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (existsSync(targetDir) && readdirSync(targetDir).length > 0) {
|
|
25
|
+
console.error(`target directory is not empty: ${targetDir}`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
cpSync(templateDir, targetDir, { recursive: true });
|
|
30
|
+
|
|
31
|
+
// _gitignore -> .gitignore, _npmrc -> .npmrc, ...
|
|
32
|
+
for (const entry of readdirSync(targetDir)) {
|
|
33
|
+
if (entry.startsWith("_") && statSync(join(targetDir, entry)).isFile()) {
|
|
34
|
+
renameSync(join(targetDir, entry), join(targetDir, `.${entry.slice(1)}`));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.log(`Scaffolded M2M BO React template into: ${targetDir}`);
|
|
39
|
+
console.log("Next steps:");
|
|
40
|
+
console.log(` cd ${targetDir}`);
|
|
41
|
+
console.log(" npm install");
|
|
42
|
+
console.log(" npm run dev");
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-m2m-bo-template-react",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Scaffolding CLI for the M2M back-office React template.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-m2m-bo-template-react": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"template"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"lint": "eslint .",
|
|
18
|
+
"format": "prettier --check .",
|
|
19
|
+
"test": "node smoke-test.mjs",
|
|
20
|
+
"start": "node index.js",
|
|
21
|
+
"release": "semantic-release"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"create",
|
|
25
|
+
"template",
|
|
26
|
+
"react",
|
|
27
|
+
"back-office",
|
|
28
|
+
"boilerplate",
|
|
29
|
+
"scaffold"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"author": "leemheeje",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "http://192.168.0.87/ux/bo-template-react.git"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"registry": "https://registry.npmjs.org/",
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@eslint/js": "^9.13.0",
|
|
43
|
+
"@semantic-release/git": "^11.0.1",
|
|
44
|
+
"@semantic-release/gitlab": "^13.3.3",
|
|
45
|
+
"eslint": "^9.13.0",
|
|
46
|
+
"prettier": "^3.3.3",
|
|
47
|
+
"semantic-release": "^25.0.9"
|
|
48
|
+
}
|
|
49
|
+
}
|