@form8ion/git 1.0.0-alpha.3 → 1.0.0-alpha.5
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/README.md +36 -2
- package/example.js +8 -4
- package/lib/index.js +20 -3
- package/lib/index.js.map +1 -1
- package/package.json +13 -7
package/README.md
CHANGED
|
@@ -12,7 +12,22 @@ form8ion plugin for managing projects versioned with git
|
|
|
12
12
|
|
|
13
13
|
## Table of Contents
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
* [Features](#features)
|
|
16
|
+
* [Usage](#usage)
|
|
17
|
+
* [Installation](#installation)
|
|
18
|
+
* [Example](#example)
|
|
19
|
+
* [Import](#import)
|
|
20
|
+
* [Execute](#execute)
|
|
21
|
+
* [Contributing](#contributing)
|
|
22
|
+
* [Dependencies](#dependencies)
|
|
23
|
+
* [Verification](#verification)
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
* Initializes a git repository for a project
|
|
28
|
+
* Configures git to handle line endings across operating systems
|
|
29
|
+
* Manages ignoring files and directories from being versioned
|
|
30
|
+
* Detects an existing git repository configured for a project
|
|
16
31
|
|
|
17
32
|
## Usage
|
|
18
33
|
|
|
@@ -21,6 +36,7 @@ Run `npm run generate:md` to generate a table of contents
|
|
|
21
36
|
[![MIT license][license-badge]][license-link]
|
|
22
37
|
[![npm][npm-badge]][npm-link]
|
|
23
38
|
[![Try @form8ion/git on RunKit][runkit-badge]][runkit-link]
|
|
39
|
+
![node][node-badge]
|
|
24
40
|
|
|
25
41
|
<!--consumer-badges end -->
|
|
26
42
|
|
|
@@ -32,7 +48,23 @@ $ npm install @form8ion/git --save-prod
|
|
|
32
48
|
|
|
33
49
|
### Example
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
#### Import
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
import {scaffold, test, lift} from '@form8ion/git';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Execute
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
const projectRoot = process.cwd();
|
|
61
|
+
|
|
62
|
+
await scaffold({projectRoot});
|
|
63
|
+
|
|
64
|
+
if (await test({projectRoot})) {
|
|
65
|
+
await lift({projectRoot});
|
|
66
|
+
}
|
|
67
|
+
```
|
|
36
68
|
|
|
37
69
|
## Contributing
|
|
38
70
|
|
|
@@ -100,3 +132,5 @@ $ npm test
|
|
|
100
132
|
[runkit-link]: https://npm.runkit.com/@form8ion/git
|
|
101
133
|
|
|
102
134
|
[runkit-badge]: https://badge.runkitcdn.com/@form8ion/git.svg
|
|
135
|
+
|
|
136
|
+
[node-badge]: https://img.shields.io/node/v/@form8ion/git?logo=node.js
|
package/example.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// #### Import
|
|
2
2
|
// remark-usage-ignore-next
|
|
3
3
|
import stubbedFs from 'mock-fs';
|
|
4
|
-
import {scaffold} from './lib/index.js';
|
|
4
|
+
import {scaffold, test, lift} from './lib/index.js';
|
|
5
5
|
|
|
6
6
|
// remark-usage-ignore-next
|
|
7
7
|
stubbedFs();
|
|
8
8
|
|
|
9
9
|
// #### Execute
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
11
|
+
const projectRoot = process.cwd();
|
|
12
|
+
|
|
13
|
+
await scaffold({projectRoot});
|
|
14
|
+
|
|
15
|
+
if (await test({projectRoot})) {
|
|
16
|
+
await lift({projectRoot});
|
|
17
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
import { promises } from 'node:fs';
|
|
2
1
|
import touch from 'touch';
|
|
3
2
|
import simpleGit from 'simple-git';
|
|
3
|
+
import { info } from '@travi/cli-messages';
|
|
4
|
+
import { fileExists } from '@form8ion/core';
|
|
5
|
+
import { promises } from 'node:fs';
|
|
4
6
|
|
|
5
7
|
async function scaffolder ({projectRoot}) {
|
|
8
|
+
info('Initializing Git Repository');
|
|
9
|
+
|
|
6
10
|
const git = simpleGit({baseDir: projectRoot});
|
|
7
11
|
|
|
8
12
|
await Promise.all([
|
|
9
13
|
touch(`${projectRoot}/.gitignore`),
|
|
10
|
-
promises.writeFile(`${projectRoot}/.gitattributes`, '* text=auto'),
|
|
11
14
|
git.init()
|
|
12
15
|
]);
|
|
13
16
|
|
|
14
17
|
return {};
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
function tester ({projectRoot}) {
|
|
21
|
+
return fileExists(`${projectRoot}/.gitignore`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function scaffoldAttributes ({projectRoot}) {
|
|
25
|
+
return promises.writeFile(`${projectRoot}/.gitattributes`, '* text=auto');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function lifter ({projectRoot}) {
|
|
29
|
+
await scaffoldAttributes({projectRoot});
|
|
30
|
+
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { lifter as lift, scaffolder as scaffold, tester as test };
|
|
18
35
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/scaffolder.js"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/scaffolder.js","../src/tester.js","../src/attributes/scaffolder.js","../src/lifter.js"],"sourcesContent":["import touch from 'touch';\nimport simpleGit from 'simple-git';\nimport {info} from '@travi/cli-messages';\n\nexport default async function ({projectRoot}) {\n info('Initializing Git Repository');\n\n const git = simpleGit({baseDir: projectRoot});\n\n await Promise.all([\n touch(`${projectRoot}/.gitignore`),\n git.init()\n ]);\n\n return {};\n}\n","import {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot}) {\n return fileExists(`${projectRoot}/.gitignore`);\n}\n","import {promises as fs} from 'node:fs';\n\nexport default function ({projectRoot}) {\n return fs.writeFile(`${projectRoot}/.gitattributes`, '* text=auto');\n}\n","import {scaffold as scaffoldAttributes} from './attributes/index.js';\n\nexport default async function ({projectRoot}) {\n await scaffoldAttributes({projectRoot});\n\n return {};\n}\n"],"names":["fs"],"mappings":";;;;;;AAIe,yBAAc,EAAE,CAAC,WAAW,CAAC,EAAE;AAC9C,EAAE,IAAI,CAAC,6BAA6B,CAAC,CAAC;AACtC;AACA,EAAE,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAChD;AACA,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;AACpB,IAAI,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;AACtC,IAAI,GAAG,CAAC,IAAI,EAAE;AACd,GAAG,CAAC,CAAC;AACL;AACA,EAAE,OAAO,EAAE,CAAC;AACZ;;ACbe,eAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;AACxC,EAAE,OAAO,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AACjD;;ACFe,2BAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;AACxC,EAAE,OAAOA,QAAE,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,CAAC;AACtE;;ACFe,qBAAc,EAAE,CAAC,WAAW,CAAC,EAAE;AAC9C,EAAE,MAAM,kBAAkB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1C;AACA,EAAE,OAAO,EAAE,CAAC;AACZ;;;;"}
|
package/package.json
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
"name": "@form8ion/git",
|
|
3
3
|
"description": "form8ion plugin for managing projects versioned with git",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
5
|
+
"version": "1.0.0-alpha.5",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^18.17 || >=20.6.1"
|
|
9
|
+
},
|
|
7
10
|
"author": "Matt Travi <npm@travi.org> (https://matt.travi.org)",
|
|
8
11
|
"repository": "form8ion/git",
|
|
9
12
|
"bugs": "https://github.com/form8ion/git/issues",
|
|
@@ -38,7 +41,8 @@
|
|
|
38
41
|
"lint:js": "eslint . --cache",
|
|
39
42
|
"lint:js:fix": "run-s 'lint:js -- --fix'",
|
|
40
43
|
"lint:publish": "publint --strict",
|
|
41
|
-
"test": "npm-run-all --print-label build --parallel lint:* --parallel test:*"
|
|
44
|
+
"test": "npm-run-all --print-label build --parallel lint:* --parallel test:*",
|
|
45
|
+
"lint:engines": "ls-engines"
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
48
|
"example.js",
|
|
@@ -49,10 +53,15 @@
|
|
|
49
53
|
"provenance": true
|
|
50
54
|
},
|
|
51
55
|
"packageManager": "npm@10.8.1+sha256.b8807aebb9656758e2872fa6e7c564b506aa2faa9297439a478d471d2fe32483",
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@form8ion/core": "^4.3.0",
|
|
58
|
+
"@travi/cli-messages": "^1.1.1",
|
|
59
|
+
"simple-git": "^3.25.0",
|
|
60
|
+
"touch": "^3.1.1"
|
|
61
|
+
},
|
|
52
62
|
"devDependencies": {
|
|
53
63
|
"@cucumber/cucumber": "10.8.0",
|
|
54
64
|
"@form8ion/commitlint-config": "1.0.76",
|
|
55
|
-
"@form8ion/core": "4.3.0",
|
|
56
65
|
"@form8ion/eslint-config": "7.0.9",
|
|
57
66
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
58
67
|
"@form8ion/remark-lint-preset": "6.0.3",
|
|
@@ -65,6 +74,7 @@
|
|
|
65
74
|
"husky": "9.0.11",
|
|
66
75
|
"jest-when": "3.6.0",
|
|
67
76
|
"lockfile-lint": "4.14.0",
|
|
77
|
+
"ls-engines": "0.9.2",
|
|
68
78
|
"mock-fs": "5.2.0",
|
|
69
79
|
"npm-run-all2": "6.2.0",
|
|
70
80
|
"publint": "0.2.8",
|
|
@@ -76,9 +86,5 @@
|
|
|
76
86
|
"rollup-plugin-auto-external": "2.0.0",
|
|
77
87
|
"testdouble": "3.20.2",
|
|
78
88
|
"vitest": "1.6.0"
|
|
79
|
-
},
|
|
80
|
-
"dependencies": {
|
|
81
|
-
"simple-git": "^3.25.0",
|
|
82
|
-
"touch": "^3.1.1"
|
|
83
89
|
}
|
|
84
90
|
}
|