@form8ion/git 1.0.0-alpha.4 → 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 +33 -2
- package/example.js +8 -4
- package/lib/index.js +17 -3
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
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
|
|
|
@@ -33,7 +48,23 @@ $ npm install @form8ion/git --save-prod
|
|
|
33
48
|
|
|
34
49
|
### Example
|
|
35
50
|
|
|
36
|
-
|
|
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
|
+
```
|
|
37
68
|
|
|
38
69
|
## Contributing
|
|
39
70
|
|
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,7 +1,8 @@
|
|
|
1
|
-
import { promises } from 'node:fs';
|
|
2
1
|
import touch from 'touch';
|
|
3
2
|
import simpleGit from 'simple-git';
|
|
4
3
|
import { info } from '@travi/cli-messages';
|
|
4
|
+
import { fileExists } from '@form8ion/core';
|
|
5
|
+
import { promises } from 'node:fs';
|
|
5
6
|
|
|
6
7
|
async function scaffolder ({projectRoot}) {
|
|
7
8
|
info('Initializing Git Repository');
|
|
@@ -10,12 +11,25 @@ async function scaffolder ({projectRoot}) {
|
|
|
10
11
|
|
|
11
12
|
await Promise.all([
|
|
12
13
|
touch(`${projectRoot}/.gitignore`),
|
|
13
|
-
promises.writeFile(`${projectRoot}/.gitattributes`, '* text=auto'),
|
|
14
14
|
git.init()
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
17
|
return {};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
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 };
|
|
21
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,7 +2,7 @@
|
|
|
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
7
|
"engines": {
|
|
8
8
|
"node": "^18.17 || >=20.6.1"
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"packageManager": "npm@10.8.1+sha256.b8807aebb9656758e2872fa6e7c564b506aa2faa9297439a478d471d2fe32483",
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"@form8ion/core": "^4.3.0",
|
|
57
58
|
"@travi/cli-messages": "^1.1.1",
|
|
58
59
|
"simple-git": "^3.25.0",
|
|
59
60
|
"touch": "^3.1.1"
|
|
@@ -61,7 +62,6 @@
|
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@cucumber/cucumber": "10.8.0",
|
|
63
64
|
"@form8ion/commitlint-config": "1.0.76",
|
|
64
|
-
"@form8ion/core": "4.3.0",
|
|
65
65
|
"@form8ion/eslint-config": "7.0.9",
|
|
66
66
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
67
67
|
"@form8ion/remark-lint-preset": "6.0.3",
|