Parcourir la source

chore: Switch Lerna to fixed mode

Michael Bromley il y a 6 ans
Parent
commit
d8290b3e22
4 fichiers modifiés avec 14 ajouts et 13 suppressions
  1. 0 0
      CHANGELOG.md
  2. 1 1
      lerna.json
  3. 4 2
      package.json
  4. 9 10
      scripts/changelogs/changelogs.ts

+ 0 - 0
CHANGELOG.md


+ 1 - 1
lerna.json

@@ -2,7 +2,7 @@
   "packages": [
     "packages/*"
   ],
-  "version": "independent",
+  "version": "0.1.1",
   "npmClient": "yarn",
   "useWorkspaces": true
 }

+ 4 - 2
package.json

@@ -18,6 +18,7 @@
     "postcommit": "git update-index --again",
     "commitmsg": "commitlint -e $GIT_PARAMS",
     "prepush": "yarn test:all && cd admin-ui && yarn build --prod",
+    "version": "yarn generate-changelog && git add CHANGELOG.md",
     "dev-server:start": "cd packages/dev-server && yarn start",
     "dev-server:populate": "cd packages/dev-server && yarn populate",
     "test:all": "cd admin-ui && yarn test --watch=false --browsers=ChromeHeadlessCI --progress=false && cd ../ && yarn test:common && yarn test:core && yarn test:email-plugin && yarn test:e2e",
@@ -27,8 +28,9 @@
     "test:e2e": "jest --config packages/core/e2e/config/jest-e2e.json --runInBand",
     "test:admin-ui": "cd admin-ui && yarn test --watch=false --browsers=ChromeHeadlessCI --progress=false",
     "build": "lerna run build",
-    "generate-changelogs": "ts-node scripts/changelogs/changelogs.ts",
-    "publish:packages": "yarn build && lerna publish --exact -m \"chore: Publish %s release\" --no-git-tag-version"
+    "generate-changelog": "ts-node scripts/changelogs/changelogs.ts",
+    "bump-version": "lerna version -m \"chore: Publish %s\" --no-push",
+    "publish": "yarn build && lerna publish --exact -m \"chore: Publish %s release\" --no-git-tag-version"
   },
   "devDependencies": {
     "@commitlint/cli": "^7.6.1",

+ 9 - 10
scripts/changelogs/changelogs.ts

@@ -28,21 +28,18 @@ const PACKAGES: PackageDef[] = [
 const mainTemplate = fs.readFileSync(path.join(__dirname, 'template.hbs'), 'utf-8');
 const commitTemplate = fs.readFileSync(path.join(__dirname, 'commit.hbs'), 'utf-8');
 
-PACKAGES.forEach(generateChangelogForPackage);
+generateChangelogForPackage();
 
 /**
  * Generates changelog entries for the given package based on the conventional commits data.
  */
-function generateChangelogForPackage(pkg: PackageDef) {
-    const changelogPath = path.join(pkg.path, 'CHANGELOG.md');
+function generateChangelogForPackage() {
+    const changelogPath = path.join(__dirname, '../../CHANGELOG.md');
     const inStream = fs.createReadStream(changelogPath, { flags: 'a+' });
-    const tempFile = path.join(__dirname, `__temp_${pkg.name}__`);
+    const tempFile = path.join(__dirname, `__temp_changelog__`);
     conventionalChangelogCore({
-            pkg: {
-                path: path.join(pkg.path, 'package.json'),
-            },
             transform: (commit: any, context: any) => {
-                const includeCommit = scopeMatchesName(commit.scope, pkg.name) && TYPES_TO_INCLUDE.includes(commit.type);
+                const includeCommit = TYPES_TO_INCLUDE.includes(commit.type);
                 if (includeCommit) {
                     return context(null, commit);
                 } else {
@@ -51,9 +48,11 @@ function generateChangelogForPackage(pkg: PackageDef) {
 
             },
             releaseCount: 1,
-            outputUnreleased: false,
+            outputUnreleased: true,
+        },
+        {
+            version: require('../../lerna.json').version,
         },
-        null,
         null,
         null,
         {