@modern-js/generator-utils 1.2.1 → 1.2.4

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/.eslintrc.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['@modern-js'],
4
+ parserOptions: {
5
+ tsconfigRootDir: __dirname,
6
+ project: ['./tsconfig.json'],
7
+ },
8
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @modern-js/generator-utils
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 6b0bb5e3b: feat: bump codesmith version
8
+ - 69a728375: fix: remove exports.jsnext:source after publish
9
+ - Updated dependencies [cd7346b0d]
10
+ - Updated dependencies [69a728375]
11
+ - @modern-js/utils@1.7.2
12
+ - @modern-js/plugin-i18n@1.2.5
13
+
14
+ ## 1.2.3
15
+
16
+ ### Patch Changes
17
+
18
+ - 592edabc: feat: prebundle url-join,mime-types,json5,fast-glob,globby,ora,inquirer
19
+ - Updated dependencies [2d155c4c]
20
+ - Updated dependencies [123e432d]
21
+ - Updated dependencies [e5a9b26d]
22
+ - Updated dependencies [0b26b93b]
23
+ - Updated dependencies [123e432d]
24
+ - Updated dependencies [f9f66ef9]
25
+ - Updated dependencies [592edabc]
26
+ - Updated dependencies [895fa0ff]
27
+ - Updated dependencies [3578913e]
28
+ - Updated dependencies [1c3beab3]
29
+ - @modern-js/utils@1.6.0
30
+
31
+ ## 1.2.2
32
+
33
+ ### Patch Changes
34
+
35
+ - 6cffe99d: chore:
36
+ remove react eslint rules for `modern-js` rule set.
37
+ add .eslintrc for each package to speed up linting
38
+ - 04ae5262: chore: bump @modern-js/utils to v1.4.1 in dependencies
39
+ - 60f7d8bf: feat: add tests dir to npmignore
40
+ - Updated dependencies [b8599d09]
41
+ - Updated dependencies [6cffe99d]
42
+ - Updated dependencies [04ae5262]
43
+ - Updated dependencies [60f7d8bf]
44
+ - Updated dependencies [3bf4f8b0]
45
+ - @modern-js/utils@1.5.0
46
+ - @modern-js/plugin-i18n@1.2.4
47
+
3
48
  ## 1.2.1
4
49
 
5
50
  ### Patch Changes
@@ -1,13 +1,10 @@
1
1
  import path from 'path';
2
- import { fs, getMonorepoPackages, canUseNpm, canUsePnpm, canUseYarn } from '@modern-js/utils';
3
- import execa from 'execa';
4
- import ora from 'ora';
2
+ import { fs, ora, execa, getMonorepoPackages, canUseNpm, canUsePnpm, canUseYarn } from '@modern-js/utils';
5
3
  import { stripAnsi } from "./utils/strip-ansi";
6
4
  import { i18n, localeKeys } from "./locale";
7
5
  export * from "./utils";
8
6
  export { fs, readTsConfigByFile, getPackageManager, canUseNpm, canUsePnpm, canUseYarn } from '@modern-js/utils';
9
- export { i18n } from "./locale"; // eslint-disable-next-line max-statements
10
-
7
+ export { i18n } from "./locale";
11
8
  export async function getPackageVersion(packageName, registry) {
12
9
  const spinner = ora('Loading...').start();
13
10
  spinner.color = 'yellow';
@@ -102,7 +99,7 @@ export function validatePackagePath(value, projectDir, options) {
102
99
  if (fs.existsSync(packageDir)) {
103
100
  return {
104
101
  success: false,
105
- error: i18n.t(localeKeys.pacakgePath.exit, {
102
+ error: i18n.t(localeKeys.packagePath.exit, {
106
103
  value
107
104
  })
108
105
  };
@@ -2,7 +2,7 @@ export const EN_LOCALE = {
2
2
  packageName: {
3
3
  exit: 'package name `{value}` is already exists'
4
4
  },
5
- pacakgePath: {
5
+ packagePath: {
6
6
  exit: 'package path {value} is already exists'
7
7
  }
8
8
  };
@@ -2,7 +2,7 @@ export const ZH_LOCALE = {
2
2
  packageName: {
3
3
  exit: '项目名称 {value} 已存在'
4
4
  },
5
- pacakgePath: {
5
+ packagePath: {
6
6
  exit: '目录 {value} 已存在'
7
7
  }
8
8
  };
@@ -77,10 +77,6 @@ var _path = _interopRequireDefault(require("path"));
77
77
 
78
78
  var _utils = require("@modern-js/utils");
79
79
 
80
- var _execa = _interopRequireDefault(require("execa"));
81
-
82
- var _ora = _interopRequireDefault(require("ora"));
83
-
84
80
  var _stripAnsi = require("./utils/strip-ansi");
85
81
 
86
82
  var _locale = require("./locale");
@@ -101,9 +97,8 @@ Object.keys(_utils2).forEach(function (key) {
101
97
 
102
98
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
103
99
 
104
- // eslint-disable-next-line max-statements
105
100
  async function getPackageVersion(packageName, registry) {
106
- const spinner = (0, _ora.default)('Loading...').start();
101
+ const spinner = (0, _utils.ora)('Loading...').start();
107
102
  spinner.color = 'yellow';
108
103
 
109
104
  if (await (0, _utils.canUsePnpm)()) {
@@ -113,7 +108,7 @@ async function getPackageVersion(packageName, registry) {
113
108
  args.push(`--registry=${registry}`);
114
109
  }
115
110
 
116
- const result = await (0, _execa.default)('pnpm', args);
111
+ const result = await (0, _utils.execa)('pnpm', args);
117
112
  spinner.stop();
118
113
  return (0, _stripAnsi.stripAnsi)(result.stdout);
119
114
  }
@@ -125,7 +120,7 @@ async function getPackageVersion(packageName, registry) {
125
120
  args.push(`--registry=${registry}`);
126
121
  }
127
122
 
128
- const result = await (0, _execa.default)('yarn', args);
123
+ const result = await (0, _utils.execa)('yarn', args);
129
124
  spinner.stop();
130
125
  return (0, _stripAnsi.stripAnsi)(result.stdout);
131
126
  }
@@ -137,7 +132,7 @@ async function getPackageVersion(packageName, registry) {
137
132
  args.push(`--registry=${registry}`);
138
133
  }
139
134
 
140
- const result = await (0, _execa.default)('npm', args);
135
+ const result = await (0, _utils.execa)('npm', args);
141
136
  spinner.stop();
142
137
  return (0, _stripAnsi.stripAnsi)(result.stdout);
143
138
  }
@@ -202,7 +197,7 @@ function validatePackagePath(value, projectDir, options) {
202
197
  if (_utils.fs.existsSync(packageDir)) {
203
198
  return {
204
199
  success: false,
205
- error: _locale.i18n.t(_locale.localeKeys.pacakgePath.exit, {
200
+ error: _locale.i18n.t(_locale.localeKeys.packagePath.exit, {
206
201
  value
207
202
  })
208
203
  };
@@ -8,7 +8,7 @@ const EN_LOCALE = {
8
8
  packageName: {
9
9
  exit: 'package name `{value}` is already exists'
10
10
  },
11
- pacakgePath: {
11
+ packagePath: {
12
12
  exit: 'package path {value} is already exists'
13
13
  }
14
14
  };
@@ -8,7 +8,7 @@ const ZH_LOCALE = {
8
8
  packageName: {
9
9
  exit: '项目名称 {value} 已存在'
10
10
  },
11
- pacakgePath: {
11
+ packagePath: {
12
12
  exit: '目录 {value} 已存在'
13
13
  }
14
14
  };
@@ -2,7 +2,7 @@ export declare const EN_LOCALE: {
2
2
  packageName: {
3
3
  exit: string;
4
4
  };
5
- pacakgePath: {
5
+ packagePath: {
6
6
  exit: string;
7
7
  };
8
8
  };
@@ -4,14 +4,14 @@ declare const localeKeys: {
4
4
  packageName: {
5
5
  exit: string;
6
6
  };
7
- pacakgePath: {
7
+ packagePath: {
8
8
  exit: string;
9
9
  };
10
10
  } | {
11
11
  packageName: {
12
12
  exit: string;
13
13
  };
14
- pacakgePath: {
14
+ packagePath: {
15
15
  exit: string;
16
16
  };
17
17
  };
@@ -2,7 +2,7 @@ export declare const ZH_LOCALE: {
2
2
  packageName: {
3
3
  exit: string;
4
4
  };
5
- pacakgePath: {
5
+ packagePath: {
6
6
  exit: string;
7
7
  };
8
8
  };
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  modulePathIgnorePatterns: [
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.1",
14
+ "version": "1.2.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -29,13 +29,11 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7",
32
- "@modern-js/plugin-i18n": "^1.2.1",
33
- "@modern-js/utils": "^1.2.2",
34
- "execa": "^5.1.1",
35
- "ora": "^5.4.1"
32
+ "@modern-js/plugin-i18n": "^1.2.5",
33
+ "@modern-js/utils": "^1.7.2"
36
34
  },
37
35
  "devDependencies": {
38
- "@modern-js/codesmith": "^1.0.8",
36
+ "@modern-js/codesmith": "^1.0.10",
39
37
  "@types/jest": "^26",
40
38
  "@types/node": "^14",
41
39
  "typescript": "^4",
@@ -51,8 +49,7 @@
51
49
  },
52
50
  "publishConfig": {
53
51
  "registry": "https://registry.npmjs.org/",
54
- "access": "public",
55
- "types": "./dist/types/index.d.ts"
52
+ "access": "public"
56
53
  },
57
54
  "scripts": {
58
55
  "new": "modern new",
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- };
@@ -1,8 +0,0 @@
1
- import { getPackageVersion } from '../src';
2
-
3
- describe('test generator utils', () => {
4
- test('test getPackageVersion', async () => {
5
- const version = await getPackageVersion('lodash');
6
- expect(typeof version === 'string').toBe(true);
7
- });
8
- });
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "paths": {}
8
- }
9
- }