happy 0.13.4 → 1.0.1
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.
- package/index.js +5 -5
- package/package.json +5 -4
- package/src/analyze.js +2 -3
- package/src/build.js +4 -7
- package/src/helpers.js +2 -2
- package/src/index.js +9 -18
- package/src/lint.js +3 -4
- package/src/publish.js +5 -7
- package/src/pull.js +3 -3
- package/src/push.js +3 -3
- package/src/save.js +3 -4
- package/src/test.js +3 -4
package/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const {
|
|
3
|
+
import listr from "listr";
|
|
4
|
+
import meow from "meow";
|
|
5
|
+
import {
|
|
7
6
|
analyze,
|
|
8
7
|
build,
|
|
9
8
|
lint,
|
|
@@ -12,7 +11,7 @@ const {
|
|
|
12
11
|
push,
|
|
13
12
|
save,
|
|
14
13
|
test,
|
|
15
|
-
}
|
|
14
|
+
} from "./src/index.js";
|
|
16
15
|
|
|
17
16
|
const { flags, input } = meow(
|
|
18
17
|
`
|
|
@@ -45,6 +44,7 @@ const { flags, input } = meow(
|
|
|
45
44
|
✔ Uploading changes
|
|
46
45
|
`,
|
|
47
46
|
{
|
|
47
|
+
importMeta: import.meta,
|
|
48
48
|
flags: {
|
|
49
49
|
now: {
|
|
50
50
|
type: "boolean",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "happy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Happy simplifies your day-to-day git workflow",
|
|
5
5
|
"author": "Francisco Presencia <public@francisco.io> (https://francisco.io/)",
|
|
6
6
|
"funding": {
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
"happy": "index.js"
|
|
24
24
|
},
|
|
25
25
|
"main": "index.js",
|
|
26
|
+
"type": "module",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"atocha": "^
|
|
28
|
+
"atocha": "^2.0.0",
|
|
28
29
|
"cross-env": "^7.0.2",
|
|
29
|
-
"files": "^
|
|
30
|
+
"files": "^2.2.2",
|
|
30
31
|
"listr": "^0.14.3",
|
|
31
|
-
"meow": "^
|
|
32
|
+
"meow": "^11.0.0"
|
|
32
33
|
}
|
|
33
34
|
}
|
package/src/analyze.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Analyze the project and find the right script for each thing
|
|
2
|
-
|
|
3
|
-
const { exists, read } = require("files");
|
|
2
|
+
import { exists, read } from "files";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
export default async (ctx) => {
|
|
6
5
|
if (!(await exists("package.json"))) return {};
|
|
7
6
|
const pkg = await read("package.json");
|
|
8
7
|
return { pkg: JSON.parse(pkg) };
|
package/src/build.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { stderrok } = require("./helpers");
|
|
1
|
+
import cmd from "atocha";
|
|
2
|
+
import { stderrok } from "./helpers.js";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module.exports = (cli) => ({
|
|
4
|
+
export default (cli) => ({
|
|
8
5
|
title: "Building project",
|
|
9
6
|
skip: async (ctx) => {
|
|
10
7
|
if (!ctx.pkg) return true;
|
|
11
8
|
if (!ctx.pkg.scripts.build) return true;
|
|
12
9
|
},
|
|
13
|
-
task: async (
|
|
10
|
+
task: async () => cmd("npm run build").catch(stderrok),
|
|
14
11
|
});
|
package/src/helpers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Accept these errors
|
|
2
|
-
|
|
2
|
+
export const wtf = (err) => {
|
|
3
3
|
if (/branch\s+master\s+-> FETCH_HEAD/.test(err.message)) return;
|
|
4
4
|
if (/master -> master/.test(err.message)) return;
|
|
5
5
|
if (/Everything up-to-date/.test(err.message)) return;
|
|
@@ -7,7 +7,7 @@ exports.wtf = (err) => {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// Only throw if the error is not 0
|
|
10
|
-
|
|
10
|
+
export const stderrok = (error) => {
|
|
11
11
|
// 0 or undefined should be ignored
|
|
12
12
|
if (!error.code) return;
|
|
13
13
|
throw error;
|
package/src/index.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import analyze from "./analyze.js";
|
|
2
|
+
import build from "./build.js";
|
|
3
|
+
import lint from "./lint.js";
|
|
4
|
+
import publish from "./publish.js";
|
|
5
|
+
import pull from "./pull.js";
|
|
6
|
+
import push from "./push.js";
|
|
7
|
+
import save from "./save.js";
|
|
8
|
+
import test from "./test.js";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
analyze,
|
|
12
|
-
build,
|
|
13
|
-
lint,
|
|
14
|
-
publish,
|
|
15
|
-
pull,
|
|
16
|
-
push,
|
|
17
|
-
save,
|
|
18
|
-
test,
|
|
19
|
-
};
|
|
10
|
+
export { analyze, build, lint, publish, pull, push, save, test };
|
package/src/lint.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { stderrok } = require("./helpers");
|
|
1
|
+
import cmd from "atocha";
|
|
2
|
+
import { stderrok } from "./helpers.js";
|
|
4
3
|
|
|
5
4
|
const ci = "export CI=true || set CI=true&&";
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
export default (cli) => ({
|
|
8
7
|
title: "Linting",
|
|
9
8
|
skip: async (ctx) => {
|
|
10
9
|
if (!ctx.pkg) return true;
|
package/src/publish.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const { read } = require("files");
|
|
1
|
+
import cmd from "atocha";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
export default (cli) => ({
|
|
5
4
|
title: "Publish to npm",
|
|
6
|
-
skip: async (
|
|
5
|
+
skip: async () => {
|
|
7
6
|
if (!cli.flags.publish) return true;
|
|
8
7
|
// 5.0.0
|
|
9
8
|
if (!/^\d+\.\d+\.\d+$/.test(await cmd(`np --version`))) {
|
|
@@ -11,7 +10,6 @@ module.exports = (cli) => ({
|
|
|
11
10
|
}
|
|
12
11
|
return false;
|
|
13
12
|
},
|
|
14
|
-
task: async (
|
|
15
|
-
await cmd(`np ${cli.flags.publish} --yolo --no-release-draft`)
|
|
16
|
-
},
|
|
13
|
+
task: async () =>
|
|
14
|
+
await cmd(`np ${cli.flags.publish} --yolo --no-release-draft`),
|
|
17
15
|
});
|
package/src/pull.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import cmd from "atocha";
|
|
2
|
+
import { wtf } from "./helpers.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default (cli) => ({
|
|
5
5
|
title: "Downloading latest",
|
|
6
6
|
skip: async () => {
|
|
7
7
|
const status = await cmd(`git status`);
|
package/src/push.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import cmd from "atocha";
|
|
2
|
+
import { wtf } from "./helpers.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default (cli) => ({
|
|
5
5
|
title: "Uploading changes",
|
|
6
6
|
skip: async () => {
|
|
7
7
|
const status = await cmd(`git status`);
|
package/src/save.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { stderrok } = require("./helpers");
|
|
1
|
+
import cmd from "atocha";
|
|
2
|
+
import { stderrok } from "./helpers.js";
|
|
4
3
|
|
|
5
4
|
// ISO 8601 without milliseconds (which is still ISO 8601)
|
|
6
5
|
const time = () => new Date().toISOString().replace(/\.[0-9]{3}/, "");
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export default (cli) => ({
|
|
9
8
|
title: "Saving changes",
|
|
10
9
|
skip: async () => {
|
|
11
10
|
const status = await cmd(`git status`);
|
package/src/test.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { stderrok } = require("./helpers");
|
|
1
|
+
import cmd from "atocha";
|
|
2
|
+
import { stderrok } from "./helpers.js";
|
|
4
3
|
|
|
5
4
|
const ci = "export CI=true || set CI=true&&";
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
export default (cli) => ({
|
|
8
7
|
title: "Testing project",
|
|
9
8
|
skip: async (ctx) => {
|
|
10
9
|
if (!ctx.pkg) return true;
|