Skip to content

Commit b7ccce5

Browse files
committed
feat: Break apart modules and updates dependencies
BREAKING CHANGE: Shift to modules
1 parent ad83a8d commit b7ccce5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+14715
-22802
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
on:
4+
merge_group:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
# Needed for semantic-release to create GitHub releases and publish to npm via OIDC
13+
permissions:
14+
contents: write
15+
issues: write
16+
pull-requests: write
17+
id-token: write
18+
19+
concurrency:
20+
group: Release
21+
cancel-in-progress: false
22+
23+
jobs:
24+
release:
25+
name: Semantic Release
26+
environment: Release
27+
# Ensure releases run only when code reaches main via GitHub Merge Queue, or when manually dispatched
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
32+
with:
33+
fetch-depth: 0
34+
- name: Setup Node.js
35+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
36+
with:
37+
node-version-file: '.nvmrc'
38+
cache: npm
39+
registry-url: 'https://registry.npmjs.org'
40+
- name: Update npm
41+
run: npm install -g npm@latest
42+
- name: Install dependencies
43+
run: npm ci
44+
- name: Run ESLint
45+
run: npm run lint
46+
- name: Run unit tests
47+
run: npm run test:ci
48+
- name: Semantic Release
49+
if: ${{ github.event_name == 'push' }}
50+
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
NPM_CONFIG_PROVENANCE: true
54+
- name: Publish to NPM
55+
run: npm publish --provenance

.github/workflows/verify-pr.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Verify PR
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
13+
- name: Setup Node.js
14+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
15+
with:
16+
node-version-file: '.nvmrc'
17+
cache: npm
18+
- name: Install dependencies
19+
run: npm ci
20+
- name: Run ESLint
21+
run: npm run lint
22+
23+
test:
24+
name: Test
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
29+
- name: Setup Node.js
30+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
31+
with:
32+
node-version-file: '.nvmrc'
33+
cache: npm
34+
- name: Install dependencies
35+
run: npm ci
36+
- name: Run unit tests
37+
run: npm run test:ci

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!index.js
3+
!lib/**/*.js
4+
lib/**/*.test.js

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.11.1

.releaserc.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
[
7+
"@semantic-release/commit-analyzer",
8+
{
9+
"preset": "conventionalcommits",
10+
"releaseRules": [
11+
{
12+
"breaking": true,
13+
"release": "major"
14+
},
15+
{
16+
"type": "feat",
17+
"release": "minor"
18+
},
19+
{
20+
"type": "*",
21+
"release": "patch"
22+
}
23+
],
24+
"parserOpts": {
25+
"noteKeywords": [
26+
"BREAKING CHANGE",
27+
"BREAKING CHANGES"
28+
]
29+
}
30+
}
31+
],
32+
"@semantic-release/release-notes-generator",
33+
[
34+
"@semantic-release/npm",
35+
{
36+
"npmPublish": false
37+
}
38+
],
39+
[
40+
"@semantic-release/git",
41+
{
42+
"assets": [
43+
"package.json",
44+
"package-lock.json"
45+
]
46+
}
47+
],
48+
"@semantic-release/github"
49+
]
50+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ My old Gaffer is tired of writing code, so he generates it instead! This is how
66

77
## Requirements
88

9-
Install the latest LTS of NodeJS. Or a version around v8.11.3. Or try whatever you've got installed already, maybe it will work!
9+
Install the latest LTS of NodeJS. Or a version around v24. Or try whatever you've got installed already, maybe it will work!
1010
https://nodejs.org/en/
1111

1212
Also install `yarn`. Or don't, and use `npm` instead.
@@ -91,5 +91,5 @@ There are several flags you can pass. To see them, run `gaffer-generator --help`
9191
## Testing
9292

9393
```$bash
94-
yarn test
94+
npm run test
9595
```

cli.js

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
#!/usr/bin/env node
2-
require('yargs')
3-
.command({
4-
command: 'generate [directory]',
5-
aliases: ['gen', 'g'],
6-
desc: 'Recursively looks for .templateroots in the current directory, or supplied directory',
7-
builder: yargs => yargs.default('directory', './'),
8-
handler: argv => require('./src/generate/root').run(argv.directory),
9-
})
10-
.command({
11-
command: 'create [directory] [--overwrite]',
12-
aliases: ['c'],
13-
desc: 'Create a starting .templateroot in to the current directory, or supplied directory',
14-
builder: yargs => yargs.default('directory', './example.templateroot'),
15-
handler: argv => require('./src/create').run(argv.directory),
16-
})
17-
.options({
18-
'dry-run': {
19-
boolean: true,
20-
describe: 'Logs the changes that would be made without actually touching the file system.',
21-
},
22-
'into': {
23-
string: true,
24-
describe: 'Overrides the directory that .templateroots will target. Useful for targeting dynamic directories.',
25-
},
26-
'silent': {
27-
boolean: true,
28-
describe: 'Disables console logging.',
29-
},
30-
'no-colors': {
31-
boolean: true,
32-
describe: 'Turns off console coloring of text.',
33-
},
34-
})
35-
.demandCommand()
36-
.help()
37-
.wrap(72)
38-
.argv;
2+
import yargs from 'yargs';
3+
import { hideBin } from 'yargs/helpers';
4+
import { setArgv } from './lib/argv.js';
5+
6+
setArgv(
7+
yargs(hideBin(process.argv))
8+
.command({
9+
command: 'generate [directory]',
10+
aliases: ['gen', 'g'],
11+
desc: 'Recursively looks for .templateroots in the current directory, or supplied directory',
12+
builder: yargs => yargs.default('directory', './'),
13+
handler: async argv => (await import('./lib/generate/root.js')).run(argv.directory),
14+
})
15+
.command({
16+
command: 'create [directory] [--overwrite]',
17+
aliases: ['c'],
18+
desc: 'Create a starting .templateroot in to the current directory, or supplied directory',
19+
builder: yargs => yargs.default('directory', './example.templateroot'),
20+
handler: async argv => (await import('./lib/create.js')).run(argv.directory),
21+
})
22+
.options({
23+
'dry-run': {
24+
boolean: true,
25+
describe: 'Logs the changes that would be made without actually touching the file system.',
26+
},
27+
'into': {
28+
string: true,
29+
describe: 'Overrides the directory that .templateroots will target. Useful for targeting dynamic directories.',
30+
},
31+
'silent': {
32+
boolean: true,
33+
describe: 'Disables console logging.',
34+
},
35+
'no-colors': {
36+
boolean: true,
37+
describe: 'Turns off console coloring of text.',
38+
},
39+
})
40+
.demandCommand()
41+
.help()
42+
.wrap(72)
43+
.argv,
44+
);

0 commit comments

Comments
 (0)