@variousjs/create 0.0.4 → 0.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/bin/copy.js CHANGED
@@ -1,28 +1,33 @@
1
1
  const fs = require('fs')
2
+ const package = require('../package.json')
2
3
 
3
4
  const files = ['.gitignore', 'package-lock.json', 'package.json']
4
- const { COPY_ENV } = process.env
5
+
6
+ package.name = 'variousjs'
7
+ package.version = '0.1.0'
8
+ package.private = true
9
+
10
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
+ const { prepublishOnly, ...rest } = package.scripts
12
+ package.scripts = rest
13
+
14
+ delete package.bin
15
+ delete package.publishConfig
16
+ delete package.repository
17
+ delete package.keywords
18
+ delete package.bugs
19
+ delete package.homepage
20
+
21
+ fs.writeFileSync('package.json.copy', JSON.stringify(package, null, 2))
5
22
 
6
23
  files.forEach((name) => {
7
24
  const copyName = `${name}.copy`
8
25
 
9
26
  try {
10
- if (COPY_ENV === 'publish') {
27
+ if (name !== 'package.json') {
11
28
  fs.copyFileSync(name, copyName, fs.constants.COPYFILE_FICLONE)
12
29
  }
13
-
14
- if (COPY_ENV === 'init') {
15
- fs.copyFileSync(copyName, name, fs.constants.COPYFILE_FICLONE)
16
- }
17
30
  } catch (e) {
18
31
  console.log(e.message)
19
32
  }
20
-
21
- if (COPY_ENV === 'init') {
22
- try {
23
- fs.unlinkSync(copyName)
24
- } catch (e) {
25
- console.log(e.message)
26
- }
27
- }
28
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
+ })