@modern-js/generator-utils 1.1.2-alpha.0 → 1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @modern-js/generator-utils
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cfe11628: Make Modern.js self bootstraping
8
+
9
+ ### Patch Changes
10
+
11
+ - 2c049918: feat: polyfill function support enable using new command
12
+ - Updated dependencies [2da09c69]
13
+ - Updated dependencies [c3d46ee4]
14
+ - Updated dependencies [cfe11628]
15
+ - @modern-js/utils@1.2.0
16
+ - @modern-js/plugin-i18n@1.2.0
17
+
18
+ ## 1.1.3
19
+
20
+ ### Patch Changes
21
+
22
+ - f73fee4b: feat: upgrade codesmith version to add get npm package timeout's time
23
+
24
+ ## 1.1.2
25
+
26
+ ### Patch Changes
27
+
28
+ - 4819a3c7: feat: update generator version
29
+ - b7fb82ec: fix: get package manager function
30
+ - Updated dependencies [5e3de7d8]
31
+ - Updated dependencies [b7fb82ec]
32
+ - @modern-js/plugin-i18n@1.1.2
33
+ - @modern-js/utils@1.1.6
34
+
3
35
  ## 1.1.1
4
36
 
5
37
  ### Patch Changes
@@ -5,7 +5,7 @@ import ora from 'ora';
5
5
  import { stripAnsi } from "./utils/strip-ansi";
6
6
  import { i18n, localeKeys } from "./locale";
7
7
  export * from "./utils";
8
- export { fs, readTsConfigByFile, getPackageManager } from '@modern-js/utils';
8
+ export { fs, readTsConfigByFile, getPackageManager, canUseNpm, canUsePnpm, canUseYarn } from '@modern-js/utils';
9
9
  export { i18n } from "./locale"; // eslint-disable-next-line max-statements
10
10
 
11
11
  export async function getPackageVersion(packageName, registry) {
@@ -16,8 +16,29 @@ var _exportNames = {
16
16
  fs: true,
17
17
  readTsConfigByFile: true,
18
18
  getPackageManager: true,
19
+ canUseNpm: true,
20
+ canUsePnpm: true,
21
+ canUseYarn: true,
19
22
  i18n: true
20
23
  };
24
+ Object.defineProperty(exports, "canUseNpm", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _utils.canUseNpm;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "canUsePnpm", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _utils.canUsePnpm;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "canUseYarn", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _utils.canUseYarn;
40
+ }
41
+ });
21
42
  Object.defineProperty(exports, "fs", {
22
43
  enumerable: true,
23
44
  get: function () {
@@ -1,6 +1,6 @@
1
1
  import { GeneratorContext } from '@modern-js/codesmith';
2
2
  export * from './utils';
3
- export { fs, readTsConfigByFile, getPackageManager } from '@modern-js/utils';
3
+ export { fs, readTsConfigByFile, getPackageManager, canUseNpm, canUsePnpm, canUseYarn } from '@modern-js/utils';
4
4
  export { i18n } from './locale';
5
5
  export declare function getPackageVersion(packageName: string, registry?: string): Promise<string>;
6
6
  export declare function getPackageManagerText(packageManager: 'pnpm' | 'yarn' | 'npm'): string;
package/jest.config.js ADDED
@@ -0,0 +1,12 @@
1
+ const sharedConfig = require('@scripts/jest-config');
2
+
3
+ /** @type {import('@jest/types').Config.InitialOptions} */
4
+ module.exports = {
5
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
+ ...sharedConfig,
7
+ rootDir: __dirname,
8
+ modulePathIgnorePatterns: [
9
+ // TODO: 很容易超时导致失败,暂时先绕过
10
+ 'tests/index.test.ts',
11
+ ],
12
+ };
package/modern.config.js CHANGED
@@ -1,8 +1,2 @@
1
1
  /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {
3
- testing: {
4
- jest: {
5
- testTimeout: 30000,
6
- },
7
- },
8
- };
2
+ module.exports = {};
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.2-alpha.0",
14
+ "version": "1.2.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -20,6 +20,7 @@
20
20
  "exports": {
21
21
  ".": {
22
22
  "node": {
23
+ "jsnext:source": "./src/index.ts",
23
24
  "import": "./dist/js/modern/index.js",
24
25
  "require": "./dist/js/node/index.js"
25
26
  },
@@ -28,18 +29,19 @@
28
29
  },
29
30
  "dependencies": {
30
31
  "@babel/runtime": "^7",
31
- "@modern-js/plugin-i18n": "^1.1.1",
32
- "@modern-js/utils": "^1.1.2",
32
+ "@modern-js/plugin-i18n": "^1.2.0",
33
+ "@modern-js/utils": "^1.2.0",
33
34
  "execa": "^5.1.1",
34
35
  "ora": "^5.4.1"
35
36
  },
36
37
  "devDependencies": {
37
- "@modern-js/codesmith": "^1.0.7",
38
+ "@modern-js/codesmith": "^1.0.8",
38
39
  "@types/jest": "^26",
39
40
  "@types/node": "^14",
40
41
  "typescript": "^4",
41
- "@modern-js/module-tools": "^1.1.1",
42
- "@modern-js/plugin-testing": "^1.1.1"
42
+ "@scripts/build": "0.0.0",
43
+ "jest": "^27",
44
+ "@scripts/jest-config": "0.0.0"
43
45
  },
44
46
  "sideEffects": false,
45
47
  "modernConfig": {
@@ -49,11 +51,13 @@
49
51
  },
50
52
  "publishConfig": {
51
53
  "registry": "https://registry.npmjs.org/",
52
- "access": "public"
54
+ "access": "public",
55
+ "types": "./dist/types/index.d.ts"
53
56
  },
54
57
  "scripts": {
55
58
  "new": "modern new",
56
59
  "build": "modern build",
57
- "test": "modern test --passWithNoTests"
58
- }
60
+ "test": "jest --passWithNoTests"
61
+ },
62
+ "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
59
63
  }
package/src/index.ts CHANGED
@@ -14,7 +14,14 @@ import { i18n, localeKeys } from './locale';
14
14
 
15
15
  export * from './utils';
16
16
 
17
- export { fs, readTsConfigByFile, getPackageManager } from '@modern-js/utils';
17
+ export {
18
+ fs,
19
+ readTsConfigByFile,
20
+ getPackageManager,
21
+ canUseNpm,
22
+ canUsePnpm,
23
+ canUseYarn,
24
+ } from '@modern-js/utils';
18
25
 
19
26
  export { i18n } from './locale';
20
27
 
@@ -1,20 +1,8 @@
1
- import { getPackageVersion, canUseNpm, canUsePnpm, canUseYarn } from '@/index';
1
+ import { getPackageVersion } from '../src';
2
2
 
3
3
  describe('test generator utils', () => {
4
4
  test('test getPackageVersion', async () => {
5
5
  const version = await getPackageVersion('lodash');
6
6
  expect(typeof version === 'string').toBe(true);
7
7
  });
8
- test('test canUseNpm', async () => {
9
- const npmAbility = await canUseNpm();
10
- expect(typeof npmAbility === 'boolean').toBe(true);
11
- });
12
- test('test canUsePnpm', async () => {
13
- const pnpmAbility = await canUsePnpm();
14
- expect(typeof pnpmAbility === 'boolean').toBe(true);
15
- });
16
- test('test canUseYarn', async () => {
17
- const yarnAbility = await canUseYarn();
18
- expect(typeof yarnAbility === 'boolean').toBe(true);
19
- });
20
8
  });
@@ -4,8 +4,6 @@
4
4
  "declaration": false,
5
5
  "jsx": "preserve",
6
6
  "baseUrl": "./",
7
- "paths": {
8
- "@/*": ["../src/*"]
9
- }
7
+ "paths": {}
10
8
  }
11
9
  }
package/tsconfig.json CHANGED
@@ -4,9 +4,7 @@
4
4
  "declaration": false,
5
5
  "jsx": "preserve",
6
6
  "baseUrl": "./",
7
- "paths": {
8
- "@/*": ["./src/*"]
9
- }
7
+ "paths": {}
10
8
  },
11
9
  "include": ["src"]
12
10
  }