Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
template/pnpm-lock.yaml
test/
8 changes: 6 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/eslint.config.js
/.github/
.gitattributes
.github/
eslint.config.js
test/*
template/pnpm-lock.yaml
template/node-modules
9 changes: 9 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ import ts from '@cto.af/eslint-config/ts.js';
export default [
...es6,
...ts,
{
files: [
'template/**',
'test/**',
],
rules: {
'n/no-missing-import': 'off',
},
},
];
23 changes: 14 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {Scaffold as scaffold} from 'simple-scaffold';
const cwd = process.cwd();
const base = path.basename(cwd);
const parent = path.basename(path.dirname(cwd));
const args = process.argv.slice(2);

const org = parent.startsWith('@') ? parent : '';
const name = org ? `${parent}/${base}` : base;
Expand All @@ -31,17 +32,21 @@ await scaffold({
email,
login,
user: user.login,
npmignore: '.npmignore',
gitignore: '.gitignore',
gitattributes: '.gitattributes',
},
});

const v = {verbose: 'full'};
await $(v)`ncu -u`;
await $(v)`pnpm install`;
await $(v)`git init .`;
await $(v)`git add .`;
await $(v)`git ci -m ${'Initial checkin'}`;
await $(v)`npm run build`;
await $(v)`gh secret set NPM_TOKEN`;
if (!args.includes('--noexec')) {
const v = {verbose: 'full'};
await $(v)`ncu -u`;
await $(v)`pnpm install`;
await $(v)`npm run build`;
if (!args.includes('--nogit')) {
await $(v)`git init .`;
await $(v)`git add .`;
await $(v)`git ci -m ${'Initial checkin'}`;
await $(v)`gh secret set NPM_TOKEN`;
await $(v)`gh secret set CODECOV_TOKEN`;
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"url": "https://github.com/cto-af/create/issues"
},
"scripts": {
"lint": "eslint ."
"lint": "eslint .",
"test": "rm -rf test && mkdir test && cd test && ../index.js --noexec",
"build": "npm run lint && npm run test"
},
"dependencies": {
"execa": "9.5.2",
Expand Down
21 changes: 0 additions & 21 deletions template/.gitattributes

This file was deleted.

11 changes: 0 additions & 11 deletions template/.github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Tests

on:
Expand All @@ -18,12 +17,6 @@ jobs:
runs-on: $\{{ matrix.platform }}

steps:
- name: Check secrets
env:
CODECOV_TOKEN: $\{{ secrets.CODECOV_TOKEN }}
if: ${{ env.CODECOV_TOKEN == '' }}
run: |
echo the secret "CODECOV_TOKEN" is not available
- uses: actions/checkout@v4
with:
submodules: true
Expand All @@ -38,7 +31,3 @@ jobs:
run: pnpm install -r
- name: Test $\{{ matrix.node-version }} $\{{ matrix.platform }}
run: npm run build
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: $\{{ secrets.CODECOV_TOKEN }}
6 changes: 0 additions & 6 deletions template/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ jobs:
contents: write
id-token: write
steps:
- name: Check secrets
env:
NPM_TOKEN: $\{{ secrets.NPM_TOKEN }}
if: ${{ env.NPM_TOKEN == '' }}
run: |
echo the secret "NPM_TOKEN" is not available
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
Expand Down
3 changes: 2 additions & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"clean": "rm -rf coverage docs lib",
"lint": "eslint .",
"pretest": "tsup --inlineSourceMap",
"pretest": "tsup --sourcemap inline",
"test": "c8 node --test",
"posttest": "tsup --silent",
"docs": "typedoc",
Expand All @@ -31,6 +31,7 @@
"devDependencies": {
"@cto.af/eslint-config": "5.1.11",
"c8": "10.1.3",
"eslint": "9.21.0",
"eslint-plugin-jsdoc": "50.6.3",
"eslint-plugin-markdown": "5.1.0",
"tsup": "8.3.6",
Expand Down
3 changes: 2 additions & 1 deletion template/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import assert from 'node:assert';
import {foo} from '../lib/index.js';
import test from 'node:test';

test('index', () => {
assert(true);
assert.equal(foo(), 2);
});