Skip to content

Commit

Permalink
feat(sample): config.lineNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
Airkro committed Oct 22, 2024
1 parent 469f9f4 commit 2125a9b
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 160 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
"packages/*"
],
"dependencies": {
"playwright-core": "~1.48.0"
"playwright-core": "~1.48.1"
},
"devDependencies": {
"@nice-move/all-in-base": "^0.2.4",
"@nice-move/all-in-base": "^0.2.5",
"@nice-move/syncpack-config": "^0.2.9",
"best-shot": "0.7.6",
"best-shot": "0.7.7",
"eslint": "^8.57.1",
"garou": "^0.8.1",
"log-symbols": "^4.1.0",
"prettier": "^3.3.3",
"syncpack": "^13.0.0",
"typescript": "~5.5.4"
"typescript": "~5.6.3"
},
"peerDependencies": {
"@bring-it/npm": "workspace:~",
Expand Down
3 changes: 2 additions & 1 deletion packages/sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Config example:
"ignore": ["dist"],
"title": "示例软件名称",
"version": "v1.0",
"company": "Cyberdyne Systems Corporation"
"company": "Cyberdyne Systems Corporation",
"lineNumber": true
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sample/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/sample",
"version": "0.4.22",
"version": "0.4.23",
"description": "Generate code sample files",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"peerDependencies": {
"@bring-it/cli": "workspace:~",
"playwright-core": "~1.48.0"
"playwright-core": "~1.48.1"
},
"peerDependenciesMeta": {
"playwright-core": {
Expand Down
2 changes: 2 additions & 0 deletions packages/sample/src/lib/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function mergeConfig(group = [{}]) {
prologue = [],
epilogue = [],
ignore = ['dist'],
lineNumber = false,
extensions = [
['js', 'cjs', 'mjs', 'jsx'],
['ts', 'cts', 'mts', 'tsx'],
Expand All @@ -55,6 +56,7 @@ export function mergeConfig(group = [{}]) {
checkArray(ignore, `group[${index}].ignore`);

return {
lineNumber,
title,
version,
company,
Expand Down
4 changes: 2 additions & 2 deletions packages/sample/src/lib/sample.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export async function action() {
const files = await scaner(config);
const code = await picker(files, config);

const { title, version, company } = config;
const { title, version, company, lineNumber } = config;

await pdf(code, { title, version, company });
await pdf(code, { title, version, company, lineNumber });
logger.task('Generated');
}
}
5 changes: 5 additions & 0 deletions packages/sample/src/lib/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
word-break: break-all;
}
code:before {
display: var(--show-line-number, none);
flex-shrink: 0;
align-self: stretch;
margin-right: 1em;
Expand Down Expand Up @@ -79,6 +80,10 @@
header.querySelector('h4').textContent = result.company;
}

if (result.lineNumber) {
document.body.style.setProperty('--show-line-number', 'block');
}

document.title = [result.title, result.version].join(' ');

const pre = document.body.querySelector('pre');
Expand Down
2 changes: 1 addition & 1 deletion packages/sftp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"p-all": "^5.0.0",
"p-retry": "^6.2.0",
"p-series": "^3.0.0",
"p-timeout": "^6.1.2",
"p-timeout": "^6.1.3",
"slash": "catalog:",
"ssh-config": "^5.0.0"
},
Expand Down
Loading

0 comments on commit 2125a9b

Please sign in to comment.