@startupjs/cli 0.55.0-alpha.12 → 0.55.0-alpha.14

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.
Files changed (2) hide show
  1. package/index.js +7 -56
  2. package/package.json +2 -4
package/index.js CHANGED
@@ -2,7 +2,6 @@ const commander = require('commander')
2
2
  const execa = require('execa')
3
3
  const path = require('path')
4
4
  const fs = require('fs')
5
- const Font = require('fonteditor-core').Font
6
5
  const template = require('lodash/template')
7
6
  const CLI_VERSION = require('./package.json').version
8
7
 
@@ -144,12 +143,8 @@ SCRIPTS_ORIG.patchGestureHandler = () => PATCHES_GESTURE_HANDLER_DIR
144
143
  `)
145
144
  : 'true'
146
145
 
147
- SCRIPTS_ORIG.fonts = () => oneLine(`
148
- npx react-native-asset
149
- `)
150
-
151
146
  SCRIPTS_ORIG.postinstall = () => oneLine(`
152
- ${SCRIPTS_ORIG.patchPackage()} && ${SCRIPTS_ORIG.fonts()}
147
+ ${SCRIPTS_ORIG.patchPackage()}}
153
148
  `)
154
149
 
155
150
  const SCRIPTS = {
@@ -166,8 +161,7 @@ const SCRIPTS = {
166
161
  ios: 'react-native run-ios',
167
162
  'ios-release': 'react-native run-ios --configuration Release',
168
163
  build: 'startupjs build --async',
169
- 'start-production': 'startupjs start-production',
170
- fonts: 'startupjs fonts'
164
+ 'start-production': 'startupjs start-production'
171
165
  }
172
166
 
173
167
  const DEFAULT_TEMPLATE = 'ui'
@@ -319,8 +313,8 @@ commander
319
313
  console.log('> Update config.json')
320
314
  updateConfigJson(projectPath, { projectName })
321
315
 
322
- console.log('> Patch package.json with additional scripts')
323
- patchScriptsInPackageJson(projectPath)
316
+ console.log('> Patch package.json')
317
+ patchPackageJson(projectPath)
324
318
 
325
319
  console.log('> Add additional things to .gitignore')
326
320
  appendGitignore(projectPath)
@@ -442,18 +436,6 @@ commander
442
436
  )
443
437
  })
444
438
 
445
- commander
446
- .command('fonts')
447
- .description('Rename fonts and react-native smart linking for assets')
448
- .action(async (options) => {
449
- renameFonts()
450
-
451
- await execa.command(
452
- SCRIPTS_ORIG.fonts(options),
453
- { stdio: 'inherit', shell: true }
454
- )
455
- })
456
-
457
439
  // ----- project management commands
458
440
 
459
441
  commander
@@ -505,40 +487,7 @@ async function recursivelyCopyFiles (sourcePath, targetPath) {
505
487
  }
506
488
  }
507
489
 
508
- function renameFonts () {
509
- const FONTS_PATH = process.cwd() + '/public/fonts'
510
- const EXT_WISHLIST = ['eot', 'otf', 'ttf', 'woff', 'woff2']
511
- const IGNORE = ['.gitignore', '.DS_Store', '.gitallowed']
512
-
513
- if (fs.existsSync(FONTS_PATH)) {
514
- const files = fs.readdirSync(FONTS_PATH)
515
-
516
- files.forEach(file => {
517
- if (IGNORE.includes(file)) return
518
-
519
- const [fileName, fileExt] = file.split('.')
520
- if (EXT_WISHLIST.indexOf(fileExt) === -1) {
521
- return console.error(`Font format error: ${fileExt} is not supported`)
522
- }
523
-
524
- const buffer = fs.readFileSync(`${FONTS_PATH}/${file}`)
525
- const font = Font.create(buffer, { type: fileExt })
526
-
527
- if (font.get().name.fontFamily === fileName) return
528
- font.get().name.fontFamily = fileName
529
- font.get().name.fontSubFamily = fileName
530
- font.get().name.preferredFamily = fileName
531
-
532
- const bufferUpdate = font.write({ type: fileExt })
533
- fs.writeFile(`${FONTS_PATH}/${file}`, bufferUpdate, (err) => {
534
- if (err) return console.log(err)
535
- console.log(`${file} rename font-family`)
536
- })
537
- })
538
- }
539
- }
540
-
541
- function patchScriptsInPackageJson (projectPath) {
490
+ function patchPackageJson (projectPath) {
542
491
  const packageJSONPath = path.join(projectPath, 'package.json')
543
492
  const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString())
544
493
 
@@ -547,6 +496,8 @@ function patchScriptsInPackageJson (projectPath) {
547
496
  delete packageJSON.devDependencies['react-test-renderer']
548
497
  delete packageJSON.devDependencies.jest
549
498
 
499
+ packageJSON.type = 'module'
500
+
550
501
  packageJSON.scripts = {
551
502
  ...packageJSON.scripts,
552
503
  ...SCRIPTS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startupjs/cli",
3
- "version": "0.55.0-alpha.12",
3
+ "version": "0.55.0-alpha.14",
4
4
  "description": "start, watch and build startupjs project",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -13,12 +13,10 @@
13
13
  "concurrently": "^6.4.0",
14
14
  "cross-env": "^7.0.3",
15
15
  "execa": "^2.0.4",
16
- "fonteditor-core": "2.1.11",
17
16
  "glob": "^7.1.6",
18
17
  "just-wait": "^1.0.11",
19
18
  "lodash": "^4.17.20",
20
19
  "nodemon": "2.0.22",
21
- "react-native-asset": "2.0.1",
22
20
  "rimraf": "^3.0.2",
23
21
  "source-map-support": "^0.5.19",
24
22
  "wait-on": "^5.2.1",
@@ -26,5 +24,5 @@
26
24
  "webpack-cli": "^4.9.1",
27
25
  "webpack-dev-server": "^4.4.0"
28
26
  },
29
- "gitHead": "d9fdf45341ca733978cdc4fa2562055922e0c2ed"
27
+ "gitHead": "a23711261cd41ea04ea3ad92ba5f714dba514682"
30
28
  }