@form8ion/git 1.0.0 → 1.2.0

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 CHANGED
@@ -62,7 +62,7 @@ const projectRoot = process.cwd();
62
62
  await scaffold({projectRoot});
63
63
 
64
64
  if (await test({projectRoot})) {
65
- await lift({projectRoot});
65
+ await lift({projectRoot, results: {vcsIgnore: {file: [], directories: []}}});
66
66
  }
67
67
  ```
68
68
 
package/example.js CHANGED
@@ -13,5 +13,5 @@ const projectRoot = process.cwd();
13
13
  await scaffold({projectRoot});
14
14
 
15
15
  if (await test({projectRoot})) {
16
- await lift({projectRoot});
16
+ await lift({projectRoot, results: {vcsIgnore: {file: [], directories: []}}});
17
17
  }
package/lib/index.js CHANGED
@@ -1,8 +1,21 @@
1
- import touch from 'touch';
2
1
  import simpleGit from 'simple-git';
3
2
  import { info } from '@travi/cli-messages';
4
- import { fileExists } from '@form8ion/core';
5
3
  import { promises } from 'node:fs';
4
+ import '@form8ion/core';
5
+
6
+ function scaffoldIgnore ({projectRoot, files = [], directories = []}) {
7
+ return promises.appendFile(`${projectRoot}/.gitignore`, `\n${directories.join('\n')}\n\n${files.join('\n')}`);
8
+ }
9
+
10
+ async function liftIgnore ({projectRoot, results: {vcsIgnore}}) {
11
+ if (vcsIgnore) {
12
+ info('Updating files and directories to be ignored from version control', {level: 'secondary'});
13
+
14
+ await scaffoldIgnore({projectRoot, ...vcsIgnore});
15
+ }
16
+
17
+ return {};
18
+ }
6
19
 
7
20
  async function scaffolder ({projectRoot}) {
8
21
  info('Initializing Git Repository');
@@ -10,7 +23,7 @@ async function scaffolder ({projectRoot}) {
10
23
  const git = simpleGit({baseDir: projectRoot});
11
24
 
12
25
  await Promise.all([
13
- touch(`${projectRoot}/.gitignore`),
26
+ scaffoldIgnore({projectRoot}),
14
27
  git.init()
15
28
  ]);
16
29
 
@@ -18,15 +31,20 @@ async function scaffolder ({projectRoot}) {
18
31
  }
19
32
 
20
33
  function tester ({projectRoot}) {
21
- return fileExists(`${projectRoot}/.gitignore`);
34
+ const git = simpleGit({baseDir: projectRoot});
35
+
36
+ return git.checkIsRepo('root');
22
37
  }
23
38
 
24
39
  function scaffoldAttributes ({projectRoot}) {
25
40
  return promises.writeFile(`${projectRoot}/.gitattributes`, '* text=auto');
26
41
  }
27
42
 
28
- async function lifter ({projectRoot}) {
29
- await scaffoldAttributes({projectRoot});
43
+ async function lifter ({projectRoot, results}) {
44
+ await Promise.all([
45
+ scaffoldAttributes({projectRoot}),
46
+ liftIgnore({projectRoot, results})
47
+ ]);
30
48
 
31
49
  return {};
32
50
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
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;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/ignore/writer.js","../src/ignore/lifter.js","../src/scaffolder.js","../src/tester.js","../src/attributes/scaffolder.js","../src/lifter.js"],"sourcesContent":["import {promises as fs} from 'node:fs';\n\nexport default function ({projectRoot, files = [], directories = []}) {\n return fs.appendFile(`${projectRoot}/.gitignore`, `\\n${directories.join('\\n')}\\n\\n${files.join('\\n')}`);\n}\n","import {info} from '@travi/cli-messages';\n\nimport writeIgnores from './writer.js';\n\nexport default async function ({projectRoot, results: {vcsIgnore}}) {\n if (vcsIgnore) {\n info('Updating files and directories to be ignored from version control', {level: 'secondary'});\n\n await writeIgnores({projectRoot, ...vcsIgnore});\n }\n\n return {};\n}\n","import simpleGit from 'simple-git';\nimport {info} from '@travi/cli-messages';\n\nimport {scaffold as scaffoldIgnore} from './ignore/index.js';\n\nexport default async function ({projectRoot}) {\n info('Initializing Git Repository');\n\n const git = simpleGit({baseDir: projectRoot});\n\n await Promise.all([\n scaffoldIgnore({projectRoot}),\n git.init()\n ]);\n\n return {};\n}\n","import simpleGit from 'simple-git';\n\nexport default function ({projectRoot}) {\n const git = simpleGit({baseDir: projectRoot});\n\n return git.checkIsRepo('root');\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';\nimport {lift as liftIgnore} from './ignore/index.js';\n\nexport default async function ({projectRoot, results}) {\n await Promise.all([\n scaffoldAttributes({projectRoot}),\n liftIgnore({projectRoot, results})\n ]);\n\n return {};\n}\n"],"names":["fs","writeIgnores"],"mappings":";;;;;AAEe,uBAAQ,EAAE,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,CAAC,EAAE;AACtE,EAAE,OAAOA,QAAE,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1G;;ACAe,yBAAc,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE;AACpE,EAAE,IAAI,SAAS,EAAE;AACjB,IAAI,IAAI,CAAC,mEAAmE,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AACpG;AACA,IAAI,MAAMC,cAAY,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;AACA,EAAE,OAAO,EAAE,CAAC;AACZ;;ACPe,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,cAAc,CAAC,CAAC,WAAW,CAAC,CAAC;AACjC,IAAI,GAAG,CAAC,IAAI,EAAE;AACd,GAAG,CAAC,CAAC;AACL;AACA,EAAE,OAAO,EAAE,CAAC;AACZ;;ACde,eAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;AACxC,EAAE,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAChD;AACA,EAAE,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC;;ACJe,2BAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;AACxC,EAAE,OAAOD,QAAE,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,CAAC;AACtE;;ACDe,qBAAc,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE;AACvD,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;AACpB,IAAI,kBAAkB,CAAC,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,UAAU,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtC,GAAG,CAAC,CAAC;AACL;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",
5
+ "version": "1.2.0",
6
6
  "type": "module",
7
7
  "engines": {
8
8
  "node": "^18.17 || >=20.6.1"
@@ -56,8 +56,7 @@
56
56
  "dependencies": {
57
57
  "@form8ion/core": "^4.3.0",
58
58
  "@travi/cli-messages": "^1.1.1",
59
- "simple-git": "^3.25.0",
60
- "touch": "^3.1.1"
59
+ "simple-git": "^3.25.0"
61
60
  },
62
61
  "devDependencies": {
63
62
  "@cucumber/cucumber": "10.8.0",