@form8ion/git 1.0.0-alpha.5 → 1.1.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,17 @@
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 { fileExists } from '@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) await scaffoldIgnore({projectRoot, ...vcsIgnore});
12
+
13
+ return {};
14
+ }
6
15
 
7
16
  async function scaffolder ({projectRoot}) {
8
17
  info('Initializing Git Repository');
@@ -10,7 +19,7 @@ async function scaffolder ({projectRoot}) {
10
19
  const git = simpleGit({baseDir: projectRoot});
11
20
 
12
21
  await Promise.all([
13
- touch(`${projectRoot}/.gitignore`),
22
+ scaffoldIgnore({projectRoot}),
14
23
  git.init()
15
24
  ]);
16
25
 
@@ -25,8 +34,11 @@ function scaffoldAttributes ({projectRoot}) {
25
34
  return promises.writeFile(`${projectRoot}/.gitattributes`, '* text=auto');
26
35
  }
27
36
 
28
- async function lifter ({projectRoot}) {
29
- await scaffoldAttributes({projectRoot});
37
+ async function lifter ({projectRoot, results}) {
38
+ await Promise.all([
39
+ scaffoldAttributes({projectRoot}),
40
+ liftIgnore({projectRoot, results})
41
+ ]);
30
42
 
31
43
  return {};
32
44
  }
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 writeIgnores from './writer.js';\n\nexport default async function ({projectRoot, results: {vcsIgnore}}) {\n if (vcsIgnore) await writeIgnores({projectRoot, ...vcsIgnore});\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 {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';\nimport {lift as liftIgnore} from './ignore/index.js';\n\nexport default async function ({projectRoot, results}) {\n await Promise.all([\n scaffo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,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-alpha.5",
5
+ "version": "1.1.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",