create-moost 0.3.23 → 0.3.25

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/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var moost = require('moost');
4
3
  var eventCli = require('@moostjs/event-cli');
5
4
  var eventCli$1 = require('@wooksjs/event-cli');
5
+ var moost = require('moost');
6
6
  var fs = require('fs');
7
7
  var prompts = require('prompts');
8
8
  var rewrite = require('@prostojs/rewrite');
@@ -61,14 +61,11 @@ async function getPrompts(inputs) {
61
61
  type: predefined.targetDir ? null : 'text',
62
62
  message: 'Project name:',
63
63
  initial: defaultProjectName,
64
- onState: (state) => (predefined.targetDir =
65
- String(state.value).trim() || defaultProjectName),
64
+ onState: (state) => (predefined.targetDir = String(state.value).trim() || defaultProjectName),
66
65
  },
67
66
  {
68
67
  name: 'overwrite',
69
- type: () => canSkipEmptying(predefined.targetDir) || inputs.force
70
- ? null
71
- : 'confirm',
68
+ type: () => (canSkipEmptying(predefined.targetDir) || inputs.force ? null : 'confirm'),
72
69
  message: () => {
73
70
  const dirForPrompt = predefined.targetDir === '.'
74
71
  ? 'Current directory'
@@ -162,8 +159,8 @@ async function getPrompts(inputs) {
162
159
  packageName: (results.packageName || results.targetDir || predefined.targetDir),
163
160
  };
164
161
  }
165
- catch (e) {
166
- console.log(e.message);
162
+ catch (error) {
163
+ console.log(error.message);
167
164
  process.exit(1);
168
165
  }
169
166
  }
@@ -181,7 +178,7 @@ function canSkipEmptying(dir) {
181
178
  return false;
182
179
  }
183
180
  function isValidPackageName(projectName) {
184
- return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
181
+ return /^(?:@[\d*a-z~-][\d*._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*$/.test(projectName);
185
182
  }
186
183
  function toValidPackageName(projectName) {
187
184
  return projectName
@@ -189,7 +186,7 @@ function toValidPackageName(projectName) {
189
186
  .toLowerCase()
190
187
  .replace(/\s+/g, '-')
191
188
  .replace(/^[._]/, '')
192
- .replace(/[^a-z0-9-~]+/g, '-');
189
+ .replace(/[^\da-z~-]+/g, '-');
193
190
  }
194
191
 
195
192
  const rw = new rewrite.ProstoRewrite({
@@ -223,8 +220,7 @@ async function scaffold(data) {
223
220
  excludeCommon.push('.eslintrc.json');
224
221
  }
225
222
  if (!data.prettier) {
226
- excludeCommon.push('.prettierignore');
227
- excludeCommon.push('.prettierrc');
223
+ excludeCommon.push('.prettierignore', '.prettierrc');
228
224
  }
229
225
  if (data.bundler !== 'rollup') {
230
226
  excludeCommon.push('rollup.config.js');
@@ -244,7 +240,7 @@ async function scaffold(data) {
244
240
  }
245
241
  function emptyDirectorySync(directory) {
246
242
  if (fs.existsSync(directory)) {
247
- fs.readdirSync(directory).forEach((file) => {
243
+ fs.readdirSync(directory).forEach(file => {
248
244
  const currentPath = path.join(directory, file);
249
245
  if (fs.lstatSync(currentPath).isDirectory()) {
250
246
  emptyDirectorySync(currentPath);
@@ -289,10 +285,12 @@ Follow these next steps to start your development server:
289
285
 
290
286
  2. Install the dependencies:
291
287
  ${''}npm install ${''}
292
- ${cli ? `
288
+ ${cli
289
+ ? `
293
290
  3. Make bin.js executable:
294
291
  ${''}chmod +x ./bin.js ${''}
295
- ` : ''}
292
+ `
293
+ : ''}
296
294
  ${cli ? '4' : '3'}. Start the development server:
297
295
  ${''}npm run dev${cli ? ' -- hello World' : ''}${''}
298
296
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Param, Controller, Moost } from 'moost';
2
1
  import { Cli, MoostCli } from '@moostjs/event-cli';
3
2
  import { useAutoHelp, useCliOption } from '@wooksjs/event-cli';
3
+ import { Param, Controller, Moost } from 'moost';
4
4
  import { existsSync, readdirSync, readFileSync, mkdirSync, lstatSync, rmdirSync, unlinkSync } from 'fs';
5
5
  import prompts from 'prompts';
6
6
  import { ProstoRewrite } from '@prostojs/rewrite';
@@ -59,14 +59,11 @@ async function getPrompts(inputs) {
59
59
  type: predefined.targetDir ? null : 'text',
60
60
  message: 'Project name:',
61
61
  initial: defaultProjectName,
62
- onState: (state) => (predefined.targetDir =
63
- String(state.value).trim() || defaultProjectName),
62
+ onState: (state) => (predefined.targetDir = String(state.value).trim() || defaultProjectName),
64
63
  },
65
64
  {
66
65
  name: 'overwrite',
67
- type: () => canSkipEmptying(predefined.targetDir) || inputs.force
68
- ? null
69
- : 'confirm',
66
+ type: () => (canSkipEmptying(predefined.targetDir) || inputs.force ? null : 'confirm'),
70
67
  message: () => {
71
68
  const dirForPrompt = predefined.targetDir === '.'
72
69
  ? 'Current directory'
@@ -160,8 +157,8 @@ async function getPrompts(inputs) {
160
157
  packageName: (results.packageName || results.targetDir || predefined.targetDir),
161
158
  };
162
159
  }
163
- catch (e) {
164
- console.log(e.message);
160
+ catch (error) {
161
+ console.log(error.message);
165
162
  process.exit(1);
166
163
  }
167
164
  }
@@ -179,7 +176,7 @@ function canSkipEmptying(dir) {
179
176
  return false;
180
177
  }
181
178
  function isValidPackageName(projectName) {
182
- return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
179
+ return /^(?:@[\d*a-z~-][\d*._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*$/.test(projectName);
183
180
  }
184
181
  function toValidPackageName(projectName) {
185
182
  return projectName
@@ -187,7 +184,7 @@ function toValidPackageName(projectName) {
187
184
  .toLowerCase()
188
185
  .replace(/\s+/g, '-')
189
186
  .replace(/^[._]/, '')
190
- .replace(/[^a-z0-9-~]+/g, '-');
187
+ .replace(/[^\da-z~-]+/g, '-');
191
188
  }
192
189
 
193
190
  const rw = new ProstoRewrite({
@@ -221,8 +218,7 @@ async function scaffold(data) {
221
218
  excludeCommon.push('.eslintrc.json');
222
219
  }
223
220
  if (!data.prettier) {
224
- excludeCommon.push('.prettierignore');
225
- excludeCommon.push('.prettierrc');
221
+ excludeCommon.push('.prettierignore', '.prettierrc');
226
222
  }
227
223
  if (data.bundler !== 'rollup') {
228
224
  excludeCommon.push('rollup.config.js');
@@ -242,7 +238,7 @@ async function scaffold(data) {
242
238
  }
243
239
  function emptyDirectorySync(directory) {
244
240
  if (existsSync(directory)) {
245
- readdirSync(directory).forEach((file) => {
241
+ readdirSync(directory).forEach(file => {
246
242
  const currentPath = join(directory, file);
247
243
  if (lstatSync(currentPath).isDirectory()) {
248
244
  emptyDirectorySync(currentPath);
@@ -287,10 +283,12 @@ Follow these next steps to start your development server:
287
283
 
288
284
  2. Install the dependencies:
289
285
  ${''}npm install ${''}
290
- ${cli ? `
286
+ ${cli
287
+ ? `
291
288
  3. Make bin.js executable:
292
289
  ${''}chmod +x ./bin.js ${''}
293
- ` : ''}
290
+ `
291
+ : ''}
294
292
  ${cli ? '4' : '3'}. Start the development server:
295
293
  ${''}npm run dev${cli ? ' -- hello World' : ''}${''}
296
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-moost",
3
- "version": "0.3.23",
3
+ "version": "0.3.25",
4
4
  "description": "create-moost",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/create-moost#readme",
44
44
  "dependencies": {
45
- "@moostjs/event-cli": "0.3.23",
46
- "@wooksjs/event-cli": "^0.4.26",
47
- "@prostojs/rewrite": "^0.0.4",
48
- "moost": "0.3.23",
45
+ "@moostjs/event-cli": "0.3.25",
46
+ "@wooksjs/event-cli": "^0.4.30",
47
+ "@prostojs/rewrite": "^0.1.0",
48
+ "moost": "0.3.25",
49
49
  "prompts": "^2.4.2"
50
50
  }
51
51
  }