@variousjs/create 0.0.5 → 0.3.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/bin/copy.js CHANGED
@@ -2,47 +2,32 @@ const fs = require('fs')
2
2
  const package = require('../package.json')
3
3
 
4
4
  const files = ['.gitignore', 'package-lock.json', 'package.json']
5
- const { COPY_ENV } = process.env
6
5
 
7
- if (COPY_ENV === 'publish') {
8
- package.name = 'variousjs'
9
- package.version = '0.1.0'
10
- package.private = true
6
+ package.name = 'variousjs'
7
+ package.version = '0.1.0'
8
+ package.private = true
11
9
 
12
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
- const { prepublishOnly, postinstall, ...rest } = package.scripts
14
- package.scripts = rest
10
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
+ const { prepublishOnly, ...rest } = package.scripts
12
+ package.scripts = rest
15
13
 
16
- delete package.bin
17
- delete package.publishConfig
18
- delete package.repository
19
- delete package.keywords
20
- delete package.bugs
21
- delete package.homepage
14
+ delete package.bin
15
+ delete package.publishConfig
16
+ delete package.repository
17
+ delete package.keywords
18
+ delete package.bugs
19
+ delete package.homepage
22
20
 
23
- fs.writeFileSync('package.json.copy', JSON.stringify(package, null, 2))
24
- }
21
+ fs.writeFileSync('package.json.copy', JSON.stringify(package, null, 2))
25
22
 
26
23
  files.forEach((name) => {
27
24
  const copyName = `${name}.copy`
28
25
 
29
26
  try {
30
- if (COPY_ENV === 'publish' && name !== 'package.json') {
27
+ if (name !== 'package.json') {
31
28
  fs.copyFileSync(name, copyName, fs.constants.COPYFILE_FICLONE)
32
29
  }
33
-
34
- if (COPY_ENV === 'init') {
35
- fs.copyFileSync(copyName, name, fs.constants.COPYFILE_FICLONE)
36
- }
37
30
  } catch (e) {
38
31
  console.log(e.message)
39
32
  }
40
-
41
- if (COPY_ENV === 'init') {
42
- try {
43
- fs.unlinkSync(copyName)
44
- } catch (e) {
45
- console.log(e.message)
46
- }
47
- }
48
33
  })
package/bin/create.js CHANGED
@@ -3,6 +3,7 @@
3
3
  const path = require('path')
4
4
  const fs = require('fs')
5
5
 
6
+ const configFiles = ['.gitignore', 'package-lock.json', 'package.json']
6
7
  const ignores = [
7
8
  '.git',
8
9
  'bin',
@@ -45,3 +46,19 @@ files.forEach(({ src, dest, destPath }) => {
45
46
  // ignore
46
47
  }
47
48
  })
49
+
50
+ configFiles.forEach((name) => {
51
+ const copyName = `${name}.copy`
52
+
53
+ try {
54
+ fs.copyFileSync(copyName, name, fs.constants.COPYFILE_FICLONE)
55
+ } catch (e) {
56
+ console.log(e.message)
57
+ }
58
+
59
+ try {
60
+ fs.unlinkSync(copyName)
61
+ } catch (e) {
62
+ console.log(e.message)
63
+ }
64
+ })