@modern-js/plugin-changeset 1.0.0 → 1.1.1

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/plugin-changeset
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0fa83663: support more .env files
8
+ - Updated dependencies [6f7fe574]
9
+ - Updated dependencies [0fa83663]
10
+ - Updated dependencies [f594fbc8]
11
+ - @modern-js/core@1.1.2
12
+ - @modern-js/i18n-cli-language-detector@1.1.1
13
+ - @modern-js/plugin-i18n@1.1.1
14
+ - @modern-js/utils@1.1.2
15
+
16
+ ## 1.1.0
17
+
18
+ ### Minor Changes
19
+
20
+ - 96119db2: Relese v1.1.0### Patch Changes
21
+
22
+ - Updated dependencies [96119db2]
23
+ - Updated dependencies [eb00b569]
24
+ - @modern-js/core@1.1.0
25
+ - @modern-js/i18n-cli-language-detector@1.1.0
26
+ - @modern-js/plugin-i18n@1.1.0
27
+ - @modern-js/utils@1.1.0
28
+
29
+ ## 1.0.1
30
+
31
+ ### Patch Changes
32
+
33
+ - fix: release command support --no-git-checks
34
+
3
35
  ## 1.0.0
4
36
 
5
37
  ### Patch Changes
package/README.md CHANGED
@@ -17,10 +17,7 @@
17
17
 
18
18
  > 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.
19
19
 
20
- - 介绍 Modern.js (即将上线)
21
- - [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
22
- - [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
23
- - [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
20
+ - [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
24
21
 
25
22
  ## Getting Started
26
23
 
@@ -10,6 +10,10 @@ export async function bump(options) {
10
10
 
11
11
  if (snapshot) {
12
12
  params.push('--snapshot');
13
+
14
+ if (typeof snapshot === 'string') {
15
+ params.push(snapshot);
16
+ }
13
17
  }
14
18
 
15
19
  if (ignore) {
@@ -1,4 +1,5 @@
1
- import { path, getPackageManager, isModernjsMonorepo, fs } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { getPackageManager, isModernjsMonorepo, fs } from '@modern-js/utils';
2
3
  import { tag as gitTag } from '@changesets/git';
3
4
  import { CHANGESET_PATH, execaWithStreamLog } from "../utils";
4
5
  // eslint-disable-next-line max-statements
@@ -9,7 +10,8 @@ export async function release(options) {
9
10
  const params = ['publish'];
10
11
  const {
11
12
  tag,
12
- ignoreScripts
13
+ ignoreScripts,
14
+ gitChecks
13
15
  } = options;
14
16
 
15
17
  if (tag) {
@@ -31,6 +33,10 @@ export async function release(options) {
31
33
  params.push('--ignore-scripts');
32
34
  }
33
35
 
36
+ if (!gitChecks) {
37
+ params.push('--no-git-checks');
38
+ }
39
+
34
40
  await execaWithStreamLog(packageManager, params);
35
41
  const pnpmPublishSummaryFile = path.join(appDir, 'pnpm-publish-summary.json');
36
42
  const publishInfo = await fs.readJSON(pnpmPublishSummaryFile, 'utf-8');
@@ -16,9 +16,9 @@ export default createPlugin(() => {
16
16
  program
17
17
  }) {
18
18
  program.command('change').description(i18n.t(localeKeys.command.change.describe)).option('--empty', i18n.t(localeKeys.command.change.empty), false).option('--open', i18n.t(localeKeys.command.change.open), false).action(options => change(options));
19
- program.command('bump').description(i18n.t(localeKeys.command.bump.describe)).option('--canary', i18n.t(localeKeys.command.bump.canary), false).option('--preid <tag>', i18n.t(localeKeys.command.bump.preid), 'next').option('--snapshot', i18n.t(localeKeys.command.bump.snapshot), false).action(options => bump(options));
19
+ program.command('bump').description(i18n.t(localeKeys.command.bump.describe)).option('--canary', i18n.t(localeKeys.command.bump.canary), false).option('--preid <tag>', i18n.t(localeKeys.command.bump.preid), 'next').option('--snapshot [snapshot]', i18n.t(localeKeys.command.bump.snapshot), false).action(options => bump(options));
20
20
  program.command('pre <enter|exit> [tag]').description(i18n.t(localeKeys.command.pre.describe)).action((type, tag) => pre(type, tag));
21
- program.command('release').description(i18n.t(localeKeys.command.release.describe)).option('--tag <tag>', i18n.t(localeKeys.command.release.tag), '').option('--ignore-scripts', i18n.t(localeKeys.command.release.ignore_scripts), '').action(options => release(options));
21
+ program.command('release').description(i18n.t(localeKeys.command.release.describe)).option('--tag <tag>', i18n.t(localeKeys.command.release.tag), '').option('--ignore-scripts', i18n.t(localeKeys.command.release.ignore_scripts), '').option('--no-git-checks', i18n.t(localeKeys.command.release.no_git_checks), '').action(options => release(options));
22
22
  }
23
23
 
24
24
  };
@@ -19,7 +19,8 @@ export const EN_LOCALE = {
19
19
  release: {
20
20
  describe: 'publish changes to npm',
21
21
  tag: 'publish use special tag',
22
- ignore_scripts: 'publish command ignore npm scripts, only can use in pnpm monorepo'
22
+ ignore_scripts: 'publish command ignore npm scripts, only can use in pnpm monorepo',
23
+ no_git_checks: 'publish command ignore checking if current branch is your publish branch, clean, and up-to-date, only can use in pnpm monorepo'
23
24
  }
24
25
  }
25
26
  };
@@ -19,7 +19,8 @@ export const ZH_LOCALE = {
19
19
  release: {
20
20
  describe: '发布 npm 包',
21
21
  tag: '发布 npm 包使用特定的 tag',
22
- ignore_scripts: '发布时忽略 package.json 中的 scripts 命令,仅支持在 pnpm monorepo 中使用'
22
+ ignore_scripts: '发布时忽略 package.json 中的 scripts 命令,仅支持在 pnpm monorepo 中使用',
23
+ no_git_checks: '发布命令忽略检查当前分支是否是发布分支,干净且最新,仅支持在 pnpm monorepo 中使用'
23
24
  }
24
25
  }
25
26
  };
@@ -1,6 +1,5 @@
1
1
  import execa from 'execa';
2
- import { upath } from '@modern-js/utils';
3
- export const CHANGESET_PATH = upath.normalizeSafe(require.resolve('@changesets/cli'));
2
+ export const CHANGESET_PATH = require.resolve('@changesets/cli');
4
3
  export function execaWithStreamLog(command, args) {
5
4
  const promise = execa(command, args, {
6
5
  stdin: 'inherit',
@@ -18,6 +18,10 @@ async function bump(options) {
18
18
 
19
19
  if (snapshot) {
20
20
  params.push('--snapshot');
21
+
22
+ if (typeof snapshot === 'string') {
23
+ params.push(snapshot);
24
+ }
21
25
  }
22
26
 
23
27
  if (ignore) {
@@ -5,12 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.release = release;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _utils = require("@modern-js/utils");
9
11
 
10
12
  var _git = require("@changesets/git");
11
13
 
12
14
  var _utils2 = require("../utils");
13
15
 
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
14
18
  // eslint-disable-next-line max-statements
15
19
  async function release(options) {
16
20
  const appDir = process.cwd();
@@ -19,7 +23,8 @@ async function release(options) {
19
23
  const params = ['publish'];
20
24
  const {
21
25
  tag,
22
- ignoreScripts
26
+ ignoreScripts,
27
+ gitChecks
23
28
  } = options;
24
29
 
25
30
  if (tag) {
@@ -41,9 +46,13 @@ async function release(options) {
41
46
  params.push('--ignore-scripts');
42
47
  }
43
48
 
49
+ if (!gitChecks) {
50
+ params.push('--no-git-checks');
51
+ }
52
+
44
53
  await (0, _utils2.execaWithStreamLog)(packageManager, params);
45
54
 
46
- const pnpmPublishSummaryFile = _utils.path.join(appDir, 'pnpm-publish-summary.json');
55
+ const pnpmPublishSummaryFile = _path.default.join(appDir, 'pnpm-publish-summary.json');
47
56
 
48
57
  const publishInfo = await _utils.fs.readJSON(pnpmPublishSummaryFile, 'utf-8');
49
58
  await Promise.all((publishInfo.publishedPackages || []).map(pkg => (0, _git.tag)(`${pkg.name}@${pkg.version}`, appDir)));
@@ -28,9 +28,9 @@ var _default = (0, _core.createPlugin)(() => {
28
28
  program
29
29
  }) {
30
30
  program.command('change').description(_locale.i18n.t(_locale.localeKeys.command.change.describe)).option('--empty', _locale.i18n.t(_locale.localeKeys.command.change.empty), false).option('--open', _locale.i18n.t(_locale.localeKeys.command.change.open), false).action(options => (0, _commands.change)(options));
31
- program.command('bump').description(_locale.i18n.t(_locale.localeKeys.command.bump.describe)).option('--canary', _locale.i18n.t(_locale.localeKeys.command.bump.canary), false).option('--preid <tag>', _locale.i18n.t(_locale.localeKeys.command.bump.preid), 'next').option('--snapshot', _locale.i18n.t(_locale.localeKeys.command.bump.snapshot), false).action(options => (0, _commands.bump)(options));
31
+ program.command('bump').description(_locale.i18n.t(_locale.localeKeys.command.bump.describe)).option('--canary', _locale.i18n.t(_locale.localeKeys.command.bump.canary), false).option('--preid <tag>', _locale.i18n.t(_locale.localeKeys.command.bump.preid), 'next').option('--snapshot [snapshot]', _locale.i18n.t(_locale.localeKeys.command.bump.snapshot), false).action(options => (0, _commands.bump)(options));
32
32
  program.command('pre <enter|exit> [tag]').description(_locale.i18n.t(_locale.localeKeys.command.pre.describe)).action((type, tag) => (0, _commands.pre)(type, tag));
33
- program.command('release').description(_locale.i18n.t(_locale.localeKeys.command.release.describe)).option('--tag <tag>', _locale.i18n.t(_locale.localeKeys.command.release.tag), '').option('--ignore-scripts', _locale.i18n.t(_locale.localeKeys.command.release.ignore_scripts), '').action(options => (0, _commands.release)(options));
33
+ program.command('release').description(_locale.i18n.t(_locale.localeKeys.command.release.describe)).option('--tag <tag>', _locale.i18n.t(_locale.localeKeys.command.release.tag), '').option('--ignore-scripts', _locale.i18n.t(_locale.localeKeys.command.release.ignore_scripts), '').option('--no-git-checks', _locale.i18n.t(_locale.localeKeys.command.release.no_git_checks), '').action(options => (0, _commands.release)(options));
34
34
  }
35
35
 
36
36
  };
@@ -25,7 +25,8 @@ const EN_LOCALE = {
25
25
  release: {
26
26
  describe: 'publish changes to npm',
27
27
  tag: 'publish use special tag',
28
- ignore_scripts: 'publish command ignore npm scripts, only can use in pnpm monorepo'
28
+ ignore_scripts: 'publish command ignore npm scripts, only can use in pnpm monorepo',
29
+ no_git_checks: 'publish command ignore checking if current branch is your publish branch, clean, and up-to-date, only can use in pnpm monorepo'
29
30
  }
30
31
  }
31
32
  };
@@ -25,7 +25,8 @@ const ZH_LOCALE = {
25
25
  release: {
26
26
  describe: '发布 npm 包',
27
27
  tag: '发布 npm 包使用特定的 tag',
28
- ignore_scripts: '发布时忽略 package.json 中的 scripts 命令,仅支持在 pnpm monorepo 中使用'
28
+ ignore_scripts: '发布时忽略 package.json 中的 scripts 命令,仅支持在 pnpm monorepo 中使用',
29
+ no_git_checks: '发布命令忽略检查当前分支是否是发布分支,干净且最新,仅支持在 pnpm monorepo 中使用'
29
30
  }
30
31
  }
31
32
  };
@@ -8,11 +8,9 @@ exports.execaWithStreamLog = execaWithStreamLog;
8
8
 
9
9
  var _execa = _interopRequireDefault(require("execa"));
10
10
 
11
- var _utils = require("@modern-js/utils");
12
-
13
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
12
 
15
- const CHANGESET_PATH = _utils.upath.normalizeSafe(require.resolve('@changesets/cli'));
13
+ const CHANGESET_PATH = require.resolve('@changesets/cli');
16
14
 
17
15
  exports.CHANGESET_PATH = CHANGESET_PATH;
18
16
 
@@ -1,5 +1,5 @@
1
1
  interface BumpOptions {
2
- snapshot: boolean;
2
+ snapshot: boolean | string;
3
3
  canary: boolean;
4
4
  preid: string;
5
5
  ignore: string[];
@@ -1,6 +1,7 @@
1
1
  interface PublishOptions {
2
2
  tag: string;
3
3
  ignoreScripts: boolean;
4
+ gitChecks: boolean;
4
5
  }
5
6
  export declare function release(options: PublishOptions): Promise<void>;
6
7
  export {};
@@ -20,6 +20,7 @@ export declare const EN_LOCALE: {
20
20
  describe: string;
21
21
  tag: string;
22
22
  ignore_scripts: string;
23
+ no_git_checks: string;
23
24
  };
24
25
  };
25
26
  };
@@ -22,6 +22,7 @@ declare const localeKeys: {
22
22
  describe: string;
23
23
  tag: string;
24
24
  ignore_scripts: string;
25
+ no_git_checks: string;
25
26
  };
26
27
  };
27
28
  } | {
@@ -46,6 +47,7 @@ declare const localeKeys: {
46
47
  describe: string;
47
48
  tag: string;
48
49
  ignore_scripts: string;
50
+ no_git_checks: string;
49
51
  };
50
52
  };
51
53
  };
@@ -20,6 +20,7 @@ export declare const ZH_LOCALE: {
20
20
  describe: string;
21
21
  tag: string;
22
22
  ignore_scripts: string;
23
+ no_git_checks: string;
23
24
  };
24
25
  };
25
26
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.0.0",
14
+ "version": "1.1.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -31,21 +31,21 @@
31
31
  "@babel/runtime": "^7",
32
32
  "@changesets/cli": "2.16.0",
33
33
  "@changesets/git": "^1.1.2",
34
- "@modern-js/i18n-cli-language-detector": "^1.0.0",
35
- "@modern-js/plugin-i18n": "^1.0.0",
36
- "@modern-js/utils": "^1.0.0",
34
+ "@modern-js/i18n-cli-language-detector": "^1.1.1",
35
+ "@modern-js/plugin-i18n": "^1.1.1",
36
+ "@modern-js/utils": "^1.1.2",
37
37
  "execa": "^5.1.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@modern-js/core": "^1.0.0",
41
- "@modern-js/module-tools": "^1.0.0",
42
- "@modern-js/plugin-testing": "^1.0.0",
40
+ "@modern-js/core": "^1.1.2",
41
+ "@modern-js/module-tools": "^1.1.0",
42
+ "@modern-js/plugin-testing": "^1.1.0",
43
43
  "@types/jest": "^26",
44
44
  "@types/node": "^14",
45
45
  "typescript": "^4"
46
46
  },
47
47
  "peerDependencies": {
48
- "@modern-js/core": "^1.0.0"
48
+ "@modern-js/core": "^1.1.2"
49
49
  },
50
50
  "sideEffects": false,
51
51
  "modernConfig": {
@@ -1,7 +1,7 @@
1
1
  import { CHANGESET_PATH, execaWithStreamLog } from '../utils';
2
2
 
3
3
  interface BumpOptions {
4
- snapshot: boolean;
4
+ snapshot: boolean | string;
5
5
  canary: boolean;
6
6
  preid: string;
7
7
  ignore: string[];
@@ -13,6 +13,9 @@ export async function bump(options: BumpOptions) {
13
13
 
14
14
  if (snapshot) {
15
15
  params.push('--snapshot');
16
+ if (typeof snapshot === 'string') {
17
+ params.push(snapshot);
18
+ }
16
19
  }
17
20
 
18
21
  if (ignore) {
@@ -1,15 +1,12 @@
1
- import {
2
- path,
3
- getPackageManager,
4
- isModernjsMonorepo,
5
- fs,
6
- } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { getPackageManager, isModernjsMonorepo, fs } from '@modern-js/utils';
7
3
  import { tag as gitTag } from '@changesets/git';
8
4
  import { CHANGESET_PATH, execaWithStreamLog } from '../utils';
9
5
 
10
6
  interface PublishOptions {
11
7
  tag: string;
12
8
  ignoreScripts: boolean;
9
+ gitChecks: boolean;
13
10
  }
14
11
  // eslint-disable-next-line max-statements
15
12
  export async function release(options: PublishOptions) {
@@ -19,7 +16,7 @@ export async function release(options: PublishOptions) {
19
16
 
20
17
  const params = ['publish'];
21
18
 
22
- const { tag, ignoreScripts } = options;
19
+ const { tag, ignoreScripts, gitChecks } = options;
23
20
 
24
21
  if (tag) {
25
22
  params.push('--tag');
@@ -40,6 +37,10 @@ export async function release(options: PublishOptions) {
40
37
  params.push('--ignore-scripts');
41
38
  }
42
39
 
40
+ if (!gitChecks) {
41
+ params.push('--no-git-checks');
42
+ }
43
+
43
44
  await execaWithStreamLog(packageManager, params);
44
45
 
45
46
  const pnpmPublishSummaryFile = path.join(appDir, 'pnpm-publish-summary.json');
package/src/index.ts CHANGED
@@ -29,7 +29,11 @@ export default createPlugin(
29
29
  i18n.t(localeKeys.command.bump.preid),
30
30
  'next',
31
31
  )
32
- .option('--snapshot', i18n.t(localeKeys.command.bump.snapshot), false)
32
+ .option(
33
+ '--snapshot [snapshot]',
34
+ i18n.t(localeKeys.command.bump.snapshot),
35
+ false,
36
+ )
33
37
  .action((options: any) => bump(options));
34
38
 
35
39
  program
@@ -46,6 +50,11 @@ export default createPlugin(
46
50
  i18n.t(localeKeys.command.release.ignore_scripts),
47
51
  '',
48
52
  )
53
+ .option(
54
+ '--no-git-checks',
55
+ i18n.t(localeKeys.command.release.no_git_checks),
56
+ '',
57
+ )
49
58
  .action((options: any) => release(options));
50
59
  },
51
60
  };
package/src/locale/en.ts CHANGED
@@ -22,6 +22,8 @@ export const EN_LOCALE = {
22
22
  tag: 'publish use special tag',
23
23
  ignore_scripts:
24
24
  'publish command ignore npm scripts, only can use in pnpm monorepo',
25
+ no_git_checks:
26
+ 'publish command ignore checking if current branch is your publish branch, clean, and up-to-date, only can use in pnpm monorepo',
25
27
  },
26
28
  },
27
29
  };
package/src/locale/zh.ts CHANGED
@@ -22,6 +22,8 @@ export const ZH_LOCALE = {
22
22
  tag: '发布 npm 包使用特定的 tag',
23
23
  ignore_scripts:
24
24
  '发布时忽略 package.json 中的 scripts 命令,仅支持在 pnpm monorepo 中使用',
25
+ no_git_checks:
26
+ '发布命令忽略检查当前分支是否是发布分支,干净且最新,仅支持在 pnpm monorepo 中使用',
25
27
  },
26
28
  },
27
29
  };
@@ -1,7 +1,6 @@
1
1
  import execa from 'execa';
2
- import { upath } from '@modern-js/utils';
3
2
 
4
- export const CHANGESET_PATH = upath.normalizeSafe(require.resolve('@changesets/cli'));
3
+ export const CHANGESET_PATH = require.resolve('@changesets/cli');
5
4
 
6
5
  export function execaWithStreamLog(command: string, args: string[]) {
7
6
  const promise = execa(command, args, {