git-stack-cli 1.15.1 → 2.0.1-beta

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/rollup.config.js DELETED
@@ -1,54 +0,0 @@
1
- // npm i -D rollup @rollup/plugin-json @rollup/plugin-node-resolve @rollup/plugin-commonjs
2
-
3
- import * as fs from "node:fs/promises";
4
- import path from "node:path";
5
- import * as url from "node:url";
6
-
7
- import alias from "@rollup/plugin-alias";
8
- import commonjs from "@rollup/plugin-commonjs";
9
- import json from "@rollup/plugin-json";
10
- import nodeResolve from "@rollup/plugin-node-resolve";
11
- import replace from "@rollup/plugin-replace";
12
- import typescript from "@rollup/plugin-typescript";
13
-
14
- const SCRIPT_DIR = path.dirname(url.fileURLToPath(import.meta.url));
15
-
16
- const PACKAGE_JSON_PATH = path.join(SCRIPT_DIR, "package.json");
17
- const PACKAGE_JSON = JSON.parse(await fs.readFile(PACKAGE_JSON_PATH, "utf-8"));
18
-
19
- // prettier-ignore
20
- const GIT_SEQUENCE_EDITOR_SCRIPT_PATH = path.join(SCRIPT_DIR, "scripts", "git-sequence-editor.sh");
21
- // prettier-ignore
22
- const UNSAFE_GIT_SEQUENCE_EDITOR_SCRIPT = await fs.readFile(GIT_SEQUENCE_EDITOR_SCRIPT_PATH, "utf-8");
23
- // prettier-ignore
24
- const GIT_SEQUENCE_EDITOR_SCRIPT = UNSAFE_GIT_SEQUENCE_EDITOR_SCRIPT.replace(/`/g, "\\`");
25
-
26
- export default {
27
- input: "src/index.tsx",
28
-
29
- output: {
30
- file: "dist/cjs/index.cjs",
31
- format: "cjs",
32
- inlineDynamicImports: true,
33
- },
34
-
35
- plugins: [
36
- // force line break
37
- typescript(),
38
- alias({
39
- entries: [{ find: /^~\//, replacement: "./src/" }],
40
- }),
41
- nodeResolve({ exportConditions: ["node"] }),
42
- commonjs(),
43
- json(),
44
- replace({
45
- preventAssignment: true,
46
- values: {
47
- "process.env.NODE_ENV": JSON.stringify("production"),
48
- "process.env.CLI_VERSION": JSON.stringify(String(PACKAGE_JSON.version)),
49
- "process.env.GIT_STACK_STANDALONE": process.env.GIT_STACK_STANDALONE,
50
- "process.env.GIT_SEQUENCE_EDITOR_SCRIPT": GIT_SEQUENCE_EDITOR_SCRIPT,
51
- },
52
- }),
53
- ],
54
- };
@@ -1,73 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import path from "node:path";
3
-
4
- import * as file from "~/core/file";
5
- import { spawn } from "~/core/spawn";
6
-
7
- // get paths relative to this script
8
- const SCRIPT_DIR = import.meta.dir;
9
- const PROJECT_DIR = path.join(SCRIPT_DIR, "..");
10
- const NODE_MODULES_BIN = path.join(PROJECT_DIR, "node_modules", ".bin");
11
- const DIST_DIR = path.join(PROJECT_DIR, "dist");
12
- const CJS_DIR = path.join(DIST_DIR, "cjs");
13
- const STANDALONE_DIR = path.join(DIST_DIR, "standalone");
14
-
15
- const ARG_LIST = process.argv.slice(2);
16
- const [maybe_target] = ARG_LIST;
17
-
18
- let TARGET = "node18-linux-x64,node18-macos-x64,node18-win-x64";
19
- if (maybe_target) {
20
- TARGET = maybe_target;
21
- }
22
-
23
- console.debug(`Building for target [${TARGET}]`);
24
-
25
- // clear entire dist output directory
26
- await fs.rmdir(DIST_DIR, { recursive: true });
27
- await fs.mkdir(DIST_DIR, { recursive: true });
28
-
29
- const package_json = await file.read_json(
30
- path.join(PROJECT_DIR, "package.json")
31
- );
32
-
33
- // prettier-ignore
34
- const { name, version, description, author, license, repository } = package_json;
35
-
36
- // include fields necessary for standalone executable build
37
- const standalone_package_json = {
38
- name,
39
- version,
40
- description,
41
- author,
42
- license,
43
- repository,
44
- bin: {
45
- "git-stack": "index.js",
46
- },
47
- };
48
-
49
- await file.write_json(
50
- path.join(STANDALONE_DIR, "package.json"),
51
- standalone_package_json
52
- );
53
-
54
- process.chdir(PROJECT_DIR);
55
-
56
- process.env.NODE_ENV = "production";
57
-
58
- // run typescript build to generate module output
59
- await spawn("npm run build");
60
-
61
- await fs.cp(
62
- path.join(CJS_DIR, "index.cjs"),
63
- path.join(STANDALONE_DIR, "index.js")
64
- );
65
-
66
- process.chdir(STANDALONE_DIR);
67
-
68
- // run pkg to build standalone executable
69
- await spawn([
70
- path.join(NODE_MODULES_BIN, "pkg"),
71
- "package.json",
72
- `--targets=${TARGET}`,
73
- ]);
package/scripts/link.ts DELETED
@@ -1,14 +0,0 @@
1
- import path from "node:path";
2
-
3
- import { spawn } from "~/core/spawn";
4
-
5
- const SCRIPT_DIR = import.meta.dir;
6
- const PROJECT_DIR = path.join(SCRIPT_DIR, "..");
7
-
8
- process.chdir(PROJECT_DIR);
9
-
10
- await spawn.sync("npm unlink git-stack-cli");
11
- await spawn.sync("npm link");
12
-
13
- console.debug();
14
- console.debug("✅", "linked");