orc-scripts 1.8.0-dev.1 → 1.8.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/scripts/tag.js +8 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-scripts",
3
- "version": "1.8.0-dev.1",
3
+ "version": "1.8.0-dev.2",
4
4
  "description": "Scripts toolbox for Orckestra",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  const spawn = require("cross-spawn");
2
2
  const readPkgUp = require("read-pkg-up");
3
- const { inc, lt, eq, coerce, prerelease } = require("semver");
3
+ const { inc } = require("semver");
4
4
 
5
5
  const gitDiffResult = spawn.sync("git", ["diff", "HEAD"]);
6
6
  if (gitDiffResult.status !== 0 || gitDiffResult.stdout.toString("utf-8")) {
@@ -15,51 +15,18 @@ if (gitBranchResult.status !== 0) {
15
15
  }
16
16
  const currentBranch = gitBranchResult.stdout.toString("utf-8").trim();
17
17
 
18
- const isMaster = currentBranch === "master";
18
+ const isVersionBranch = currentBranch.startsWith("version/");
19
19
  const isDevelopment = currentBranch === "develop";
20
- const isRelease = currentBranch.startsWith("releases/");
21
- const isLegacy = currentBranch.startsWith("legacy/");
22
20
 
23
- const { packageJson } = readPkgUp.sync({ normalize: false }) || {};
24
- const currentVersion = packageJson.version;
25
- let tag = "";
26
- if (isMaster) {
27
- // TODO: Should semver increment major/minor/patch - but which is hard to discover
28
- // Fail out and tag manually for now
29
- console.error("Tags from master branch should be made manually with the npm version command");
21
+ if (!isVersionBranch && !isDevelopment) {
22
+ console.error("Tagging is only supported on a version/X.Y or develop branch");
30
23
  process.exit(2);
31
- } else if (isRelease) {
32
- const pre = prerelease(currentVersion);
33
- const branchVersion = coerce(currentBranch.replace(/^.*\//, "")).version;
34
- if (lt(branchVersion, currentVersion)) {
35
- // Branch version must be greater or equal
36
- console.error("Branch version must be higher than or equal to package version");
37
- process.exit(3);
38
- }
39
- if (pre && eq(branchVersion, currentVersion.replace(/-.*$/, ""))) {
40
- tag = inc(currentVersion, "prerelease", "pre");
41
- } else {
42
- // First pre-release needs specific handling
43
- // see https://www.npmjs.com/package/semver#functions,
44
- // the inc() function regarding the semantics of "prerelease"
45
- tag = branchVersion + "-pre.0";
46
- }
47
- } else if (isLegacy) {
48
- // Only patch updates
49
- tag = inc(currentVersion, "patch") + "+legacy";
50
- } else if (isDevelopment) {
51
- const pre = prerelease(currentVersion);
52
- if (pre && pre[0] !== "dev") {
53
- tag = inc(currentVersion, "prepatch", "dev");
54
- } else {
55
- tag = inc(currentVersion, "prerelease", "dev");
56
- }
57
24
  }
58
25
 
59
- if (!tag) {
60
- console.error("This branch (" + currentBranch + ") cannot have releases tagged from it.");
61
- process.exit(4);
62
- }
26
+ const { packageJson } = readPkgUp.sync({ normalize: false }) || {};
27
+ const currentVersion = packageJson.version;
28
+
29
+ const tag = inc(currentVersion, "prerelease", "dev");
63
30
 
64
31
  const gitTagcheckResult = spawn.sync("git", ["rev-parse", tag]);
65
32
  // Failure == no tag == go ahead