Skip to content

Commit

Permalink
Fix @jakubmazanec/carson-templates (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmazanec authored Jul 25, 2023
1 parent 85e6f71 commit dbf0e41
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 17 deletions.
Binary file modified .carson/.snapshots
Binary file not shown.
13 changes: 13 additions & 0 deletions .changeset/cuddly-toys-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@jakubmazanec/changesets-changelog': patch
'@jakubmazanec/carson-templates': patch
'@jakubmazanec/eslint-config': patch
'@jakubmazanec/zod-utils': patch
'@jakubmazanec/fs-utils': patch
'@jakubmazanec/template': patch
'@jakubmazanec/ts-utils': patch
'@jakubmazanec/error': patch
'@jakubmazanec/cli': patch
---

Updates Eddie template.
5 changes: 5 additions & 0 deletions .changeset/poor-hornets-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@jakubmazanec/carson-templates': patch
---

Template `workspace` now generates correct version of this template package.
5 changes: 5 additions & 0 deletions .changeset/violet-bears-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@jakubmazanec/carson-templates': patch
---

Fixes syntax errors in templates.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"devDependencies": {
"@changesets/cli": "^2.25.2",
"@jakubmazanec/carson": "^0.0.0",
"@jakubmazanec/carson-templates": "^0.0.0",
"@jakubmazanec/carson": "^0.1.0",
"@jakubmazanec/carson-templates": "^0.1.0",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.56",
"@testing-library/jest-dom": "^5.16.5",
Expand Down
Binary file modified packages/carson-templates/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/carson-templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
Expand Down
24 changes: 22 additions & 2 deletions packages/carson-templates/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
import {type Project, type Workspace} from '@jakubmazanec/carson';
import fs from 'node:fs';
import {createRequire} from 'node:module';
import semver from 'semver';

export {default as lodash} from 'lodash';
export {default as semver} from 'semver';

const TEMPLATE_PACKAGE_NAME = '@jakubmazanec/carson-templates';
const MAIN_BRANCH_NAMES = new Set(['main', 'master']);
const DEVELOPMENT_BRANCH_NAMES = new Set(['development', 'develop', 'dev']);

let require = createRequire(import.meta.url);
let templatesPackageVersion =
(
JSON.parse(
fs.readFileSync(require.resolve(`${TEMPLATE_PACKAGE_NAME}/package.json`), {
encoding: 'utf8',
}),
) as {version?: string}
).version ?? '1.0.0';
let isTemplatesPackageVersionPrerelease = !!semver.prerelease(templatesPackageVersion)?.length;

const DEPENDENCY_VERSIONS: Record<string, string> = {
'@changesets/cli': '^2.0.0',
'@jakubmazanec/carson': '^0.0.0',
'@jakubmazanec/carson-templates': '^0.0.0',
'@jakubmazanec/carson': '^0.1.0',
[TEMPLATE_PACKAGE_NAME]: isTemplatesPackageVersionPrerelease
? templatesPackageVersion
: `^${templatesPackageVersion}`,
'@jest/globals': '^29.0.0',
'@swc/cli': '^0.1.0',
'@swc/core': '^1.0.0',
Expand Down Expand Up @@ -70,6 +86,10 @@ export function getDependencies(dependencies: string[], workspace: Workspace | W
const projectNames = workspace.projects.map((project) => project.name);

for (const [dependencyName, dependencyVersion] of Object.entries(result)) {
if (dependencyName === TEMPLATE_PACKAGE_NAME) {
continue;
}

const installedDependency = workspace.allDependencies.find(
(dependency) => dependencyName === dependency.name,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ strategy: merge
let packageJson = {
repository: {
type: 'git',
directory: '<%- project.relativePath %>',
directory: project.relativePath,
},
type: 'module',
exports: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ strategy: merge
let packageJson = {
repository: {
type: 'git',
directory: '<%- project.relativePath %>',
directory: project.relativePath,
},
type: 'commonjs',
exports: './dist/main.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ strategy: merge
let packageJson = {
repository: {
type: 'git',
directory: '<%- project.relativePath %>',
directory: project.relativePath,
},
type: 'commonjs',
exports: {
Expand Down
Binary file modified packages/changesets-changelog/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/changesets-changelog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
"test": "jest --passWithNoTests",
Expand Down
Binary file modified packages/cli/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"develop": "concurrently \"swc src -d dist --watch\" \"tsc --watch\"",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
Expand Down
Binary file modified packages/error/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
Expand Down
Binary file modified packages/eslint-config/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"scripts": {
"build": "swc src -d dist && tsc",
"check-rules": "ts-node --files --project tools/check-rules/tsconfig.json tools/check-rules/index.ts",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
"test": "jest --passWithNoTests",
Expand Down
Binary file modified packages/fs-utils/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/fs-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
Expand Down
Binary file modified packages/template/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
Expand Down
Binary file modified packages/ts-utils/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/ts-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
Expand Down
Binary file modified packages/zod-utils/.carson/.snapshots
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/zod-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"build": "swc src -d dist && tsc",
"clean": "del-cli dist *.tsbuildinfo",
"clean": "del-cli coverage dist *.tsbuildinfo",
"document": "typedoc --options typedoc.config.cjs",
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
"lint": "eslint .",
Expand Down

0 comments on commit dbf0e41

Please sign in to comment.